Logging API Calls for the EBS direct APIs with AWS CloudTrail - Amazon Elastic Compute Cloud

Logging API Calls for the EBS direct APIs with AWS CloudTrail

The EBS direct APIs service is integrated with AWS CloudTrail. CloudTrail is a service that provides a record of actions taken by a user, role, or an AWS service in the EBS direct APIs. CloudTrail captures StartSnapshot and CompleteSnapshot API calls for the EBS direct APIs as events. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon Simple Storage Service (Amazon S3) bucket, including events for the EBS direct APIs. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. You can use the information collected by CloudTrail to determine the request that was made to the EBS direct APIs, the IP address from which the request was made, who made the request, when it was made, and additional details.

For more information about CloudTrail, see the AWS CloudTrail User Guide.

EBS direct APIs Information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When supported event activity occurs in the EBS direct APIs, 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 the EBS direct APIs, create a trail. A trail enables CloudTrail to deliver log files to an 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 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:

Supported API actions

The following API actions support logging as events in CloudTrail log files:

Identity information

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 userIdentityElement.

Understanding EBS direct APIs Log File Entries

A trail is a configuration that enables delivery of events as log files to an 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 examples show CloudTrail log entries that demonstrates the StartSnapshot and CompleteSnapshot actions.

StartSnapshot example:

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2020-07-03T23:27:26Z", "eventSource": "ebs.amazonaws.com", "eventName": "StartSnapshot", "awsRegion": "eu-west-1", "sourceIPAddress": "192.0.2.0", "userAgent": "PostmanRuntime/7.25.0", "requestParameters": { "volumeSize": 8, "clientToken": "token", "encrypted": true }, "responseElements": { "snapshotId": "snap-123456789012", "ownerId": "123456789012", "status": "pending", "startTime": "Jul 3, 2020 11:27:26 PM", "volumeSize": 8, "blockSize": 524288, "kmsKeyArn": "HIDDEN_DUE_TO_SECURITY_REASONS" }, "requestID": "be112233-1ba5-4ae0-8e2b-1c302EXAMPLE", "eventID": "6e12345-2a4e-417c-aa78-7594fEXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }

CompleteSnapshot example:

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2020-07-03T23:28:24Z", "eventSource": "ebs.amazonaws.com", "eventName": "CompleteSnapshot", "awsRegion": "eu-west-1", "sourceIPAddress": "192.0.2.0", "userAgent": "PostmanRuntime/7.25.0", "requestParameters": { "snapshotId": "snap-123456789012", "changedBlocksCount": 5 }, "responseElements": { "status": "completed" }, "requestID": "be112233-1ba5-4ae0-8e2b-1c302EXAMPLE", "eventID": "6e12345-2a4e-417c-aa78-7594fEXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }