User Tools

Site Tools


ec2

Using EC2 via the CLI

Listing the instances

You can get a list of the available instance with the following command.

aws ec2 describe-instances

Or — if you like it a little bit more readable — choose the table output option.

aws ec2 describe-instances --output=table

If you are only interested in instance number name and state use grep.

aws ec2 describe-instances | grep -E -o '\bi-[0-9a-f]+\b|STATE\b.*|Name.*'

Starting an instance

To start a stopped instance use the following command.

aws ec2 start-instances --instance-ids the_instance_id

Don't mix up start-instances and run-instances the later is to start a new instance from an AMI.

ec2.txt · Last modified: 2015/09/05 17:06 by sebastian