Introduction
Use real website requests and CloudWatch logs to distinguish one missing page from a website that is no longer available.
Complete the earlier portfolio labs first. This fresh environment supplies its own working website and request-log integration. You will generate and inspect requests, without installing a logging agent or reusing earlier resources or credentials.
Certification Relevance
| Certification | Exam task | Practice |
|---|---|---|
| AWS Certified Cloud Practitioner (CLF-C02) | Task 3.8 | Use CloudWatch Logs to understand application request results. |
Lab Overview

Find a Successful Website Request
In this step, you will open the portfolio and find the resulting successful request event.
Open your portfolio from AWS View. Confirm Alex Morgan and the three project covers appear. Opening the page sends a real request to the website on EC2.
A log event records something that happened at a particular time. CloudWatch Logs organizes events in a log group; log streams can separate application instances. This lab prepares one group and an instance-specific stream. It records path, status and request ID, without credentials or headers.
Load this lab’s log-group name in Terminal:
cd /home/labex/project
source website.env
echo "$LOG_GROUP"
filter-log-events reads collected events from this group. --query shows only their message values, so you can focus on paths, statuses and request IDs instead of the surrounding metadata:
aws logs filter-log-events \
--log-group-name "$LOG_GROUP" \
--query 'events[].message'
Find path=/website status=200 in a message. HTTP 200 means that request succeeded. The request_id identifies that particular request; your values will differ.
Images, CSS and the project list create separate requests, so more events are normal. AWS View groups recent events in one CloudWatch card; it is a short recent view, while the CLI reads the group. The check confirms collection of a real successful request; interpreting its fields is your task.
Diagnose a Missing Page
In this step, you will find a missing-page event and confirm that the main portfolio still works.
In AWS View, click Open a missing page. The new tab requests /missing, which the supplied website does not serve. Expect Page not found.
HTTP 404 means that requested path was not found. It does not mean EC2 stopped or every path is unavailable. --filter-pattern selects matching messages; the outer single quotes preserve the inner double quotes around the exact phrase status=404:
aws logs filter-log-events \
--log-group-name "$LOG_GROUP" \
--filter-pattern '"status=404"' \
--query 'events[].message'
Confirm path=/missing status=404 in the returned message, matching the page you just opened. Return to the portfolio tab, refresh and confirm Alex Morgan and the covers still load. Read the group again:
aws logs filter-log-events \
--log-group-name "$LOG_GROUP" \
--query 'events[].message'
Now compare the missing-path event with successful main-page events. The server serves the portfolio, but /missing is not a valid route. Restarting it would not create that missing route. An empty filtered result alone does not prove success: check this lab’s link, group name and completed request, then repeat the read.
The AWS View card shows recent requests. After extra refreshes, a 404 may leave that recent view; the 404 filter above can still find its event in the log group’s history.

Summary
You generated real requests, matched paths with HTTP 200 and 404 events and confirmed the main website remains available. A missing route calls for checking the route, rather than assuming the server stopped. The next lab uses a fresh prepared site to detect and recover from actual website errors.
Official references: CloudWatch Logs concepts and filter pattern syntax.



