Last active
August 29, 2015 14:25
-
-
Save jameswnl/c82142ab20b9220a55e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#https://boto3.readthedocs.org/en/latest/reference/services/cloudwatch.html | |
import boto3 | |
client = boto3.client('cloudwatch') | |
r2=client.get_metric_statistics(Namespace='AWS/EC2', MetricName='CPUUtilization',Statistics=['SampleCount'],StartTime=datetime(2015, 7, 19), EndTime=datetime(2015, 7, 20), Period=120, Dimensions=[{'Name': 'InstanceId', 'Value': 'i-6a469f90'}]) | |
runs=[] | |
for status in ec2.meta.client.describe_instance_status()['InstanceStatuses']: | |
runs.append(status) | |
ec2 = boto3.resource('ec2') | |
myList = ec2.instances.filter(Filters=[{'Name': 'instance-state-name', 'Values': ['running']}]) | |
for instance in myList: | |
print(instance.id, instance.instance_type) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment