Logging DynamoDB operations by using Amazon CloudTrail - Amazon DynamoDB
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Logging DynamoDB operations by using Amazon CloudTrail

DynamoDB is integrated with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon service in DynamoDB. CloudTrail captures all API calls for DynamoDB as events. The calls captured include calls from the DynamoDB console and code calls to the DynamoDB API operations, using both PartiQL and the classic API. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for DynamoDB. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the information collected by CloudTrail, you can determine the request that was made to DynamoDB, the IP address from which the request was made, who made the request, when it was made, and additional details.

For robust monitoring and alerting, you can also integrate CloudTrail events with Amazon CloudWatch Logs. To enhance your analysis of DynamoDB service activity and identify changes in activities for an Amazon account, you can query Amazon CloudTrail logs using Amazon Athena. For example, you can use queries to identify trends and further isolate activity by attributes such as source IP address or user.

To learn more about CloudTrail, including how to configure and enable it, see the Amazon CloudTrail User Guide.

DynamoDB information in CloudTrail

CloudTrail is enabled on your Amazon account when you create the account. When supported event activity occurs in DynamoDB, that activity is recorded in a CloudTrail event along with other Amazon service events in Event history. You can view, search, and download recent events in your Amazon account. For more information, see Viewing events with CloudTrail event history.

For an ongoing record of events in your Amazon account, including events for DynamoDB, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all Amazon Regions. The trail logs events from all Regions in the Amazon partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other Amazon services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:

Control plane events in CloudTrail

The following API actions are logged by default as events in CloudTrail files:

Amazon DynamoDB

DynamoDB Streams

DynamoDB Accelerator (DAX)

DynamoDB data plane events in CloudTrail

To enable logging of the following API actions in CloudTrail files, you'll need to enable logging of data plane API activity in CloudTrail. See Logging data events for trails for more information.

Data plane events can be filtered by resource type, for granular control over which DynamoDB API calls you want to selectively log and pay for in CloudTrail. For example, by specifying Amazon::DynamoDB::Stream as a resource type, you can log only calls to the DynamoDB streams APIs. For tables with streams enabled, the resource field in the data plane event contains both Amazon::DynamoDB::Stream and Amazon::DynamoDB::Table. If you specify Amazon::DynamoDB::Table as a resource type, it will log both DynamoDB table and DynamoDB streams events by default. You can add an additional filter to exclude the streams events, if you don't want the streams events to be logged. For more information, see DataResource in the CloudTrail Amazon CloudTrail API reference.

Amazon DynamoDB

Note

DynamoDB Time to Live data plane actions are not logged by CloudTrail

DynamoDB Streams