Skip to content

Instantly share code, notes, and snippets.

@andrewgross
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgross/9f3b132e1b075258f296 to your computer and use it in GitHub Desktop.
Save andrewgross/9f3b132e1b075258f296 to your computer and use it in GitHub Desktop.
event_watch.py
import boto.ec2
ec2_conn = boto.ec2.connect_to_region('us-east-1')
def check_events():
statuses = ec2_conn.get_all_instance_status(filters={"event.description": "Scheduled reboot"})
for status in statuses:
if status.events:
for event in status.events:
print "{}: {}".format(status.id, event.description)
if __name__ == "__main__":
check_events()
# Usage (requires python 2.7+):
# Have a .boto file, or AWS API keys in your env where boto can find them
# pip install boto
# watch python event_watch.py
# Make sure to set your region correctly, or modify the script if you are multi-region
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment