Skip to content

Automatically assigns EC2 capacity reservations based on the number of instances active.

License

Notifications You must be signed in to change notification settings

iann0036/auto-capacity-reservations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatic Capacity Reservations

When deployed, EC2 instances will automatically be assigned to a capacity reservation which will be maintained at the number of running instances that are matched.

The solution uses EventBridge Rules that react to EC2 instance state changes by invoking a Lambda that creates/increments/decrements or cancels capacity reservations based on the number of instances that match. Instances will be tagged with a AutoCapacityReservationId tag which indicates the assigned capacity reservation.

The solution is intended to provide guaranteed capacity for instances that are in a stopped or degraded state. Capacity reservations will be maintained for the entire lifecycle of an EC2 instance until termination. The capacity reservations are deliberately left in an open state so degraded instances can be easily replaced.

Installation

Launch Stack

Click the above link to deploy the stack to your environment. The capacity reservation provider will be effective for all instances launched within the region after the stack is created.

If you prefer, you can also manually upsert the template.yml stack from source and compile your own copy of the Lambda source. Please note that if you do this, the Python requirements must be included in the deployment package.

Instance Platform Support

With the recent introduction of full platform information in the DescribeImages API method, capacity reservations can now support all platform types out of the box, which are:

  • Linux/UNIX
  • Red Hat Enterprise Linux
  • SUSE Linux
  • Windows
  • Windows with SQL Server
  • Windows with SQL Server Enterprise
  • Windows with SQL Server Standard
  • Windows with SQL Server Web
  • Linux with SQL Server Standard
  • Linux with SQL Server Web
  • Linux with SQL Server Enterprise

Feedback

All feedback, issues or pull requests are welcomed to be raised in the project. This project is MIT licensed.

About

Automatically assigns EC2 capacity reservations based on the number of instances active.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages