Finally the help of IT is here

Blog of computer solutions.

As you stop and start instance on Amazon AWS EC2

Written by Xaus Xavier Nadal on January 14th, 2014

Save pagePDF pageemail pagePrint page

We are going to show how extinguish a EC2 instance automatically to achieve cost savings and how to start instance Amazon Amazon EC2 from Windows command line. Thus we get cost free evening servers that are not being used.

The command to extinguish a EC2 instance is as follows:

ec2-stop-instances <Instance_ID> -region <Region>

The command to light a EC2 instance is as follows:

ec2-start-instances <Instance_ID> -region <Region>

But we need to make some small settings before, so we need to have a CLI EC2.

1.- Download client EC2: http://aws.amazon.com/developertools/351

Now let's define the environment variable JAVA_HOME with the following process:

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

Variable name: JAVA_HOME

Variable value: C: \ Program Files \ Java \ jre7

Click on OK to validate.

 

Now let's define the environment variable EC2_HOME with the same process above:

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

Variable name: EC2_home

Variable value: "location EC2 client folder that you downloaded in the first point" for example C: \ AWS \ CLI

Click on OK to validate.

Now let's add the new route to Path

Get back to configurator management environment variables and system variables click on Path click on edit and we add % EC2_HOME% \ bin the value of the variable.

Click on OK to validate.

Now let's define the environment variable AWS_ACCESS_KEY y AWS_SECRET_KEY the same process that we used above for each time you execute a process does not have to be putting the key by hand.

First we know the keys from Amazon, follow the link below to find it out: https://console.aws.amazon.com/iam/home?#security_credential and acceded to Access Keys (Access Key ID and Secret Access Key)

 

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

 

Variable name: AWS_ACCESS_KEY

Variable value: <Access Key ID of your connection>

 

In section System Variables click on News.

 

Variable name: AWS_SECRET_KEY

Variable value: <Secret Access Key of your connection>

 

Click on To accept.

Now that you have everything set as we show off one EC2 instance from the command line but first we must know the id server / instance and region of residence, so you will have to connect yourself to your management console in the EWS and see EC2 service instance ID that you want to have the off and in which region is taking as reference the following table:

 

Region Name Region

 

U.S. East (Northern Virginia) Region

us-east-1

U.S. West (Oregon) Region

us-west-2

U.S. West (Northern California) Region

us-west-1

EU (Ireland) Region

eu-west-1

Asia Pacific (Singapore) Region

ap-southeast-1

Asia Pacific (Sydney) Region

ap-southeast-2

Asia Pacific (Tokyo) Region

ap-northeast-1

South America (Sao Paulo) Region

sa-east-1

 

The command to extinguish a EC2 instance is as follows:

C: \ AWS \ CLI \ bin>ec2-stop-instances <Instance_ID> -region <Region>

The command to light a EC2 instance is as follows:

C: \ AWS \ CLI \ bin>ec2-start-instances <Instance_ID> -region <Region>

Now we only perform scheduled in our windows to the task 18: 15 ec2-stop run-instances and 08: 30 eg restart the instance with the command-start-instances ec2

Remember that the EBS (Music) will be charged equally and EIP (Elastic IP) the charge provided they are not assigned to an instance or the instance in use is off.

That's all folks, hope you have been helpful.

Soon. , Write your comments and will try to resolve the as far as possible.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , ,


2 Responses to "stop and start instance on Amazon AWS EC2"

  1. Martin Says:

    You're a genius!!

    Just what I needed.

    regards

  2. Jose Arredondo Says:

    Thank you for this valuable contribution, this is what a lot of knowledge is needed and contribute it.

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>