Overview
Lab details
- This lab walks you through the steps to create CloudWatch Dashboard for EC2
- Duration: 30 minutes
- AWS Region: US East (N. Virginia) us-east-1
Introduction
CloudWatch dashboard provides a customizable, centralized view of your EC2 instance metrics. It is a tool provided by Amazon Web Services (AWS) that allows you to visualize and track metrics and alarms for your EC2 instances. In this lab, we will create an EC2 instance and attach it to CloudWatch dashboard. We will then add widgets to visualize the metrics we want to monitor.Architecture diagram

Task details
- Sign in to AWS Management Console.
- Launch an EC2 instance.
- Create a CloudWatch dashboard.
- Create different widgets for the same metric to see the difference.
- Validation of the lab
Launching the lab environment
- To launch the lab environment, Click on the Launch lab button.
- Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
- Once the Lab is started, you will be provided with IAM user name, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time
Lab guide
Lab steps
Task 1: Sign in to AWS Management Console
- Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
- On the AWS sign-in page,
- Leave the Account ID as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
- Now copy your User Name and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign in button
- Once Signed In to the AWS Management Console, Make the default AWS Region as US East (N. Virginia) us-east-1.
Task 2: Launch an EC2 instance
- Make sure you are in the N.Virginia Region.
- Navigate to EC2 by clicking on the Services menu in the top, then click on EC2 in the Compute section.
- Navigate to Instances from the left side menu and click on Launch Instance.
- Enter Name as whizlabs.
- Choose an Amazon Machine Image (AMI): Select Amazon Linux 2023 AMI in the drop-down.
- Choose architecture as 64-bit(x86)

- Choose an Instance Type: Select t2.micro**.**

- For Key pair: Select Create a new key pair Button
- Key pair name: WhizKey
- Key pair type: RSA
- Private key file format: .pem
- Select Create key pair Button.

- In Network Settings Click on Edit Button:
- Auto-assign public IP: Enable
- Select Create new Security group
- Security group name : Enter MyEC2Server_SG
- Description : Enter Security Group to allow traffic to EC2

- Check Allow SSH from and Select Anywhere from dropdown
-
To add SSH,
- Choose Type: SSH.
- Source: Select Anywhere.
- Leave the rest of the things as default.
- Click on the Launch Instance.
- Launch Status: Your instance is now launching. Click on the instance ID and wait for complete initialization of instance (until the status changes to Running).

- Note the Public IPv4 Address and Instance ID of the EC2 instance. A sample is shown in the screenshot below.

Task 3: Creating a CloudWatch Dashboard
- Wait for 5-10 minutes for CloudWatch to gather metrics from EC2 Instance.
- Navigate to CloudWatch by clicking on the Services menu at the top of the page, then click on CloudWatch in the Management and Governance section.
- Click on Dashboards on the left panel.
- Click on Create Dashboard.
- Give a name to your dashboard.
- Dashboard name: Enter MyEC2
- Click on Create dashboard button.

- We have to select a widget type to configure and add to this dashboard. Leave it as the default line chosen.
- Click on the Next button.

- Under Add metric graph in the Browse tab, scroll down to EC2 and click on EC2.


- Under EC2, choose Per-Instance Metrics.
- Paste the copied Instance id in the search bar and select the CPUUtilization from the metrics and click on Create Widget button.

If you don’t see the CPUUtilization metrics, wait for 5 minutes.
- Click Create Widget.

- Refresh CPUUtilization.

- You have successfully created a Line widget for CPUUtilization.

Task 4: Creating different Widgets for same Metric
Stacked Area
- In the dashboard click on MyEC2.
- Click on the + button to Add widget and select Stacked area. Click on Next.
- You will see a metric graph. Under All metrics, search and choose EC2 (since we are going to watch the metrics of EC2 which we have created earlier).
- Under EC2, choose Per-Instance Metrics.
- Search by pasting the copied Instance id and select the CPUUtilization from the metrics and click on Create Widget button.
- You have successfully created a Stacked Area widget for CPU Utilization.

Number
- In the dashboard click on MyEC2.
- Click on + button to Add widget and select Number. Click on Next.
- You can see a metric graph. Under All metrics, search and choose **EC2 (**since we are going to watch the metrics of EC2 which we have created earlier).
- Under EC2, choose Per-Instance Metrics.
- Search by pasting the copied Instance id and select the CPUUtilization from the metrics and click on Create Widget button.
-
You have successfully created a Number widget for CPU Utilization.

- Click on Save Dashboard to save the widgets.
- Refresh the page, until the metric value is shown.
- Using these steps, you can use the widgets to create your own dashboard for metrics.
The actual metric generated depends on the CPUUtilization.

Task 5 : Validation of the Lab
- Once the lab steps are completed, please click on the Check my work button on the left side panel.
- This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
-
Sample output :

Completion and conclusion
- You have successfully launched an EC2 Instance.
- You have created a CloudWatch dashboard.
- You have successfully created different widgets for the same metric.
End lab
- Sign out of the AWS Account.
- You have successfully completed the lab.
- Once you have completed the steps, click on End lab in the IP Lab Portal.
What gets checked
When you press Check my work, the platform verifies each of these:- Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.
- create a cloudwatch dashboard — check whether the Cloudwatch dashboard is created or not