I want to troubleshoot the ReservationCapacityExceeded error that I receive when I launch or start an Amazon Elastic Compute Cloud (Amazon EC2) instance.
Short description
Capacity Reservations automatically match attributes of new or running instances such as instance type, platform, and Availability Zone. Also, you can specify whether to launch the instance into an open Capacity Reservation, a specific Capacity Reservation, or a group of Capacity Reservations. When you launch an instance into a Capacity Reservation, you might receive the following ReservationCapacityExceeded error:
"The requested reservation does not have sufficient compatible and available capacity for this request."
The preceding error occurs for the following reasons:
- Instance type, platform, and Availability Zone attributes of the Capacity Reservation and instance don't match.
- The Capacity Reservation doesn't have enough available capacity to fulfill the request.
- The status of the Capacity Reservation is either canceled or expired.
For more information, see On-Demand Capacity Reservations.
To view your Capacity Reservation details, open the Amazon EC2 console. Then, choose Capacity Reservations and choose the Capacity Reservation that you want to view.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.
Troubleshoot the ReservationCapacityExceeded error based on the following reasons:
Instance type, platform, and Availability Zone attributes of the Capacity Reservation and instance don't match
To view the Capacity Reservation details, run the following describe-capacity-reservations command:
Note: Replace example-capacity-reservation-ids with your Capacity Reservation IDs.
aws ec2 describe-capacity-reservations \
--capacity-reservation-ids example-capacity-reservation-ids
Resolve the ReservationCapacityExceeded error based on whether you want to launch an Amazon EC2 instance or start an existing Amazon EC2 instance.
Launch an Amazon EC2 instance
If you want to launch an Amazon EC2 instance, then check the instance type and Availability Zone that's specified. To retrieve the platform details, run the following describe-images command:
Note: Replace example-ami-ids with your AMI IDs.
aws ec2 describe-images --image-ids example-ami-id \
--query 'Images[].[PlatformDetails]'
If the instance type, platform, and Availability Zone don't match, then take the following actions:
- Use a Capacity Reservation that has matching attributes and enough available capacity.
- When you launch the instance, make sure that you provide or choose instance attributes that match the Capacity Reservation attributes.
Start an existing Amazon EC2 instance
If you want to start an existing Amazon EC2 instance, then check the instance type, platform details, and Availability Zone attributes of the instance. To check your instance attributes, run the describe-instances command or use the Amazon EC2 console. If the instance attributes don't match, then choose a Capacity Reservation that has matching attributes and enough available capacity. For more information, see Modify a stopped instance's Capacity Reservation settings.
The Capacity Reservation doesn't have enough available capacity to fulfill the request
To check the available capacity of a Capacity Reservation, view the AvailableInstanceCount Amazon CloudWatch metric for the Capacity Reservation. Or, run the following describe-capacity-reservations command:
Note: Replace example-capacity-reservation-ids with your Capacity Reservation IDs.
aws ec2 describe-capacity-reservations \
--capacity-reservation-ids example-capacity-reservation-ids \
--query 'CapacityReservations[0].{AvailableInstanceCount:AvailableInstanceCount}'
If you don't have enough available capacity to fulfill your requirement, then take the following actions:
The status of the Capacity Reservation is either canceled or expired
To view the status of your Capacity Reservation, run the describe-capacity-reservations command:
Note: Replace example-capacity-reservation-ids with your Capacity Reservation IDs.
aws ec2 describe-capacity-reservations \
--capacity-reservation-ids example-capacity-reservation-ids \
--query 'CapacityReservations[0].{Status : State}'
If the status of your Capacity Reservation is either cancelled or expired, then configure the instance to target a different Capacity Reservation. Target a Capacity Reservation that's active, matches the instance's attributes, and has enough available capacity. For more information, see Modify a stopped instance's Capacity Reservation settings. If you don't have a Capacity Reservation that matches the instance requirements, then create a new Capacity Reservation.
Related information
Launch instances into an existing Capacity Reservation
Why can't I start or launch my EC2 instance?