Skip to content

Instantly share code, notes, and snippets.

@tmichelet
Last active October 3, 2015 00:09
Show Gist options
  • Save tmichelet/5ff43f86f9bbc350e013 to your computer and use it in GitHub Desktop.
Save tmichelet/5ff43f86f9bbc350e013 to your computer and use it in GitHub Desktop.
[AWS] display metrics and contexts
import boto
import boto.ec2
import boto.ec2.cloudwatch
accounts = [
('<key>', '<secret>'),
]
regions = [r.name for r in boto.ec2.regions()]
for key, secret in accounts:
for region in regions:
print region
try:
ccw = boto.ec2.cloudwatch.connect_to_region(region, aws_access_key_id=key, aws_secret_access_key=secret)
metrics = ccw.list_metrics(namespace='AWS/AutoScaling')
for metric in metrics:
print metric.name, metric.dimensions
except Exception as e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment