Why is the option "Recover this instance" disabled when creating an alarm in the EC2 console?
"I'm trying to create an Amazon CloudWatch alarm in the Amazon Elastic Compute Cloud (Amazon EC2) console. I want to recover my EC2 instance if it's impaired by an underlying hardware failure, and then send a notification when the alarm triggers. However, on the Create Alarm page, the "Recover this instance" option under "Take the action" is grayed out (disabled). The alarm notification options are also disabled. How do I turn these options back on?"
"I'm trying to create an Amazon CloudWatch alarm in the Amazon Elastic Compute Cloud (Amazon EC2) console. I want to recover my EC2 instance if it's impaired by an underlying hardware failure, and then send a notification when the alarm triggers. However, on the Create Alarm page, the "Recover this instance" option under "Take the action" is grayed out (disabled). The alarm notification options are also disabled. How do I turn these options back on?Short descriptionIf CloudWatch determines that an EC2 instance uses instance store volumes, the Recover this instance option is disabled. The recover action is not supported for EC2 instances that use instance store volumes, including those launched with block device mappings for instance store volumes. CloudWatch reads the metadata associated with each EC2 instance to verify that it doesn’t use instance store volumes before enabling the recover action.Note: The Recover action is supported only on certain instance types. Make sure that you launch a supported instance type. For more information, see Recover your instance. The EC2 recover alarm action is valid only for the StatusCheckFailed_System metric.ResolutionNote: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.Before proceeding, see Create alarms that stop, terminate, reboot, or recover an instance. Be sure that you meet all the prerequisites for creating CloudWatch alarms.Find ephemeral instance store volumes in EC2 Linux instances1.     Connect to your Linux instance.2.     Use the following command to retrieve metadata from your instance.curl http://169.254.169.254/latest/meta-data/block-device-mapping/3.     Use the output to identify instance store volumes (whose names begin with "ephemeral") mapped to the instance. For example, there are two instance store volumes ("ephemeral0" and "ephemeral2") in this output:[ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/block-device-mapping/amiephemeral0ephemeral2rootFind ephemeral instance store volumes in EC2 Windows instancesUsing a browser:1.     Connect to your Windows instance.2.     Open a browser and connect to:http://169.254.169.254/latest/meta-data/block-device-mapping/3.     Use the information returned to identify instance store volumes (whose names begin with "ephemeral") mapped to the instance.Using Windows PowerShell:1.     Connect to your Windows instance in PowerShell.2.     Run the following command:PS C:\> Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/block-device-mapping/3.     Use the output to identify instance store volumes (whose names begin with "ephemeral") mapped to the instance. For example, there is one instance store volume ("ephemeral0") in this output:amiephemeral0rootswapFor more information, see View the instance block device mapping for instance store volumes.Find ephemeral instance store volumes in AMIs for EC2 instancesReview the block device mappings for the Amazon Machine Image (AMI) for your EC2 instance. Check for block device instance store volumes whose "Block Devices" field includes "=ephemeral#", where "#" is an integer from 0-23.Block device mapping can occur even if the instance type doesn’t officially support instance store volumes. This action can occur when you use one of the following to launch an EC2 instance (Windows or Linux):The AWS CLIAn SDKA service such as AWS CloudFormation When you use the Amazon EC2 console to launch an instance type that doesn’t support instance store volumes, Amazon EC2 ignores modified block device mappings.You can enumerate the EBS volumes in an AMI’s block device mapping using the Amazon EC2 console or the AWS CLI.For example, the following describe-images command returns the BlockDeviceMapping for the AMI:aws ec2 describe-images --image-ids ami-xxxxxxxxExample output with instance store volumes whose "VirtualName" begins with "ephemeral":aws ec2 describe-images --image-ids ami-11112222"BlockDeviceMappings": [   {      "DeviceName": "/dev/xvda",      "Ebs": {         "DeleteOnTermination": true,         "SnapshotId": "snap-        ",         "VolumeSize": 8,         "VolumeType": "gp2",         "Encrypted": false      }   },   {      "DeviceName": "/dev/sdb",      "VirtualName": "ep0hemeral0"   },   {      "DeviceName": "/dev/sdc",      "VirtualName": "ephemeral2"   }],Remove or override any references to instance store volumes in the AMIAfter you’ve confirmed that your EC2 instance uses instance store volumes, you must remove or override any references to instance store volumes in the AMI. Then, you must relaunch the instance because instance store volumes can’t be added or removed from an existing EC2 instance.Use one of the following methods to remove or override references to instance store volumes:Remove references to instance store volumes from the AMI. Then, relaunch the instance.Launch the EC2 instance from the Amazon EC2 console to override the AMI for instance types that don’t support instance volume stores.Launch the EC2 instance from the AWS CLI, and then manually override each device in the AMI that references an instance store volume. For example, if you have devices "/dev/sdb" and "/dev/sdc" that map to instance store volumes, launch your EC2 instance using the run-instances command:aws ec2 run-instances --image-id ami-11112222 --subnet-id subnet-11112222 --instance-type t2.medium --key-name my_key --associate-public-ip-address --block-device-mappings  '[{"DeviceName": "/dev/sdb","NoDevice": ""},{"DeviceName": "/dev/sdc","NoDevice": ""}]'For an EC2 instance launched by CloudFormation, create a CloudFormation template to override mapping of any devices to instance store volumes. For example:{  "AWSTemplateFormatVersion": "2010-09-09",  "Resources": {   "I4EY8I": {    "Type": "AWS::EC2::Instance",    "Properties": {     "ImageId" : "ami-11112222",     "InstanceType" : "t2.medium",     "SubnetId" : "subnet-11112222",     "KeyName" : "my_key",   "BlockDeviceMappings" : [     {       "DeviceName":"/dev/sdb",       "NoDevice": {}     },     {       "DeviceName":"/dev/sdc",       "NoDevice": {}     }  ]   }  } }}For an EC2 instance launched by an SDK, check the relevant SDK documentation for how to override mapping devices to instance store volumes.Related informationUsing Amazon CloudWatch alarmsFollow"