Skip to content
EgyKode
03 · AWS by handLab 18 / 59
Guided labaws

EC2 Operations: SSM, CloudWatch Logs & Metrics

Operate an instance without SSH: run commands, ship logs, and alarm on something that matters.

Time
50 min
Level
Intermediate
Objectives
4 objectives
Cost
Low cost

Where this fits in the platform

This lab adds

  • An instance you can reach without opening SSH to the world

Which lets you

Before you start

You will need

  • AWS CLI v2, configured
  • An AWS account

You do not need these already — the lab environment below provides them.

You will be able to

  • Administer an instance with no inbound ports open
  • Ship application logs to CloudWatch and query them
  • Alarm on a symptom rather than on CPU

CostLow cost

— one `t3.micro`, and CloudWatch's free tier covers 5 GB of logs and 10 custom metrics. Leave the instance running and expect ~$8/month after the first year.

Nothing to pay in the browser. Open the terminal runs this against a simulated cloud — the same API calls and the same commands, with no account and no bill. The figure above applies only if you build it in your own.

How to clean up

The scenario#

An instance has port 22 open to the world, a key everyone shares, and logs that exist only on its disk — so when it is replaced, the evidence goes with it.

All three are avoidable, and the alternatives are free.

Hands-on environment

Run this lab in a real terminal, free and in your browser. The environment is temporary and yours alone — break it as much as you like.

Open the terminal

Opens in Killercoda, in a new tab — keep this page open for the steps.

Run it on AWS

This lab builds real cloud infrastructure, so it needs your own AWS account. Follow the cost and cleanup notes above — the resources are yours, and so is the bill.

Anything you tick here is your own record. EgyKode cannot see inside that terminal, so the success criteria stay self-assessed even when the environment checks your work for you.

An instance with no inbound ports

Step 1 of 4

Clean up#

Run this even if you did not finish.

DestructiveThis removes real resources. Check which environment you are in first.

Terminal
aws ec2 terminate-instances --instance-ids <id>
aws logs delete-log-group --log-group-name /egykode/lab/app
aws cloudwatch delete-alarms --alarm-names egykode-lab-errors
aws iam remove-role-from-instance-profile --instance-profile-name <p> --role-name <r>
aws iam delete-instance-profile --instance-profile-name <p>

Cost of this lab: Free tier — one t3.micro, and CloudWatch's free tier covers 5 GB of logs and 10 custom metrics. Leave the instance running and expect ~$8/month after the first year.

Success criteria

0 of 4

The concept behind it

Ready to try it without help?Do the challenge

Next up

Lab 18 of 59 on the project path

RDS PostgreSQL: Backups, Restore and FailoverTake a snapshot, destroy data on purpose, and restore it — then measure how long that actually took.55 minIntermediate

Previous: Production DNS & TLS with Route 53 and ACM