Using Cloudformation can you set the EC2 Recover Action on EC2 instances with ephemeral storage?

0

I've rewritten a Cloudformation template where I setup a Cloudwatch alarm to recover and instance if it detects a StatusCheckFailed_System:

SystemStatusCheckFailedAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: "Alarm for EC2 instance System Status Check failures" Namespace: "AWS/EC2" MetricName: "StatusCheckFailed_System" Dimensions: - Name: "InstanceId" Value: !Ref EC2InstanceId Statistic: "Maximum" Period: 60 # 1 minute EvaluationPeriods: 2 # Increase the evaluation period to 2 to ensure the alarm doesn't trigger false positives Threshold: 1 # 1 is the maximum value for StatusCheckFailed_System metric indicating failure ComparisonOperator: "GreaterThanOrEqualToThreshold" AlarmActions: - !Ref SystemStatusCheckFailedAlarmNotificationTopic - !Sub "arn:aws:automate:${AWS::Region}:ec2:recover"

My problem is that I tried applying the cloudformation template onto a R5d.xlarge and it gives the following error message

Error: Creating metric alarm failed: ValidationError: The EC2 'Recover' Action is not valid for the associated instance. Please remove or change to a different EC2 action. status code: 400, request id: f1ef242a-be24-45b7-a971-5430291a3081

This instance has ephemeral storage and is the only reason why I get this error message. I can't figure out why this is happening or how to fix it. Is it even possible to set the auto recover using cloudformation for these machines?

2 Answers
4

Hello,

As of the documentation "R5d.xlarge" instance type does not support Recovery option.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html

As you mentioned that the instance is ephemeral (Instance sore-Backed instance) that means if you are trying to recover a instance store then it is not possible to recover a instance store if instance get fails weather it is through cloud formation or other process. you can use "EBS" volumes because it doesn't fails if the instance get fails or terminated.

But you can use ASG to create an another instance if the previous instance gets failed but Note that it doesn't have the data stored in previous instance it only keeps your Application Availability.

profile picture
answered 11 days ago
0

Hello.

"R5d.xlarge" does not support automatic recovery.
The following instance types are supported:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html#instance-configuration-recovery

General purpose: A1 | M3 | M4 | M5 | M5a | M5n | M5zn | M6a | M6g | M6i | M6in | M7a | M7g | M7i | M7i-flex | T1 | T2 | T3 | T3a | T4g
Compute optimized: C3 | C4 | C5 | C5a | C5n | C6a | C6g | C6gn | C6i | C6in | C7a | C7g | C7gn | C7i
Memory optimized: R3 | R4 | R5 | R5a | R5b | R5n | R6a | R6g | R6i | R6in | R7a | R7g | R7i | R7iz | u-3tb1 | u-6tb1 | u-9tb1 | u-12tb1 | u-18tb1 | u-24tb1 | X1 | X1e | X2iezn
Accelerated computing: G3 | G3s | G5g | Inf1 | P2 | P3 | VT1
High-performance computing Hpc6a | Hpc7a | Hpc7g

profile picture
EXPERT
answered 11 days ago
profile pictureAWS
EXPERT
reviewed 11 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions