Why can't I start or launch my EC2 instance?
I can't launch a new Amazon Elastic Compute Cloud (Amazon EC2) instance or start my existing instance.
Resolution
There are multiple reasons why you might not be able to launch or start your EC2 instance. If you don't receive an error code when you try to start the instance, then do the following:
- Check for the StartInstances event in AWS CloudTrail.
-or-
Run the AWS Command Line Interface (AWS CLI) describe-instances command and specify the instance ID to see the reason for the problem. In the following example, replace MYINSTANCE with the instance ID that you're trying to start.
Check the StateReason message in the JSON response that the command returns. In the following example response, the StateReason that's returned is Client.InternalError:aws ec2 describe-instances --instance-id MYINSTANCE --output json
Note: If you receive errors when you run AWS CLI commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version."StateReason": { "Message": "Client.InternalError: Client error on launch", "Code": "Client.InternalError" },
- Review the following common errors to resolve the issue.
InsufficientInstanceCapacity
The following error occurs when launching new or restarting stopped instance and there isn't enough available On-Demand capacity to fulfill your request:
An error occurred (InsufficientInstanceCapacity) when calling the StartInstances operation (reached max retries: 4): Insufficient capacity.)
This error occurs if there isn't enough On-Demand capacity to complete your request.
For resolution information, see How do I troubleshoot InsufficientInstanceCapacity errors when starting or launching an EC2 instance?
InstanceLimitExceeded
The following error occurs when you launch more than your maximum allowed instances in an AWS Region:
InstanceLimitExceeded: Your quota allows for 0 more running instance(s).
If you receive this message, then submit a quota increase request to AWS Support. In your request, make sure that you include the instance type that you're trying to launch and the AWS Region that you're launching in.
For information on resolving this error, see How do I troubleshoot InstanceLimitExceeded errors when starting or launching an EC2 instance?
UnauthorizedOperation
The UnauthorizedOperation error occurs when the user who's trying to launch the instance doesn't have the required permissions. To resolve this error, see How do I decode an authorization failure message after I receive an "UnauthorizedOperation" error during an EC2 instance launch?
The requested configuration is currently not supported
One of the following two issues causes this error:
-
The specified instance type isn't supported in the requested Availability Zone. To check the availability of the instance types in specific Availability Zones, run the aws ec2 describe-instance-type-offerings command in the AWS CLI. Then, launch the instance in a supported Availability Zone.
For example, use the following command to check availability of the c5.2xlarge instance type across all Availability Zones in us-east-1:aws ec2 describe-instance-type-offerings --location-type availability-zone --filters Name=instance-type,Values=c5.2xlarge --region us-east-1
-
The AMI that's used to launch the instance doesn't support the selected instance type. Before you select the instance type or family, review the AMI descriptions in the AWS Marketplace. This issue commonly occurs when you use AWS Marketplace AMIs, and try to launch unsupported instances using the AWS CLI. When you launch instances from the Amazon EC2 console, unsupported instances are unavailable.
Client.InternalError
The following are common reasons why you might receive this error:
- An Amazon Elastic Block Store (Amazon EBS) volume isn't correctly attached to the instance.
- An EBS volume that's attached to the instance is in an ERROR state.
- An encrypted EBS volume is attached to the instance. However, you don't have permissions to access the AWS Key Management Services (AWS KMS) for decryption.
For information on resolving these issues, see How do I troubleshoot an Amazon EC2 instance that stops or terminates when I try to start it with the "InternalError" or "Client.UserInitiatedShutdown" error?
Disk full errors
When you run out of space on an instance and the audit service stops the machine when it boots, a disk full error occurs.
Note: Before you proceed, it's a best practice to create a snapshot to back up your volumes' data.
Important: These resolution steps require you to start and stop the instance. Be aware of the following:
- When the instance is stopped, you lose the data in your instance store volumes. For more information, see Determine the root device type of your instance.
- If you stop an instance that's part of an Amazon EC2 Auto Scaling group, then you might terminate the instance. Instances that are launched with Amazon EMR, AWS CloudFormation, and AWS Elastic Beanstalk might be part of an AWS Auto Scaling group. Instance termination in this scenario depends on the instance scale-in protection settings for your Auto Scaling group. If your instance is part of an Auto Scaling group, then temporarily remove it from the Auto Scaling group before you proceed.
- Stopping and starting your instance changes instance's the public IP address. When you route external traffic to your instance, it's a best practice to use an Elastic IP address instead of a public IP address.
To resolve disk full errors, do the following:
-
Open the Amazon EC2 console.
-
Choose Instances from the navigation pane, and then select the instance.
-
Detach the EBS root volume (/dev/xvda for Linux) from the stopped instance.
-
Launch a new EC2 instance in the same Availability Zone as the impaired instance. The new instance becomes your rescue instance.
-
Attach the root volume that you detached in step 4 to the rescue instance as a secondary device.
Note: When you attach secondary volumes, you can use different device names. -
Create a mount point directory for the new volume attached to the rescue instance in step 6. In the following example, the mount point directory is /mnt/rescue.
Note: The following $ sudo commands apply only to Linux environments:$ sudo mkdir /mnt/rescue
-
Mount the volume at the directory that you created in step 8:
$ sudo mount /dev/xvdf /mnt/rescue
Note: The device (/dev/xvdf, in this example) might have a different device name for the rescue instance that it's attached to. To determine the correct device names, use the lsblk command to view your available disk devices along with their mount points.
-
Run the umount command to unmount the volume:
$ sudo umount /mnt/rescue
-
Detach the volume from the temporary instance.
-
Attach the volume to the original instance with device name (/dev/xvda for Linux), and then start the instance to confirm that it boots successfully.
-
Review the audit service configuration to make sure that it doesn't have the option to halt (shutdown) the machine if it runs out of space. For Amazon Linux, Amazon Linux 2, and Amazon Linux 2023, make sure that the audit service configuration includes the following options in /etc/audit/auditd.conf:
max_log_file_action = ROTATE admin_space_left_action = SUSPEND disk_full_action = SUSPEND disk_error_action = SUSPEND
Client.InvalidParameterValue
InvalidParameterValue means that a parameter specified in the request isn't valid, is unsupported, or can't be used. The returned message provides an explanation of the error value. For example, if a root volume isn't attached to the instance at /dev/sda1 or /dev/xvda, depending on the AMI, then the instance doesn't start. When this occurs, you see an entry in AWS CloudTrail similar to the following:
An error occurred (InvalidParameterValue) when calling the StartInstances operation: Invalid value 'i-xxxxxxxxxxxxxxxxx' for instanceId. Instance does not have a volume attached at root (/dev/sda1)
To resolve this, use the error message as reference to change the relevant parameter. For example, to resolve the preceding example error, attach the root volume to the instance at /dev/sda1 and then start the instance. For more information, see Error codes for the Amazon EC2 API.
Related information
Troubleshoot instance launch issues - Linux
Troubleshoot instance launch issues - Windows
Amazon Elastic Container Service (Amazon ECS) best practices guide
Related videos
Relevant content
- asked a year agolg...
- asked 3 months agolg...
- asked 4 months agolg...
- asked a year agolg...
- asked 2 years agolg...
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago