Giter Site home page Giter Site logo

ec2-check-reserved-instances's Introduction

ec2-check-reserved-instances

EC2 Check Reserved Instances - Compare instance reservations with running instances

Amazon's reserved instances (ec2-describe-reserved-instances, ec2-describe-reserved-instances-offerings) are a great way to save money when using EC2. An EC2 instance reservation is specified by an availability zone, instance type, and quantity. Correlating the reservations you currently have active with your running instances is a manual, time-consuming, and error prone process.

This quick little Python script uses boto to inspect your reserved instances and running instances to determine if you currently have any reserved instances which are not being used. Additionally, it will give you a list of non-reserved instances which could benefit from additional reserved instance allocations.

To use the program, make sure you have boto installed. If you don't already have it, run:

$ easy_install boto

or

$ pip install boto

The only configuration needed is your AWS keys. These can either be modified at the top of the file, ec2-check-reserved-instances.py, or by exporting your keys in an environment variable:

$ export AWSAccessKeyId=1234567

$ export AWSSecretKey=j3jfijfisa83j+io4jfioajioaw

EXAMPLE OUTPUT

vela:~/dev epheph$ ./ec2-check-reserved-instances.py
UNUSED RESERVATION!	(1)	m1.small	us-east-1b
UNUSED RESERVATION!	(1)	m2.2xlarge	us-east-1a

Instance not reserved:	(1)	t1.micro	us-east-1c
Instance not reserved:	(2)	m1.small	us-east-1d
Instance not reserved:	(3)	m1.medium	us-east-1d
Instance not reserved:	(1)	m2.2xlarge	us-east-1b

(23) running on-demand instances
(18) reservations

In this example, you can easily see that an m2.2xlarge was spun up in the wrong AZ (us-east-1b vs. us-east-1a), as well as an m1.small. The "Instance not reserved" section shows that you could benefit from reserving:

  • (1) t1.micro
  • (1) m1.small (not 2, since you'll likely want to move your us-east-1b small to us-east-1d)
  • (3) m1.medium

TODO

  • Add some sort of sorting, by Availability Zone/instance type
  • Add VPC support
  • Currently only supports US-EAST. Make using other regions easy, perhaps just using an environment variable/internal config variable
  • External config? Is there some standard place to store AWS credentials?
  • Add option to use API to purchase the additional reservations (need to be EXTREMELY careful here, any mistake or miscommunication could cost quite a bit of money)
  • Windows? Not taking Windows reserved instances into account

ec2-check-reserved-instances's People

Contributors

epheph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ec2-check-reserved-instances's Issues

Error?

Got this in my shell, not sure if it means anything:

screen shot 2016-01-04 at 9 54 05 am

AWS credentials

Boto uses the environmental variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY if no arguments are given to boto.connect_ec2.

It's probably a good idea to skip the check for AWSAccessKeyId and AWSSecretKey and let boto use the standard environmental variables.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.