Monitor Amazon CloudWatch Security Logs for failed SSH attempts

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Confirming CloudWatch Agent Setup, CloudWatch Log Group and Log Stream creation
lock
Creating an SNS Topic for SSH failures
lock
Creating a Subscription and subscribing to the SSH failure Topic
lock
Creating an Alarm for SSH failures

The hands-on lab is part of these learning paths

SysOps Administrator – Associate Certification Preparation for AWS
course-steps
32
certification
5
lab-steps
30
quiz-steps
4
description
5
Security - Specialty Certification Preparation for AWS
course-steps
23
certification
2
lab-steps
12
quiz-steps
4

Ready for the real environment experience?

DifficultyBeginner
Time Limit1h 30m
Students2068
Ratings
4.7/5
starstarstarstarstar-half

Description

Clearly security is a huge issue for the technical sector, and public cloud is no exception to that. If you Google "top cloud security concerns" one of the top articles is from Information Week titled 9 Worst Cloud Security Threats. The section on Account or Service Traffic Hijacking states:

An intruder with control over a user account can eavesdrop on transactions, manipulate data, provide false and business-damaging responses to customers, and redirect customers to a competitor's site or inappropriate sites.

This lab is germane to the quote above. In this lab you will configure an EC2 instance to use the CloudWatch agent so it can deliver the security log file to Amazon CloudWatch. A CloudWatch Log Group and Log Stream will be automatically created for you. By monitoring the security log file for a specific type of potential breach (based on a pattern), CloudWatch will proactively send an email notification to your email. You will also configure Amazon Simple Notification Service (SNS) as the communication channel for the notification.

Although this lab focuses on failed SSH attempts, there is a broader application that should be recognized, including how CloudWatch can be utilized in many different ways for many different logs or infrastructure metrics. 

Lab Objectives

Upon completion of this lab you will be able to:

  • Configure an EC2 instance to use the CloudWatch log agent
  • Verify the log agent status
  • Locate a few key security related log files and view them on the EC2 instance
  • Create an Simple Notification Service (SNS) topic
  • Subscribe to an SNS topic
  • Use CloudWatch to monitor a log stream for a specific pattern (invalid SSH users) and send a notification via SNS

Lab Prerequisites

You should be familiar with:

  • Basic security, log file and SSH concepts
  • Using the Linux command line is not required by helpful

Lab Environment

Before completing the lab instructions the environment will look as follows:

  • An EC2 instance with the CloudWatch Log Agent configured and running 
  • A custom IAM Role with a Policy that allows the EC2 instance to communicate with Amazon CloudWatch

After completing the lab instructions the environment should look similar to:

 

Updates

July 29th, 2020 - Updated lab instructions for more consistent formatting and resolved an issue causing the lag agent to fail to start

July 18th, 2019 - Improved the validation Lab Step to further check the work you perform in the Lab

January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab

About the Author
Students70524
Labs119
Courses11
Learning paths15

Logan has been involved in software development and research since 2007 and has been in the cloud since 2012. He is an AWS Certified DevOps Engineer - Professional, AWS Certified Solutions Architect - Professional, Microsoft Certified Azure Solutions Architect Expert, MCSE: Cloud Platform and Infrastructure, Google Cloud Certified Associate Cloud Engineer, Certified Kubernetes Administrator (CKA), Certified Kubernetes Application Developer (CKAD), Linux Foundation Certified System Administrator (LFCS), and Certified OpenStack Administrator (COA). He earned his Ph.D. studying design automation and enjoys all things tech.