4.2 - PaulDuvall/aws-compliance-workshop GitHub Wiki

4.2 Describe CloudWatch Event Rules

About Amazon CloudWatch

"Amazon CloudWatch is a near real-time monitoring and logging service provided by AWS. You can use CloudWatch to detect anomalous behavior in your environments, set alarms, visualize logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your applications running smoothly." Source

About Amazon CloudWatch Events

"Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in Amazon Web Services (AWS) resources. Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams. CloudWatch Events becomes aware of operational changes as they occur. CloudWatch Events responds to these operational changes and takes corrective action as necessary, by sending messages to respond to the environment, activating functions, making changes, and capturing state information.

You can also use CloudWatch Events to schedule automated actions that self-trigger at certain times using cron or rate expressions. For more information, see Schedule Expressions for Rules." Source

You can also configure the many AWS services as targets for CloudWatch Events. These services include Amazon EC2, AWS Lambda functions, Amazon ECS tasks, Amazon SNS Topics, and any more. See CloudWatch Events Event Examples From Supported Services for examples.

Create an Amazon SNS Topic

  1. Go to Amazon Simple Notification Service (SNS) Console.
  2. Select Topics and then Create topic.
  3. Enter a Name and then click Create topic.
  4. Click Create subscription.
  5. Choose Email as the endpoint and click Create subscription.
  6. Confirm the subscription when you receive the email.

Create an Amazon CloudWatch Event Rule

  1. Go to Amazon CloudWatch.
  2. Select Rules under Event.
  3. Click Create rule.
  4. From Event Source, choose Event Pattern.
  5. Enter AWS Console Sign In for the Service Name.
  6. Enter Sign-In Events for the Event Type.
  7. This will generate the following command:
{
  "detail-type": [
    "AWS Console Sign In via CloudTrail"
  ]
}
  1. From the Targets section, click on Add target.
  2. Select SNS Topic for the Target.
  3. Choose the Topic you created from the SNS Console.
  4. Click Configure details.
  5. Enter a Name in the Configure rule details page.
  6. Click Create rule.

Test the CloudWatch Event Rule

  1. From a separate browser, login to the AWS Management Console.
  2. Check your email to confirm you received an SNS Notification.

Example CloudWatch Event Rule

CloudWatch Event Rules

Additional Resources