Skip to content

Instantly share code, notes, and snippets.

@o-can
Last active May 11, 2016 09:18
Show Gist options
  • Save o-can/ebd2a2c5e128e54d3c5966eecb9a91e0 to your computer and use it in GitHub Desktop.
Save o-can/ebd2a2c5e128e54d3c5966eecb9a91e0 to your computer and use it in GitHub Desktop.
# List all security Groups with GroupName SSH
aws --profile sandbox ec2 describe-security-groups --query SecurityGroups[?GroupName=='SSH']
# Launch Instance
aws --profile sandbox ec2 run-instances --image-id ami-48c62427 --key-name sandbox --security-group-ids sg-XXXXXXXX --instance-type t2.small --subnet-id subnet-XXXXXXX
# Describe Public IP of running instances
aws --profile sandbox ec2 describe-instances --query Reservations[*].Instances[?State.Name=='running'].{PublicIp:PublicIpAddress}
# Authorize Ingress Security Group for SSH to ALL
aws --profile sandbox ec2 authorize-security-group-ingress --port 22 --cidr 0.0.0.0/0 --protocol tcp --group-id sg-XXXXXXXX
# Compress from S3 to Stdin to Stdout to S3
aws s3 cp s3://<bucket>/test.log - | gzip -c | aws s3 cp - s3://<bucket>/test.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment