Useful AWS CLI Commands
commands I have found to be useful
 Useful AWS CLI Commands 
 SSM
- make sure you can 
pinghost within the ec2 instance or usetelnet 
1
2
3
aws ssm start-session --target ec2-instance-id \
--document-name AWS-StartPortForwardingSessionToRemoteHost \
--parameters host="your-host",portNumber="host-port",localPortNumber="your-port"
- example for something like Aurora MySQL Cluster
 
1
2
3
aws ssm start-session --target i-######## \
--document-name AWS-StartPortForwardingSessionToRemoteHost \
--parameters host="name.cluster-randomchars.region.rds.amazonaws.com",portNumber="3306",localPortNumber="9000"
- Want to know how many free IPs per subnet you got in a AWS VPC?
 
1
2
3
aws ec2 describe-subnets --filters "Name=vpc-id,Values=vpc-xxxxxxxxx" \
  --query "Subnets[*].[SubnetId,CidrBlock,AvailableIpAddressCount]" \
  --output table
- Want to find the stack of a particular VPC?
 
1
aws cloudformation describe-stack-resources --physical-resource-id vpc-12345678 --query 'StackResources[0].StackName' --output text
 This post is licensed under  CC BY 4.0  by the author.