AWS OpsWorks Auto Healing for Amazon EC2 Instances: Monitoring and Notifications

AWS OpsWorks Auto Healing for EC2 Instances

Prev Question Next Question

Question

Your team uses AWS OpsWorks to deploy resources for a web application.

In the OpsWorks service layer settings, you have enabled “Auto Healing” so that the layer's failed instances can be automatically replaced.

During the last month, the OpsWorks instances failed two times and OpsWorks auto healed them by replacing the instances.

You want to be notified whenever AWS OpsWorks Stacks auto healing triggers stop and start events on the Amazon EC2 instances.

Which method would you choose?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer : D.

Option A is incorrect because in AWS OpsWorks service layer settings, you cannot configure an SNS notification for auto healing.

You should configure the notification in AWS CloudWatch Event.

Option B is incorrect because the CloudWatch Event rule should be triggered for auto healing events.

In the event pattern, "OpsWorks Command State Change" is incorrect.

Option C is incorrect because in the event pattern, "OpsWorks Instance State Change" checks the instance state change.

However, the event rule should check the auto healing events.

Option D is CORRECT because with this event pattern, the Event rule will trigger a notification whenever auto-healing happens in OpsWorks.

Reference:

https://aws.amazon.com/blogs/mt/how-to-set-up-aws-opsworks-stacks-auto-healing-notifications-in-amazon-cloudwatch-events/

The correct answer to the question is B. Create a CloudWatch Event rule with the following event pattern: { "source": [ "aws.opsworks" ], "detail-type": [ "OpsWorks Command State Change" ] } Trigger the event notifications to an SNS topic.

Explanation:

AWS OpsWorks is a configuration management service that uses Chef, a powerful automation platform that transforms infrastructure into code. OpsWorks can be used to deploy and manage web applications and other workloads. One of the features of AWS OpsWorks is Auto Healing. Auto Healing is a feature that detects when an Amazon EC2 instance in an AWS OpsWorks layer becomes unresponsive and automatically replaces it with a new instance.

In this scenario, the OpsWorks service layer settings have already been configured to enable Auto Healing, which will automatically replace failed instances. However, the requirement is to be notified when the auto healing feature is triggered to replace the instances.

To enable notifications for AWS OpsWorks Stacks auto healing triggers, we need to configure an Amazon SNS topic and a CloudWatch Event rule. The CloudWatch Event rule will capture events from AWS OpsWorks Stacks and send them to the SNS topic for notification.

Option A is incorrect because there is no direct integration between AWS OpsWorks Stacks and SNS for auto healing notifications.

Option C is incorrect because the detail-type "OpsWorks Instance State Change" is used for events such as instances starting, stopping, or terminating. It does not include information on auto healing.

Option D is incorrect because the event pattern filters by "initiated_by": "auto-healing", but this filter may not capture all auto healing events.

Option B is the correct answer because the detail-type "OpsWorks Command State Change" is used for events such as command executions or instance replacements. This event pattern will capture all instances that are replaced by the auto healing feature. We can then trigger the event notifications to an SNS topic for alerting the team.

Therefore, the correct method to be notified whenever AWS OpsWorks Stacks auto healing triggers stop and start events on the Amazon EC2 instances is to create a CloudWatch Event rule with the following event pattern: { "source": [ "aws.opsworks" ], "detail-type": [ "OpsWorks Command State Change" ] } Trigger the event notifications to an SNS topic.