README: instance_action - starts, stops and terminates instances License: You can use/modify/circulate or do whatever you want. Just note that this script is given "As Is" without any warranty Requirements: Needs python 2.7.3 or newer (not python 3) boto library (at least 2.24.0). Can be dowmloaded here: https://pypi.python.org/pypi/boto/#downloads USAGE: instance_action.py [-h] [--instance INSTANCE] [--region REGION] [--access_key ACCESS_KEY] [--secret_key SECRET_KEY] [--force] {start,stop,terminate,terminate_with_vols} -h displays usage text --instance - instance ID --region (e.g. us-east-1) - if dropped the default will be used --access_key (e.g. AKIAIXXXXXX3G3N32Q) - if dropped the default will be used --secret_key (e.g. UGSYQL6PXXXXXXXXXXXXXXXXS+OwnA2GrJ0MOY4Y) - if dropped the default will be used --force - if dropped, a confirmation will be asked from the user {start,stop,terminate,terminate_with_vols} - action to perform on the instance Actions: start - will start the instance and wait until it's in 'running' state stop - will stop the instance and wait until it's in 'stopped' state terminate - will terminate the instance, wait until it's in 'terminated' state terminate_with_vols - will terminate the instance, wait until it's in 'terminated' state, and then will delete all volumes that were attached to it, even if they were'nt defined with "delete_on_termination". Defaults: At the top of the script there are 3 default definitions: AWS_ACCESS_KEY - default access key. If the scripts runs on an instance with a sufficient IAM role, it can be left as None and will work. If not can be switched to AWS_ACCESS_KEY = 'AKIAIVXXXXXXN3G3N32Q' AWS_SECRET_KEY - default secret key. If the scripts runs on an instance with a sufficient IAM role, it can be left as None and will work. If not can be switched to AWS_ACCESS_KEY = 'UGSYQL6PXXXXXXXXXX0Bf0bS/S+OwnA2GrJ0MOY4Y' AWS_REGION - defualt region in case --region is dropped. example: AWS_REGION = u'us-east-1' Examples: python instance_action.py --instance=i-72da3e5c --access_key=AKIAIVXXXXXXN3G3N32Q --secret_key=UGSYQL6PXXXXXXXXXX0Bf0bS/S+OwnA2GrJ0MOY4Y --force start python instance_action.py --instance=i-72da3e5c --access_key=AKIAIVXXXXXXN3G3N32Q --secret_key=UGSYQL6PXXXXXXXXXX0Bf0bS/S+OwnA2GrJ0MOY4Y stop python instance_action.py --instance=i-72da3e5c terminate