← Cloud Practitioner study path

Security and compliance · 11 min

AWS CloudTrail, Amazon CloudWatch and AWS Config

In this lesson you will learn to tell AWS CloudTrail, Amazon CloudWatch and AWS Config apart by the question each one answers, and what IAM access reports are for.

AWS CloudTrail, Amazon CloudWatch and AWS Config are three services that store information about what happens in your AWS account, and that is why they are easily confused. The way to tell them apart is the question each one answers: CloudTrail tells you who did what, CloudWatch tells you how a resource is performing and Config tells you how it was configured. For example, if an online store's website fails on a Monday, CloudTrail tells you who changed something that day, CloudWatch tells you since what time the site has been slow and Config tells you how the server's settings were before and after.

Three cards: AWS CloudTrail answers who did what, Amazon CloudWatch how it is performing and AWS Config how it was configured

To choose between the three in an exam question, find what the question wants to know: who did something, how a resource is performing or how it was configured. That tells you which of the three services is the answer.

AWS CloudTrail

AWS CloudTrail records as an event every action that a user, a role or an AWS service takes in your account. Each event stores who it was, when, from where and what they did, and CloudTrail records both the actions taken in the console and the ones taken with the , the SDKs, which are packages of code that let a program use AWS, and the . Without CloudTrail, when something changes in your account you would have no way of knowing who changed it.

CloudTrail stores events in three ways.

The three ways AWS CloudTrail stores events: event history, trails and CloudTrail Lake

Each way stores events for a different length of time and in a different place:

  • Event history, which is on from the moment you create the account and stores the last 90 days of management events per Region, at no cost to view it. Management events are the actions used to manage the account's resources, such as creating, starting or deleting a server.
  • Trails, which continuously copy events to an Amazon S3 bucket to keep them longer.
  • CloudTrail Lake, which is a managed where you store events and query them.

For example, if someone deleted the store's orders database on Tuesday, the case is investigated in CloudTrail. Deleting a database is an API call, and the event stores which user made it, at what time and from what address.

True or false?

0 of 3
  1. To see who did something yesterday in your account, you first have to turn on CloudTrail.

  2. To keep events for more than 90 days you create a trail that copies them to an S3 bucket.

  3. Viewing CloudTrail event history has a cost.

Amazon CloudWatch

Amazon CloudWatch is the AWS monitoring service, that is, the one that watches how your resources are performing. It does this with metrics, which are numbers measured at regular intervals, such as usage, requests or errors. Many AWS services send it metrics on their own, and you can also send it your own. Besides metrics, CloudWatch has these tools:

  • Alarms, which alert you or trigger an action, such as adding servers, when a metric crosses a threshold.
  • Dashboards, which show metrics and logs on a single screen.
  • CloudWatch Logs, which collects the from your applications, from EC2 and from other services so you can search for errors, and to which CloudTrail can also send its events.

For example, if the store's site has been slow for an hour, the case is investigated in CloudWatch. The or CPU metric tells you since when it has been happening and how much it went up, and an alarm would have alerted you as soon as it started.

AWS Config

AWS Config stores the configuration of your resources, which is their settings, every change they go through and how they relate to each other. With that history you can see, for example, how a security group, which is the list of rules for who can connect to a server, was set up three weeks ago. To work, Config needs an S3 bucket where it stores the configuration snapshots and the history.

Config rules describe how your resources should be, for example "no unencrypted ", and Config marks the resources that don't follow them as noncompliant. For example, if a security group at the store that used to allow traffic only from the office now accepts the whole internet, in Config you see which rule of the group changed, when it changed and whether the group no longer follows your Config rule.

Which service answers the question?

0 of 6

Tap the correct column for each question.

  1. Who deleted the database on Tuesday?

  2. Since when has the instance's CPU been this high?

  3. How was this security group configured three weeks ago?

  4. Alert me when the application's errors go over a threshold

  5. Which EBS volumes don't follow the rule of being encrypted?

  6. Which role made an API call from the CLI at 4 p.m.?

CloudTrail or Config?

CloudTrail and Config are both used for auditing, that is, for reviewing afterward what happened in the account, and they are often used together, because each one tells you something different about the same change. For example, in the case of the store's security group that was left open, Config tells you how the resource ended up and CloudTrail tells you who made the change:

AWS CloudTrail AWS Config
Who made the change? How did the resource end up?
Records API calls Records configurations
Action, user and time History and compliance rules

IAM access reports

The exam guide also mentions IAM access reports, which show how the account's credentials and permissions are used. The credential report is a file with all the IAM users in the account and the status of their passwords, access keys and MFA. It can be generated once every four hours, and it is the document you hand to an who asks to review those credentials. For example, if the store's auditor wants to know which employees still haven't turned on MFA, the credential report shows it in a single table.

Last accessed information is the other report. It tells you when each identity used each service, and it is used to remove permissions that aren't needed. For example, if a store employee has permission to use the database but has never used it, you can remove that permission without changing their work.

What do you hand over?

Your auditor asks for a file with all the IAM users in the account and the status of their passwords, access keys and MFA. What do you hand over?

Accounts with the new experience

AWS CloudTrail, Amazon CloudWatch and AWS Config are available from the free plan of the new experience. In shared projects, CloudTrail also records which person on the team took each action, in the onBehalfOf field. Keep in mind that Config and trails store data in S3, and that can generate charges. For example, if you invite a classmate to your practice project and she deletes a bucket, the CloudTrail event says in onBehalfOf that it was her.

On the exam

Questions on this topic describe something that has to be investigated or monitored and ask you to choose the service. For example, if the question asks which user shut down a server last night, the answer is CloudTrail, because it asks who did something. These words in the question point to the answer:

Words in the question Answer
Who, which user, API calls, auditing account activity AWS CloudTrail
Metrics, CPU usage, alarm, application logs Amazon CloudWatch
Configuration history, noncompliant resources, compliant AWS Config
Status of the passwords, keys and MFA of all users IAM credential report

Review question

A company wants to receive an alert when the CPU usage of its Amazon EC2 instances goes over 80% for 10 minutes. Which service does it use?

Next