Wednesday, November 13, 2013

Amazon AWS Change Instance Type

Changing instance type is quick with Amazon AWS CLI tools.
First download tools from http://aws.amazon.com/cli/
Then setup env. variables for easy use of tools:

1. Set EC2_HOME as path to your unzipped archive
2. Add EC2_HOME/bin to your PATH variable
3. Set env. variables with your access key and secret key which you can get from https://console.aws.amazon.com/iam/home?#security_credential
e.g.:
AWS_ACCESS_KEY_ID = AKIAIOSFODNN7EXAMPLEAWS_SECRET_ACCESS_KEY = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Follow the steps here for more guidance.
You can also check how to install it on Ubuntu here.

3. Test it, type from command line:
ec2-describe-instances

You should get response with info about your AWS instances.

Then when you already have instance running, let's say of type m1.small and you want upgrade it to m1.medium follow the below steps (supposing you have instance with ID = i-a57e31dc):

NOTE: After you change type your public DNS of instance will change. You must have EBS boot instance (not instance-store or S3-based AMI).

1. c2-stop-instances i-a57e31dc

2. Optionally, create a snapshot of old instance for future use - see ec2-create-image


3. ec2-modify-instance-attribute --instance-type m1.medium i-a57e31dc

4. ec2-start-instances i-a57e31dc

No comments:

Post a Comment