Question: Why can't I start or launch my EC2 instance?

I can't launch or start my Amazon Elastic Compute Cloud (Amazon EC2) instance.

Short descriptionThere 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, first run the AWS Command Line Interface (AWS CLI) describe-instances command. Then, 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.Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.Run the describe-instances command:aws ec2 describe-instances --instance-id MYINSTANCE --output jsonCheck the StateReason message in the JSON response that the command returns.In the following example, the StateReason that's returned is Client.InternalError:"StateReason": {     "Message": "Client.InternalError: Client error on launch",     "Code": "Client.InternalError"   },ResolutionThe following are common errors that can prevent you from starting your instance:InsufficientInstanceCapacityYou receive the following error message:"An error occurred (InsufficientInstanceCapacity) when calling the RunInstances operation (reached max retries: 4). We currently do not have sufficient capacity in the Availability Zone you requested."This error occurs if there isn't enough On-Demand capacity to complete your request.For information on resolving this error, see How do I troubleshoot InsufficientInstanceCapacity errors when starting or launching an EC2 instance?InstanceLimitExceededYou receive the following error message:"Your quota allows for 0 more running instance(s)."This error occurs if you launched the maximum allowed instances in your AWS Region.For information on resolving this error, see How do I troubleshoot InstanceLimitExceeded errors when starting or launching an EC2 instance?UnauthorizedOperationThe UnauthorizedOperation error indicates that the user who's trying to launch the instance doesn't have the required permissions. To resolve this error, see How can I decode an authorization failure message after receiving an "UnauthorizedOperation" error during an EC2 instance launch?The requested configuration is currently not supportedEither of the following two issues cause this error:1.    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-12.    The Amazon Machine Image (AMI) that's used to launch the instance doesn't support the selected instance type. Before you select the instance type or family, refer to the AMI descriptions in the AWS Marketplace. This issue commonly occurs when you use AWS Marketplace AMIs, and launch them using the AWS CLI. When you launch instances from the Amazon EC2 console, unsupported instances are unavailable.Client.InternalErrorThere are several 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?Disk full errorsWhen you run out of space on an instance and the audit service stops the machine as soon as it's booted, 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:1.    Open the Amazon EC2 console.2.    Choose Instances from the navigation pane, and then select the instance.3.    Stop the instance.4.    Detach the EBS root volume (/dev/xvda for Linux) from the stopped instance.5.    Launch a new EC2 instance in the same Availability Zone as the impaired instance. The new instance becomes your rescue instance.6.    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.7.    Connect to your rescue instance using SSH.8.    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/rescue9.    Mount the volume at the directory that you created in step 8:$ sudo mount /dev/xvdf /mnt/rescueNote: 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.10.    Increase the root volume size.11.    Extend the partition.12.    Run the umount command to unmount the volume:$ sudo umount /mnt/rescue13.    Detach the volume from the temporary instance.14.    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.15.    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 and Amazon Linux 2, make sure that the audit service configuration includes the following options in /etc/audit/auditd.conf:max_log_file_action = ROTATEadmin_space_left_action = SUSPENDdisk_full_action = SUSPENDdisk_error_action = SUSPENDRelated informationTroubleshoot instance launch issues - LinuxTroubleshoot instance launch issues - WindowsWhy is my instance terminating immediately after launching or starting an instance?Amazon ECS best practices guide