On-Demand Capacity Reservation (ODCR) is a tool for reserving capacity without having to launch and run the instances. For capacity constrained instances like the p4d.24xlarge
, this is typically the only way to launch them.
In this section we’ll show you how to either:
Then once you’ve got capacity we’ll:
From the EC2 Capacity Reservations Console click Create
On the next screen enter p4d.24xlarge
as the instance type and enter the same Availibility Zone (AZ) as you setup previously
Leave the rest as default and click Create.
Copy the ODCR ID and proceed to Modify Cluster Config
If AWS creates a Capacity Reservation for you, you’ll need to accept it.
Once you accept the capacity reservation, then billing will start. Hence we recommend only accepting the capacity once you’re ready to build the cluster.
On the EC2 Capacity Reservations Console you’ll see a pending capacity reservation, click Accept.
That’s it, copy the id and proceed to Modify Cluster Config
AWS ParallelCluster supports specifying the CapacityReservationId in the cluster’s config file. On the Review screen, edit the cluster’s yaml and include (at the same indent level as Name: compute) the following:
CapacityReservationTarget:
CapacityReservationId: cr-061fcf9b1b320a075
If you have multiple ODCR’s you can group them together into a Capacity Reservation Group, this allows you to launch instances from multiple ODCR’s as part of the same queue of the cluster.
First create a group, this will return a group arn like: arn:aws:resource-groups:us-east-2:822857487308:group/MyCRGroup
. Save that for later.
$ aws resource-groups create-group --name MyCRGroup --configuration '{"Type":"AWS::EC2::CapacityReservationPool"}' '{"Type":"AWS::ResourceGroups::Generic", "Parameters": [{"Name": "allowed-resource-types", "Values": ["AWS::EC2::CapacityReservation"]}]}'
Next add your capacity reservations to that group:
aws resource-groups group-resources --group MyCRGroup --resource-arns arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-1234567890abcdef1 arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-54321abcdef567890
Then add the group to your cluster’s config like so:
CapacityReservationTarget:
CapacityReservationResourceGroupArn: arn:aws:resource-groups:us-east-2:123456789012:group/MyCRGroup