Module 3: CloudWatch Alarms Assignment

Problem Statement: You work for XYZ Corporation. To maintain the security of the AWS account and the resources you have been asked to implement a solution that can help easily recognize and monitor the different users. Also, you will be monitoring the machines created by these users for any errors or misconfigurations.

Tasks To Be Performed:

  1. Create a CloudWatch billing alarm which goes off when the estimated charges go above $500.
  2. Create a CloudWatch alarm which goes off to an Alarm state when the CPU utilization of an EC2 instance goes above 65%. Also add an SNS topic so that it notifies the person when the threshold is crossed.

1. CloudWatch Billing Alarm:

Steps:

  1. Opened the CloudWatch console.

  2. In the navigation pane, clicked on Alarms and then Create Alarm.

  3. In the Create Alarm screen, clicked on Select metric.

  4. Chose the Billing namespace.

  5. Chose Total Estimated Charge, then select EstimatedCharges.

  6. Defined the conditions. Set Threshold type to Static and whenever the metric is… Greater than… $500.

  7. Selected In alarm configured action to send a notification. Chose to create a new SNS topic demoSNS

  8. Added an email address to receive the notification.

  9. Named the alarm $500_alarm

  10. Click Create Alarm.


2. EC2 CPU Utilization Alarm:

  1. Opened the CloudWatch console.

  2. In the navigation pane, clicked on Alarms and then clicked Create Alarm.

  3. In the Create Alarm screen, clicked on Select metric.

  4. Chose the EC2 namespace and then Per-Instance Metrics.

  5. Chose CPUUtilization for my EC2 instance Instance2, then clicked select metric.

  6. Defined the conditions. Set Threshold type to Static and whenever the metric is… Greater than… 65.

  7. Configure actions. For ALARM state, chose to send a notification. Select an existing SNS topic demoSNS.

  8. Added the email address to receive the notification.

  9. Named the alarm CPU_Over60

  10. Clicked Create alarm.

Now we can see the 2 newly created alarms


Testing and Verification:

  1. To verify the CPU utilization alarm, I SSHed into our EC2 instance and ran while true; do openssl dgst -sha256 /dev/zero; done & to artificially spike the CPU usage and trigger the alarm.

  2. I keenly observed and waited for the email notification, confirming that the setup was functioning as expected.