This section summarizes basic concepts related to CloudTrail.
- What Are Trails?
- How Do You Manage CloudTrail?
- How Do You Control Access to CloudTrail?
- How Do You Log Management and Data Events?
- How Do You Perform Monitoring with CloudTrail?
- How Does CloudTrail Behave Regionally and Globally?
- About global service events
- How Does CloudTrail Relate to Other AWS Monitoring Services?
- Partner Solutions
What Are Trails?
A trail is a configuration that enables logging of the AWS API activity and related events in your account. CloudTrail delivers the logs to an Amazon S3 bucket that you specify, and optionally to a CloudWatch Logs log group. You can also specify an Amazon SNS topic that receives notifications of log file deliveries. For a trail that applies to all regions, the trail configuration in each region is identical.
How Do You Manage CloudTrail?
You can manage the CloudTrail service by using the AWS CloudTrail console web application. The console provides a user interface for performing many CloudTrail tasks such as turning on or editing CloudTrail, selecting an Amazon S3 bucket, setting a prefix, including or preventing API calls from global services such as IAM and AWS STS, and receiving Amazon SNS notifications for log file deliveries. For more information about the AWS management console in general, see AWS Management Console.
The AWS Command Line Interface is a unified tool that enables you to act easily with CloudTrail from the command line. For more information, see the AWS Command Line Interface User Guide. For a complete list of the available CloudTrail CLI commands, see Available Commands.
In addition to the console and the CLI, you can also use the CloudTrail RESTful APIs to program CloudTrail directly. For more information see the AWS CloudTrail API Reference.
As an alternative to using the CloudTrail API, you can use one of the AWS SDKs. Each SDK consists of libraries and sample code for various programming languages and platforms. The SDKs provide a convenient way to create programmatic access to CloudTrail. For example, the SDKs take care of cryptographically signing requests, managing errors, and retrying requests automatically. For more information, see the Tools For AWS page.
How Do You Control Access to CloudTrail?
AWS Identity and Access Management is a web service that enables Amazon Web Services (AWS) customers to manage users and user permissions. Without IAM, organizations with multiple users and systems must either create multiple AWS accounts, each with its own billing and subscriptions to AWS products, or employees must all share the security credentials of a single AWS account. Also, without IAM, you have no control over the tasks a particular user or system can do and what AWS resources they might use.
Use IAM to create individual users for anyone who needs access to AWS CloudTrail. Create an IAM user for yourself as well, give that IAM user administrative privileges, and use that IAM user for all your work. By creating individual IAM users for people accessing your account, you can give each IAM user a unique set of security credentials. You can also grant different permissions to each IAM user. If necessary, you can change or revoke an IAM user’s permissions any time. For more information, see Controlling User Permissions for CloudTrail.
How Do You Log Management and Data Events?
When you create a trail, your trail logs read-only and write-only management events
for your account. You can update your trail to specify whether you want your trail to
log data events. Data events are object-level API operations that access Amazon S3 object
resources, such as
PutObject. Only events that match your trail settings are delivered to your
Amazon S3 bucket and Amazon CloudWatch Logs log group. If the event doesn't match the settings for a
trail, the trail doesn't log the event. For more information, see Logging Data and Management
Events for Trails.
How Do You Perform Monitoring with CloudTrail?
CloudWatch Logs and CloudTrail
Amazon CloudWatch is a web service that collects and tracks metrics to monitor in real time your Amazon Web Services (AWS) resources and the applications that you run on AWS. Amazon CloudWatch Logs is a feature of CloudWatch that you can use specifically to monitor log data. Integration with CloudWatch Logs enables CloudTrail to send events containing API activity in your AWS account to a CloudWatch Logs log group. CloudTrail events that are sent to CloudWatch Logs can trigger alarms according to the metric filters you define. You can optionally configure CloudWatch alarms to send notifications or make changes to the resources that you are monitoring based on log stream events that your metric filters extract. Using CloudWatch Logs, you can also track CloudTrail events alongside events from the operating system, applications, or other AWS services that are sent to CloudWatch Logs. For more information, see Monitoring CloudTrail Log Files with Amazon CloudWatch Logs.
How Does CloudTrail Behave Regionally and Globally?
A trail can be applied to all regions or a single region. As a best practice, create a trail that applies to all regions in the AWS partition in which you are working. This is the default setting when you create a trail in the CloudTrail console.
'Turning on a trail' means that you create a trail and start logging. In the CloudTrail console, logging is turned on automatically when you create a trail.
What are the advantages of applying a trail to all regions?
A trail that applies to all regions has the following advantages:
The configuration settings for the trail apply consistently across all regions.
You receive log files from all regions in a single S3 bucket and optionally in a CloudWatch Logs log group.
You manage trail configuration for all regions from one location.
You immediately receive events from a new region. When a new region launches, CloudTrail automatically creates a trail for you in the new region with the same settings as your original trail.
You can create trails in regions that you don't use often to monitor for unusual activity.
What happens when you apply a trail to all regions?
When you apply a trail to all regions, CloudTrail uses the trail that you create in a particular region to create trails with identical configuration in all other regions in your account.
This has the following effects:
CloudTrail delivers log files for API activity from all regions to the single Amazon S3 bucket that you specify, and optionally to a CloudWatch Logs log group.
If you configured an Amazon SNS topic for the trail, SNS notifications about log file deliveries in all regions are sent to that single SNS topic.
Global service events will be delivered from a single region to your specified S3 bucket and to your CloudWatch Logs log group if you configured one for the trail. For information about global service events, see About global service events.
If you enabled log file integrity validation, log file integrity validation is enabled in all regions for the trail. For information about log file integrity validation, see Validating CloudTrail Log File Integrity.
Multiple trails per region
If you have different but related user groups such as developers, security personnel, and IT auditors, you can create multiple trails per region. This allows each group to receive its own copy of the log files.
CloudTrail supports five trails per region. A trail that applies to all regions counts as one trail in every region.
The following example is a region with 5 trails:
You create two trails in the (US West (N. California) Region) that apply only to this region.
You create two more trails in US West (N. California) Region that apply to all regions.
You create a trail in the (Asia Pacific (Sydney) Region) that applies to all regions. This trail also exists as a trail in the US West (N. California) Region.
You can see a list of your trails in all regions on the Trails page of the CloudTrail console. For more information, see Updating a Trail.
AWS Security Token Service (AWS STS) and CloudTrail
AWS STS is a service that has a global endpoint and that also supports
region-specific endpoints. An endpoint is a URL that is the entry point for web
service requests. For example,
https://cloudtrail.us-west-2.amazonaws.com is the
US West (Oregon) regional entry point for the AWS CloudTrail service. Regional endpoints
help reduce latency in your applications.
When you use an AWS STS region-specific endpoint, the trail in that region delivers
only the AWS STS events that occur in that region. For example, if you are using the
sts.us-west-2.amazonaws.com, the trail in us-west-2 delivers
only the AWS STS events that originate from us-west-2. For more information about
AWS STS regional endpoints, see Activating and
Deactivating AWS STS in an AWS Region in the
IAM User Guide.
For a complete list of AWS web service regional endpoints, see AWS Regions and Endpoints in the AWS General Reference. For details about events from the global AWS STS endpoint, see About global service events.
About global service events
For most services, events are sent to the region where the action happened. For global services such as IAM, AWS STS, and Amazon CloudFront, events are delivered to any trail that includes global services. AWS OpsWorks and Amazon Route 53 actions are logged in the US East (N. Virginia) Region.
To avoid receiving duplicate global service events, remember the following:
Global service events are delivered to trails that have the Apply trail to all regions option enabled. Events are delivered from a single region to the bucket for the trail.
If you have a single region trail, you should include global services.
If you have multiple single region trails, you should enable global services in only one of the trails.
You have a trail with the Apply trail to all regions option enabled. By default, this trail logs global service events.
You have multiple single region trails.
You do not need to include global services for the single region trails. Global service events are delivered for the first trail.
When you create or update a trail with the AWS CLI, AWS SDKs, or CloudTrail API, you can include or exclude global service events for trails.
How Does CloudTrail Relate to Other AWS Monitoring Services?
CloudTrail adds another dimension to the monitoring capabilities already offered by AWS; it does not change or replace logging features you might already be using such as those for Amazon S3 or Amazon CloudFront subscriptions. Amazon CloudWatch focuses on performance monitoring and system health; CloudTrail focuses on API activity. While CloudTrail does not report on system performance or health, you can use CloudTrail in conjunction with CloudWatch Logs alarms to notify you about activity that you might be interested in, as mentioned above.
AWS partners with third-party specialists in logging and analysis to provide solutions that leverage CloudTrail output. For more information, visit the CloudTrail detail page at AWS CloudTrail.