Skip to content

Instantly share code, notes, and snippets.

@cam8001
Last active April 20, 2022 06:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
AWS CLI Snippets
# Get a list of all SSM managed instances that appear to be online
aws ssm describe-instance-information --filter Key=PingStatus,Values=Online --query "InstanceInformationList[*].{Instance:InstanceId,Name:Name}" --output=text
# Get a list of all IPs for a service in region
# Way 1: using prefix lists
aws ec2 get-managed-prefix-list-entries --prefix-list-id pl-b8a742d1
# Way 2: using ip-ranges.json
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes | map(select(.region=="ap-southeast-2" and .service=="EC2")) | map(.ip_prefix) | .[]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment