Logging AWS Clean Rooms API calls using AWS CloudTrail - AWS Clean Rooms

Logging AWS Clean Rooms API calls using AWS CloudTrail

AWS Clean Rooms is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS Clean Rooms. CloudTrail captures all API calls for AWS Clean Rooms as events. The calls captured include calls from the AWS Clean Rooms console and code calls to the AWS Clean Rooms API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS Clean Rooms. 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 AWS Clean Rooms, 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, see the AWS CloudTrail User Guide.

AWS Clean Rooms information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in AWS Clean Rooms, 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 AWS Clean Rooms, 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:

All AWS Clean Rooms actions are logged by CloudTrail and are documented in the AWS Clean Rooms API Reference.

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 user or 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 AWS Clean Rooms 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.

Example AWS Clean Rooms CloudTrail events

The following examples demonstrate CloudTrail events for:

StartProtectedQuery (successful)

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::123456789012:assumed-role/query-runner/jdoe", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/query-runner", "accountId": "123456789012", "userName": "query-runner" }, "webIdFederationData": {}, "attributes": { "creationDate": "2023-04-07T19:34:32Z", "mfaAuthenticated": "false" } } }, "eventTime": "2023-04-07T19:53:32Z", "eventSource": "cleanrooms.amazonaws.com", "eventName": "StartProtectedQuery", "awsRegion": "us-east-2", "sourceIPAddress": "203.0.113.1", "userAgent": "aws-internal/3", "requestParameters": { "resultConfiguration": { "outputConfiguration": { "s3": { "resultFormat": "CSV", "bucket": "cleanrooms-queryresults-jdoe-test", "keyPrefix": "test" } } }, "sqlParameters": "***", "membershipIdentifier": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "type": "SQL" }, "responseElements": { "Access-Control-Expose-Headers": "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date", "protectedQuery": { "createTime": 1680897212.279, "id": "f5988bf1-771a-4141-82a8-26fcc4e41c9f", "membershipArn": "arn:aws:cleanrooms:us-east-2:123456789012:membership/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "membershipId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "resultConfiguration": { "outputConfiguration": { "s3": { "bucket": "cleanrooms-queryresults-jdoe-test", "keyPrefix": "test", "resultFormat": "CSV" } } }, "sqlParameters": "***", "status": "SUBMITTED" } }, "requestID": "7464211b-2277-4b55-9723-fb4f259aefd2", "eventID": "f7610f5e-74b9-420f-ae43-206571ebcbf7", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

StartProtectedQuery (failed)

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:sts::123456789012:assumed-role/query-runner/jdoe", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EXAMPLE_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/query-runner", "accountId": "123456789012", "userName": "query-runner" }, "webIdFederationData": {}, "attributes": { "creationDate": "2023-04-07T19:34:32Z", "mfaAuthenticated": "false" } } }, "eventTime": "2023-04-07T19:47:27Z", "eventSource": "cleanrooms.amazonaws.com", "eventName": "StartProtectedQuery", "awsRegion": "us-east-2", "sourceIPAddress": "203.0.113.1", "userAgent": "aws-internal/3", "errorCode": "ValidationException", "requestParameters": { "resultConfiguration": { "outputConfiguration": { "s3": { "resultFormat": "CSV", "bucket": "cleanrooms-queryresults-jdoe-test", "keyPrefix": "test" } } }, "sqlParameters": "***", "membershipIdentifier": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "type": "SQL" }, "responseElements": { "Access-Control-Expose-Headers": "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date", "message": "Column(s) [identifier] is not allowed in select" }, "requestID": "e29f9f74-8299-4a83-9d18-5ddce7302f07", "eventID": "c8ee3498-8e4e-44b5-87e4-ab9477e56eb5", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }