Last active
April 20, 2022 06:02
-
-
Save cam8001/93dc6258f394e1af964e0226c447ee03 to your computer and use it in GitHub Desktop.
AWS CLI Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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