Amazon DynamoDB
Developer Guide (API Version 2012-08-10)

Logging DynamoDB Operations by Using AWS CloudTrail

DynamoDB is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS 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. 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.

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

DynamoDB Information in CloudTrail

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

For an ongoing record of events in your AWS 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 AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:

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

Amazon DynamoDB

DynamoDB Streams

DynamoDB Accelerator (DAX)

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials.

  • Whether the request was made with temporary security credentials for a role or federated user.

  • Whether the request was made by another AWS service.

For more information, see the CloudTrail userIdentity Element.

Understanding DynamoDB Log File Entries

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log that demostrates the CreateTable, DescribeTable, UpdateTable, ListTables, and DeleteTable actions.

{"Records": [ { "eventVersion": "1.03", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:bob", "arn": "arn:aws:sts::111122223333:assumed-role/users/bob", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2015-05-28T18:06:01Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::444455556666:role/admin-role", "accountId": "444455556666", "userName": "bob" } } }, "eventTime": "2015-05-01T07:24:55Z", "eventSource": "dynamodb.amazonaws.com", "eventName": "CreateTable", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.aws.amazon.com", "requestParameters": { "provisionedThroughput": { "writeCapacityUnits": 10, "readCapacityUnits": 10 }, "tableName": "Music", "keySchema": [ { "attributeName": "Artist", "keyType": "HASH" }, { "attributeName": "SongTitle", "keyType": "RANGE" } ], "attributeDefinitions": [ { "attributeType": "S", "attributeName": "Artist" }, { "attributeType": "S", "attributeName": "SongTitle" } ] }, "responseElements": {"tableDescription": { "tableName": "Music", "attributeDefinitions": [ { "attributeType": "S", "attributeName": "Artist" }, { "attributeType": "S", "attributeName": "SongTitle" } ], "itemCount": 0, "provisionedThroughput": { "writeCapacityUnits": 10, "numberOfDecreasesToday": 0, "readCapacityUnits": 10 }, "creationDateTime": "May 1, 2015 7:24:55 AM", "keySchema": [ { "attributeName": "Artist", "keyType": "HASH" }, { "attributeName": "SongTitle", "keyType": "RANGE" } ], "tableStatus": "CREATING", "tableSizeBytes": 0 }}, "requestID": "KAVGJR1Q0I5VHF8FS8V809EV7FVV4KQNSO5AEMVJF66Q9ASUAAJG", "eventID": "a8b5f864-480b-43bf-bc22-9b6d77910a29", "eventType": "AwsApiCall", "apiVersion": "2012-08-10", "recipientAccountId": "111122223333" }, { "eventVersion": "1.03", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:bob", "arn": "arn:aws:sts::111122223333:assumed-role/users/bob", "accountId": "444455556666", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2015-05-28T18:06:01Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::444455556666:role/admin-role", "accountId": "444455556666", "userName": "bob" } } }, "eventTime": "2015-05-04T02:43:11Z", "eventSource": "dynamodb.amazonaws.com", "eventName": "DescribeTable", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.aws.amazon.com", "requestParameters": {"tableName": "Music"}, "responseElements": null, "requestID": "DISTSH6DQRLCC74L48Q51LRBHFVV4KQNSO5AEMVJF66Q9ASUAAJG", "eventID": "c07befa7-f402-4770-8c1b-1911601ed2af", "eventType": "AwsApiCall", "apiVersion": "2012-08-10", "recipientAccountId": "111122223333" }, { "eventVersion": "1.03", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:bob", "arn": "arn:aws:sts::111122223333:assumed-role/users/bob", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2015-05-28T18:06:01Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::444455556666:role/admin-role", "accountId": "444455556666", "userName": "bob" } } }, "eventTime": "2015-05-04T02:14:52Z", "eventSource": "dynamodb.amazonaws.com", "eventName": "UpdateTable", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.aws.amazon.com", "requestParameters": {"provisionedThroughput": { "writeCapacityUnits": 25, "readCapacityUnits": 25 }}, "responseElements": {"tableDescription": { "tableName": "Music", "attributeDefinitions": [ { "attributeType": "S", "attributeName": "Artist" }, { "attributeType": "S", "attributeName": "SongTitle" } ], "itemCount": 0, "provisionedThroughput": { "writeCapacityUnits": 10, "numberOfDecreasesToday": 0, "readCapacityUnits": 10, "lastIncreaseDateTime": "May 3, 2015 11:34:14 PM" }, "creationDateTime": "May 3, 2015 11:34:14 PM", "keySchema": [ { "attributeName": "Artist", "keyType": "HASH" }, { "attributeName": "SongTitle", "keyType": "RANGE" } ], "tableStatus": "UPDATING", "tableSizeBytes": 0 }}, "requestID": "AALNP0J2L244N5O15PKISJ1KUFVV4KQNSO5AEMVJF66Q9ASUAAJG", "eventID": "eb834e01-f168-435f-92c0-c36278378b6e", "eventType": "AwsApiCall", "apiVersion": "2012-08-10", "recipientAccountId": "111122223333" }, { "eventVersion": "1.03", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:bob", "arn": "arn:aws:sts::111122223333:assumed-role/users/bob", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2015-05-28T18:06:01Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::444455556666:role/admin-role", "accountId": "444455556666", "userName": "bob" } } }, "eventTime": "2015-05-04T02:42:20Z", "eventSource": "dynamodb.amazonaws.com", "eventName": "ListTables", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.aws.amazon.com", "requestParameters": null, "responseElements": null, "requestID": "3BGHST5OVHLMTPUMAUTA1RF4M3VV4KQNSO5AEMVJF66Q9ASUAAJG", "eventID": "bd5bf4b0-b8a5-4bec-9edf-83605bd5e54e", "eventType": "AwsApiCall", "apiVersion": "2012-08-10", "recipientAccountId": "111122223333" }, { "eventVersion": "1.03", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:bob", "arn": "arn:aws:sts::111122223333:assumed-role/users/bob", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2015-05-28T18:06:01Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::444455556666:role/admin-role", "accountId": "444455556666", "userName": "bob" } } }, "eventTime": "2015-05-04T13:38:20Z", "eventSource": "dynamodb.amazonaws.com", "eventName": "DeleteTable", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.aws.amazon.com", "requestParameters": {"tableName": "Music"}, "responseElements": {"tableDescription": { "tableName": "Music", "itemCount": 0, "provisionedThroughput": { "writeCapacityUnits": 25, "numberOfDecreasesToday": 0, "readCapacityUnits": 25 }, "tableStatus": "DELETING", "tableSizeBytes": 0 }}, "requestID": "4KBNVRGD25RG1KEO9UT4V3FQDJVV4KQNSO5AEMVJF66Q9ASUAAJG", "eventID": "a954451c-c2fc-4561-8aea-7a30ba1fdf52", "eventType": "AwsApiCall", "apiVersion": "2012-08-10", "recipientAccountId": "111122223333" } ]}