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:
- Create a CloudWatch billing alarm which goes off when the estimated charges go above $500.
- 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:
-
Opened the CloudWatch console.
-
In the navigation pane, clicked on
Alarms
and thenCreate Alarm
. -
In the
Create Alarm
screen, clicked onSelect metric
. -
Chose the
Billing
namespace. -
Chose
Total Estimated Charge
, then selectEstimatedCharges
. -
Defined the conditions. Set
Threshold type
toStatic
and whenever the metric is…Greater
than…$500
. -
Selected
In alarm
configured action to send a notification. Chose to create a new SNS topicdemoSNS
-
Added an email address to receive the notification.
-
Named the alarm
$500_alarm
-
Click
Create Alarm
.
2. EC2 CPU Utilization Alarm:
-
Opened the CloudWatch console.
-
In the navigation pane, clicked on
Alarms
and then clickedCreate Alarm
. -
In the
Create Alarm
screen, clicked onSelect metric
. -
Chose the
EC2
namespace and thenPer-Instance Metrics
. -
Chose
CPUUtilization
for my EC2 instanceInstance2
, then clickedselect metric
. -
Defined the conditions. Set
Threshold type
toStatic
and whenever the metric is…Greater
than…65
. -
Configure actions. For ALARM state, chose to send a notification. Select an existing SNS topic
demoSNS
. -
Added the email address to receive the notification.
-
Named the alarm
CPU_Over60
-
Clicked
Create alarm
.
Now we can see the 2 newly created alarms
Testing and Verification:
-
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. -
I keenly observed and waited for the email notification, confirming that the setup was functioning as expected.