Skip to content

Instantly share code, notes, and snippets.

@cam8001
Last active April 20, 2022 06:02
Show Gist options
  • Save cam8001/93dc6258f394e1af964e0226c447ee03 to your computer and use it in GitHub Desktop.
Save cam8001/93dc6258f394e1af964e0226c447ee03 to your computer and use it in GitHub Desktop.
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