Last active
August 29, 2015 14:07
-
-
Save andrewgross/9f3b132e1b075258f296 to your computer and use it in GitHub Desktop.
event_watch.py
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
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