Create a Capacity Reservation Fleet - Amazon Elastic Compute Cloud

Create a Capacity Reservation Fleet

When you create a Capacity Reservation Fleet it automatically creates Capacity Reservations for the instance types specified in the Fleet request, up to the specified total target capacity. The number of instances for which the Capacity Reservation Fleet reserves capacity depends on the total target capacity and instance type weights that you specify in the request. For more information, see Instance type weight and Total target capacity.

When you create the Fleet, you must specify the instance types to use and a priority for each of those instance types. For more information, see Allocation strategy and Instance type priority.

Note

The AWSServiceRoleForEC2CapacityReservationFleet service-linked role is automatically created in your account the first time that you create a Capacity Reservation Fleet. For more information, see Using service-linked roles for Capacity Reservation Fleet.

Currently, Capacity Reservation Fleets support the open instance matching criteria only.

To create a Capacity Reservation Fleet

Use the create-capacity-reservation-fleet AWS CLI command.

aws ec2 create-capacity-reservation-fleet \ --total-target-capacity capacity_units \ --allocation-strategy prioritized \ --instance-match-criteria open \ --tenancy dedicated|default \ --end-date yyyy-mm-ddThh:mm:ss.000Z \ --instance-type-specifications file://instanceTypeSpecification.json

The following is the contents of instanceTypeSpecification.json.

[ { "InstanceType": "instance_type", "InstancePlatform":"platform", "Weight": instance_type_weight, "AvailabilityZone":"availability_zone", "AvailabilityZoneId" : "az_id", "EbsOptimized": true|false, "Priority" : instance_type_priority } ]

Expected output.

{ "Status": "status", "TotalFulfilledCapacity": fulfilled_capacity, "CapacityReservationFleetId": "cr_fleet_id", "TotalTargetCapacity": capacity_units }

Example

aws ec2 create-capacity-reservation-fleet \ --total-target-capacity 24 \ --allocation-strategy prioritized \ --instance-match-criteria open \ --tenancy default \ --end-date 2021-12-31T23:59:59.000Z \ --instance-type-specifications file://instanceTypeSpecification.json

instanceTypeSpecification.json

[ { "InstanceType": "m5.xlarge", "InstancePlatform": "Linux/UNIX", "Weight": 3.0, "AvailabilityZone":"us-east-1a", "EbsOptimized": true, "Priority" : 1 } ]

Example output.

{ "Status": "submitted", "TotalFulfilledCapacity": 0.0, "CapacityReservationFleetId": "crf-abcdef01234567890", "TotalTargetCapacity": 24 }