Change EC2 Size

From Deep Learning Course Wiki
Jump to: navigation, search

To change your EC2 instance size from the terminal, you need to be on your computer (and not ssh-ed into your instance). In this example, we are changing from t2.micro to t2.large, but you can modify as needed for other types or other attributes. Note that Amazon has some compatibility requirements for what types of instances can be resized into one another.

It is handy to have some aws aliases. You can run:


to get the alias commands we've created, source them, and then view them.

To store your instanceId as a bash variable, run: aws-get-t2. The steps below all assume that you have completed this step.

Now, you can type echo $instanceId to see your instanceId.

You need to stop your instance before you can resize it:

aws ec2 modify-instance-attribute --instance-id $instanceId --instance-type t2.large

Your instance should now be ready to go and still have the same files and programs as before. You can ssh into it using the same command as before, ssh -i ~/.ssh/aws-key.pem, only with the correct name of your ec2 instance. You should edit the definition of 'aws-get-t2' in to look for 't2.large' rather than 't2.micro'.