Skip to content

Instantly share code, notes, and snippets.

@algotrader-dotcom
Last active June 17, 2016 16:50
Show Gist options
  • Select an option

  • Save algotrader-dotcom/b4479b79644c87992267535cc53bb43c to your computer and use it in GitHub Desktop.

Select an option

Save algotrader-dotcom/b4479b79644c87992267535cc53bb43c to your computer and use it in GitHub Desktop.
AWS CLI cheat sheet
1. List all ec2 running with output table
$aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --output table
2. List all ec2 running with output table, with some fields only
$aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query 'Reservations[].Instances[].[Placement.AvailabilityZone, State.Name, InstanceId,InstanceType,Platform,Tags.Value,State.Code,Tags.Values]' --output table
-------------------------------------------------------------------------------------------
| DescribeInstances |
+---------------+----------+-------------+-------------+----------+-------+------+--------+
| eu-central-1a| running | i-0afd59b7 | m3.xlarge | None | None | 16 | None |
| eu-central-1a| running | i-dfff5b62 | m4.xlarge | windows | None | 16 | None |
| eu-central-1a| running | i-dffc5862 | m3.medium | None | None | 16 | None |
| eu-central-1a| running | i-697fdfd4 | c3.2xlarge | None | None | 16 | None |
+---------------+----------+-------------+-------------+----------+-------+------+--------
3. Create AMI from running instance
$aws ec2 create-image --instance-id i-0b09a25c58929de26 --name "My server" --no-reboot
4.
### AWS CLI Ref ###
http://docs.aws.amazon.com/cli/latest/reference/index.html#cli-aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment