Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Standing Up an Apache Web Server EC2 Instance and Sending Logs to Amazon CloudWatch

During this hands-on lab project you are going to work on configuring an Amazon EC2 instance to push some custom log files to Amazon CloudWatch using the CloudWatch agent. Once the log files are correctly configured to be sent to Amazon CloudWatch, you will then implement a simple alerting system to catch some specific warnings and error messages using Metric Filters and Amazon SNS notifications.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 25, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Install and Configure the Amazon CloudWatch Agent

    Connect to the ApacheWebServer EC2 instance using Session Manager.

    Once connected, use the commands listed in the lab GitHub repo to install the Amazon CloudWatch agent and create the agent configuration file.

    Copy and paste the JSON configuration code into the new file then start the agent with the new config file using the command listed on GitHub.

  2. Challenge

    Create a Metric Filter for 404 Status Codes

    Within the Amazon CloudWatch Apache-Access-Logs Log Group, create a new metric filter looking for 404 status codes within the log entries.

    For the Filter pattern enter the following text to create a metric filter that matches for any 404 status codes.

        %\b404\b%
    

    Metric Filter Settings:

    • Filter Name: 404
    • Metric namespace: Apache
    • Metric name: 404
    • Metric value: 1
    • Default value: blank
    • Unit: Count

    For testing, open the public IP of the ApacheWebServer instance in your browser, change the URL to http and append a fake page on the end (Example: http://YOUR_PUBLIC_IP/fake.html).

  3. Challenge

    Create SNS Topic and CloudWatch Alarm

    Now, we can put it all together and set up a new CloudWatch Alarm to send a message through Amazon SNS to notify us whenever a 404 is detected in our Log Group.

    Create a new alarm via the CloudWatch Alarms dashboard for the newly created Apache namespace.

    Hint: There is a shortcut from within the graphed metric section.

    Alarm Metric Settings:

    • Metric namespace: Apache
    • Metric name: 404
    • Statistic: Sum

    Alarm Conditions Settings:

    • Threshold type: Static
    • Whenever 404 is...: Greater/Equal
    • than: 0
    • Alarm state trigger: In alarm
    • Alarm name: 404-Detections

    Then, create a new SNS topic named 404-Alerts and confirm subscription to it. Refresh the fake ApacheWebServer page to generate 404 errors and test the alarm.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight