How do I troubleshoot issues with my Amazon EC2 On-Demand Capacity Reservation?
I use On-Demand Capacity Reservations for my Amazon Elastic Compute Cloud (Amazon EC2) instances. However, my Amazon EC2 instances don't use the reserved capacity.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
Check your Capacity Reservation configuration
Check your Capacity Reservation settings
Prerequisites: Your Capacity Reservation must adhere to the following requirements:
- The Capacity Reservation is Active.
- The Capacity Reservation uses the same instance type as your EC2 instance.
- The Capacity Reservation is in the same Availability Zone as your instance.
- The Capacity Reservation Utilization is below 100%.
To check your Capacity Reservation settings, open the Amazon EC2 console, and then choose Capacity Reservations. If your Capacity Reservation doesn't adhere to the preceding requirements, then cancel the Capacity Reservation. Then, create a new Capacity Reservation with the correct settings. You can't modify an existing Capacity Reservation.
Check whether you set the Capacity Reservation to open
Run the following describe-instances AWS CLI command to check the instance's Capacity Reservation settings:
aws ec2 describe-instances --filters --instance-ids instance-id
Note: Replace instance-id with the ID of the instance that uses the Capacity Reservation.
In the output, make sure that CapacityReservationSpecification is set to Open. If CapacityReservationSpecification is set to None, then you must update your Capacity Reservation settings to allow the instance to use the Capacity Reservation.
Example output:
"CapacityReservationSpecification": { "CapacityReservationPreference": "open", "CapacityReservationTarget": null }
Configure your instance for a stop and start
Note: When you stop and start an instance, the instance's public IP address changes. It's a best practice to use an Elastic IP address to route external traffic to your instance instead of a public IP address. If you use Amazon Route 53, then you might need to update the Route 53 DNS records when the public IP address changes.
Before you stop and start your instance, take the following actions:
- If your instance uses an instance store, then save the volume data on the instance store to persistent storage. For example, you can save the data to Amazon Elastic Block Store (Amazon EBS) volumes or Amazon Simple Storage Service (Amazon S3) buckets.
Important: Amazon EC2 deletes instance store data when you stop the instance. - Create a snapshot of your Amazon EBS volume. If you experience issues, then you can use the snapshot to restore your instance.
- Temporarily remove the instance from its Amazon EC2 Auto Scaling group so that you don't accidentally terminate the instance when you stop it.
Note: EC2 Auto Scaling might terminate stopped instances in an Auto Scaling group based on your scale-in protection settings. Instances that you launch with Amazon EMR, AWS CloudFormation, or AWS Elastic Beanstalk might be in an Auto Scaling group. - Set the instance shutdown behavior to Stop to make sure that the instances don't terminate when you stop them.
Set your Capacity Reservation to open
Complete the following steps:
- Stop the instance.
- Select the instance, and then choose Actions.
- Select Instance settings, and then choose Modify Capacity Reservation settings.
- For Capacity Reservation setting, choose Open.
- Choose Save.
- Start the instance.
- Run the following describe-instances command to validate that CapacityReservationSpecification is set to open:
Note: Replace instance-id with the instance ID.aws ec2 describe-instances --filters --instance-ids instance-id
Related information
How do I request a vCPU service quota increase for my EC2 On-Demand Instance?
How do I troubleshoot InsufficientInstanceCapacity errors when I start or launch an EC2 instance?
相關內容
- 已提問 10 個月前
- 已提問 3 年前
- 已提問 2 年前
AWS 官方已更新 7 個月前