In AWS, there is a possibility of setting up Dashboards, Metrics, and alarms using the CloudWatch Service. In this task, we would like to set up infrastructure in AWS using a CloudFormation script. The infrastructure that is to be created should follow these requirements.
- A simple EC2 instance that can be accessed and monitored by CloudWatch.
- A dashboard that can present statistics of at least these predefined metrics:
- CPU Utilization in %
- Check the status of the instance (StatusCheckFailed_System)
- Check the overall status of the System (StatusCheckFailed)
- Credit Usage of the EC2
- Optional: Alarm to monitor CPU utilization percentage reaching critical levels.
Proper security groups, security, load balancing, and other infrastructure are not part of this task. The focus is solely on the monitoring capabilities in CloudWatch using an EC2 as the main target to be monitored.
This repository contains a CloudFormation script (EnigioCloudWatchSetup.yaml
) to set up monitoring capabilities in AWS CloudWatch for an EC2 instance. The infrastructure created includes:
- An EC2 instance for monitoring.
- A CloudWatch alarm to monitor CPU utilization and send notifications if it exceeds 80%.
- A CloudWatch dashboard to visualize EC2 instance metrics, including CPU utilization, status check failures, and CPU credit balance.
Before deploying the CloudFormation stack, ensure you have:
- Installed the AWS CLI.
- Configured your AWS credentials using
aws configure
.
To deploy the CloudFormation stack, run the following command:
aws cloudformation create-stack --stack-name Enigio --template-body file://C:/Jena/Interview/Enigio/EnigioCloudWatchSetup.yaml
EnigioCloudWatchSetup.yaml
: CloudFormation script to set up the infrastructure.README.md
(this file): Instructions and overview of the solution.
- Type:
t2.micro
. - Monitoring enabled.
- Monitors CPU utilization.
- Alarm triggered if CPU utilization exceeds 80%.
- Notifications sent via Amazon SNS to the specified email address.
- Visualizes the following metrics:
- CPU Utilization (%)
- Status Check Failed (System)
- Status Check Failed
- CPU Credit Balance
After deployment, you can access the CloudWatch dashboard using the provided URL in the CloudFormation stack outputs.