DEV Community

Cover image for Guidebook to your AWS EC2 Capacity Reservations !!

Guidebook to your AWS EC2 Capacity Reservations !!

Welcome to another blog on AWS EC2 capacity reservations. In simple terms

Capacity Reservation is simply put, is about reserving capacity of EC2 of the desired choice & attributes, for the usage against your workloads.

Why you would consider creating capacity reservation ?

Well, reserve capacity against a AZ, for a instance type, for a duration(time period), when you have critical workload requirements, applications demand high availability, and/or plan on disaster recovery with specified instance type & attributes.

Key reason to have capacity reserved, is to overcome the situation where on-demand capacity for instance type of your need/choice goes unavailable and reserving using this feature, will make the instance type available as long as the reservation stands valid

Facts on Capacity Reservations
1) CR can be created/cancelled anytime. Billing beings once the CR request gets into "Active" state
2) No discounts for reserving capacity and pricing stands to be on-demand
3) Savings or RI discounts will be applied on instances given that the instance attributes matches with SP, RI parameters
4) No commitment of tenure for the instance reservation

With this background, let us jump straight into creating CR and just not that, but create EC2 matching with CR criteria

Step 1

i) CR is accessible from EC2 Console view -> Capacity Reservations menu
ii) Name, instance AZ, tenancy, OS are core parameters & hence select as needed

iii) Instance type is m1.large

Image description

Step 2

i) Instead of time range, I made a choice to go with Manual creation of CR which means on completing the parameters & if request is active, then pricing begins to apply, as the instance is reserved(since the time CR request went active)
ii) Instance eligibility - is key for the CR to function as expected. Here, "Open" will match for any instance type matching attributes with CR request
iii) If selection is "Targeted" then the EC2 instance launched should have the CR Request ID selected, during the launch

Image description

Step 3

i) Well, that was pretty much for the definition of CR parameters, and on "Confirm" to create a CR, below popup confirms that, CR is active, then billing starts, irrespective of EC2 with matching attributes

Image description

Step 4

i) Here comes, the EC2 Instance Discovery[Instance Type] in EC2 console view menu
ii) I filtered out on m1.large, to get a view of rates against OS, storage, perforce, and other attributes of m1.large and confirm the decision on instance type selection in CR

Image description

Step 5

i) Now, the CR creations complete and also in active state
ii) Let us now, see how does it match with creation of EC2 with "Launch Instance" from here

Image description

Step 6

i) Starting with Name, Instance type, key pair for new instance

Image description

Step 7

i) Though, I reserved 2 instances, am launching only 1, m1.large with same prices quoted
ii) The CR id, CR Number appears under "Advanced" section of the "Launch Instance" menu
iii) Again, CR configuration will work for just matching attributes of EC2, yet, I select CR ID, CR #, just to experience the creation

Image description

Step 8

i) Finally, the instance is created with CR Id selection and Ideally would have been launched, if we just assume, that this instance type, wasn't available on-demand, by the time we launched this
ii) Now the Instance parameters does show the CR details

Image description

Step 9

i) Best part is that, as and when the instances of matching attributes or instances creation of CR Id mapping, happens, the capacity utilization of a reservation is updated under the CR Request Details view (as below)

Image description

Step 10

i) Now that we have seen how the EC2 creation worked, let us cancel the CR
ii) Alert message is given on 2 things; firstly, that instance no longer under reserved capacity and can get terminated, if there is no availability, secondly, the actions cancelling the CR cannot be undone

Image description

Step 11

i) Post cancelling the CR, the instance needs to be changed for its "Reservation mode"
ii) To perform this change, the EC2 instance has to be stopped first
iii) Do note, that the CR config is still the same
iv) Option to modify the "Reservation" settings is available under "Instance -> Actions -> Instance Settings -> Modify Capacity Reservation Settings" option

Image description

Step 12

i) Selecting "None" option in order to remove the instance from "Reservation Capacity" config
ii) Other options are "Open" as the name suggest allows to run instance in any group; Specific CR.- is to select a different CR here; Specify Capacity Reservation Resource Group - If the CR was creation with a Resource Group

Image description

Step 13

i) After the change, the instance has now been moved to started state, and no CR Configuration is now mapped with the EC2
ii) Thus the CR mapping was removed successfully

Image description

I believe that this is useful for folks who are intense compute planners, strategists. Welcome All !!

Top comments (0)