Create a CloudWatch Alarm for Intermittent 500 Internal Server Errors | AWS Certified DevOps Engineer Exam DOP-C01

CloudWatch Alarm for Intermittent 500 Internal Server Errors

Prev Question Next Question

Question

You use Amazon CloudWatch as your primary monitoring system for your web application.

After a recent software deployment, your users are getting Intermittent 500 Internal Server Errors when using the web application.

You want to create a CloudWatch alarm and notify an on-call engineer when these occur.

How can you accomplish this using AWS services? Choose three answers from the options given below.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Answer - B, D and E.

You can use CloudWatch Logs to monitor applications and systems using log data.

CloudWatch Logs uses your log data for monitoring; so, no code changes are required.

For example, you can monitor application logs for specific literal terms (such as "NullReferenceException") or count the number of occurrences of a literal term at a particular position in log data (such as "404" status codes in an Apache access log)

When the term you are searching for is found, CloudWatch Logs reports the data to a CloudWatch metric that you specify.

Log data is encrypted while in transit and while it is at rest.

For more information on Cloudwatch logs, please refer to the below link:

http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html

Amazon CloudWatch uses Amazon SNS to send email.

First, create and subscribe to an SNS topic.

When you create a CloudWatch alarm, you can add this SNS topic to send an email notification when the alarm changes state.

For more information on SNS and Cloudwatch logs, please refer to the below link:

http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html

To accomplish this task, we need to use Amazon CloudWatch, which is a monitoring service provided by AWS. The steps to create a CloudWatch alarm and notify an on-call engineer when 500 Internal Server Errors occur are:

  1. Capture 500 Internal Server Errors using CloudWatch Metrics:

Option A: Deploy your web application as an AWS Elastic Beanstalk application. Use the default Elastic Beanstalk Cloudwatch metrics to capture 500 Internal Server Errors. Set a CloudWatch alarm on that metric.

In this option, we deploy our web application as an AWS Elastic Beanstalk application. AWS Elastic Beanstalk provides default CloudWatch metrics for monitoring the Elastic Beanstalk environment, which includes HTTP status codes like 500 Internal Server Error. We can set a CloudWatch alarm on this metric to trigger when the threshold is crossed.

  1. Stream web application logs to CloudWatch:

Option B: Install a CloudWatch Logs Agent on your servers to stream web application logs to CloudWatch.

In this option, we install a CloudWatch Logs Agent on our servers to stream web application logs to CloudWatch. We can then create metric filters on the CloudWatch Logs group to capture 500 Internal Server Errors. We can set a CloudWatch alarm on this metric filter to trigger when the threshold is crossed.

  1. Define metric filters that capture 500 Internal Server Errors:

Option D: Create a CloudWatch Logs group and define metric filters that capture 500 Internal Server Errors. Set a CloudWatch alarm on that metric.

In this option, we create a CloudWatch Logs group and define metric filters that capture 500 Internal Server Errors from the logs generated by our web application. We can then set a CloudWatch alarm on this metric filter to trigger when the threshold is crossed.

  1. Notify an on-call engineer when a CloudWatch alarm is triggered:

Option C: Use Amazon Simple Email Service to notify an on-call engineer when a CloudWatch alarm is triggered. Option E: Use Amazon Simple Notification Service to notify an on-call engineer when a CloudWatch alarm is triggered.

In both options, we can use either Amazon Simple Email Service (SES) or Amazon Simple Notification Service (SNS) to notify an on-call engineer when a CloudWatch alarm is triggered. SES is a cost-effective email service that can send email notifications to the on-call engineer. SNS is a managed messaging service that can send SMS, email, or push notifications to the on-call engineer.

In conclusion, the three options that can be used together to accomplish this task are:

Option A: Deploy your web application as an AWS Elastic Beanstalk application. Use the default Elastic Beanstalk Cloudwatch metrics to capture 500 Internal Server Errors. Set a CloudWatch alarm on that metric. Option D: Create a CloudWatch Logs group and define metric filters that capture 500 Internal Server Errors. Set a CloudWatch alarm on that metric. Option C or E: Use either Amazon Simple Email Service or Amazon Simple Notification Service to notify an on-call engineer when a CloudWatch alarm is triggered.