Logging AWS Resource Explorer API calls using AWS CloudTrail - AWS Resource Explorer

Logging AWS Resource Explorer API calls using AWS CloudTrail

AWS Resource Explorer is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Resource Explorer. CloudTrail captures all API calls for Resource Explorer as events. The calls captured include calls from the Resource Explorer console and code calls to the Resource Explorer API operations.

If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Resource Explorer. A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. 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 Resource Explorer, 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.

Resource Explorer information in CloudTrail

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

Important

You can find all Resource Explorer events by searching for Event source = resource-explorer-2.amazonaws.com

For an ongoing record of events in your AWS account, including events for Resource Explorer, 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 topics in the AWS CloudTrail User Guide:

All Resource Explorer actions are logged by CloudTrail and are documented in the AWS Resource Explorer API Reference. For example, calls to the CreateIndex, DeleteIndex, and UpdateIndex actions generate entries in the CloudTrail log files.

Every event or log entry contains information that helps you determine who made the request.

  • AWS account root credentials

  • Temporary security credentials from an AWS Identity and Access Management (IAM) role or federated user.

  • Long-term security credentials from an IAM user.

  • Another AWS service.

Important

For security reasons, all Tags, Filters, and QueryString values are redacted from the CloudTrail trail entries.

For more information, see the CloudTrail userIdentity element.

Understanding Resource Explorer 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.

CreateIndex

The following example shows a CloudTrail log entry that demonstrates the CreateIndex action.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:botocore-session-166EXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/cli-role/botocore-session-166EXAMPLE", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/cli-role", "accountId": "123456789012", "userName": "cli-role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T19:13:59Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-08-23T19:13:59Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "CreateIndex", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.create-index", "requestParameters": { "ClientToken": "792ee665-58af-423c-bfdb-d7c9aEXAMPLE" }, "responseElements": { "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111", "State": "CREATING", "CreatedAt": "2022-08-23T19:13:59.775Z" }, "requestID": "a193afe9-17ff-4f30-ae0a-73bb0EXAMPLE", "eventID": "2ec50598-4de6-474d-bd0e-f5c00EXAMPLE", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

DeleteIndex

The following example shows a CloudTrail long entry that demonstrates the DeleteIndex action.

Note

This action also asynchronously deletes all views for the account in that Region, which results in a DeleteView event for each deleted view.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:My-Role-Name", "arn": "arn:aws:sts::123456789012:assumed-role/My-Admin-Role/My-Delegated-Role", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/My-Admin-Role", "accountId": "123456789012", "userName": "My-Admin-Role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T18:33:06Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-08-23T19:04:06Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "DeleteIndex", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.delete-index", "requestParameters": { "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111" }, "responseElements": { "Access-Control-Expose-Headers": "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date", "State": "DELETING", "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111" }, "requestID": "d7d80bd2-cd2d-47fb-88d6-5133aEXAMPLE", "eventID": "675eab39-c514-4d32-989d-0ea98EXAMPLE", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

UpdateIndexType

The following example shows a CloudTrail log entry that demonstrates the UpdateIndexType action to promote an index from type LOCAL to AGGREGATOR.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:botocore-session-1661282039", "arn": "arn:aws:sts::123456789012:assumed-role/cli-role/botocore-session-1661282039", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/cli-role", "accountId": "123456789012", "userName": "cli-role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T19:13:59Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-08-23T19:21:18Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "UpdateIndexType", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.update-index-type", "requestParameters": { "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111", "Type": "AGGREGATOR" }, "responseElements": { "Type": "AGGREGATOR", "Arn": "arn:aws:resource-explorer-2:us-east-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111", "LastUpdatedAt": "2022-08-23T19:21:17.924Z", "State": "UPDATING" }, "requestID": "a145309d-df14-4c2e-a9f6-8ed45EXAMPLE", "eventID": "ed33ab96-f5c6-4a77-a69a-8585aEXAMPLE", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

The following example shows a CloudTrail log entry that demonstrates the Search action.

Note

For security reasons, all references to Tag, Filters, and QueryString parameters are redacted in the CloudTrail trail entries.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:botocore-session-1661282039", "arn": "arn:aws:sts::123456789012:assumed-role/cli-role/botocore-session-1661282039", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/cli-role", "accountId": "123456789012", "userName": "cli-role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T19:13:59Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-08-03T16:50:11Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "Search", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.search", "requestParameters": { "QueryString": "***" }, "responseElements": null, "requestID": "22320db5-b194-446f-b9f4-e603bEXAMPLE", "eventID": "addb3bca-0c41-46bf-a5e6-42299EXAMPLE", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

CreateView

The following example shows a CloudTrail log entry that demonstrates the CreateView action.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:botocore-session-1661282039", "arn": "arn:aws:sts::123456789012:assumed-role/cli-role/botocore-session-1661282039", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/cli-role", "accountId": "123456789012", "userName": "cli-role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T19:13:59Z", "mfaAuthenticated": "false" } } }, "eventTime": "2023-01-20T21:54:48Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "CreateView", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.create-view", "requestParameters": { "ViewName": "CTTagsTest", "Tags": "***" }, "responseElements": { "View": { "Filters": "***", "IncludedProperties": [], "LastUpdatedAt": "2023-01-20T21:54:48.079Z", "Owner": "123456789012", "Scope": "arn:aws:iam::123456789012:root", "ViewArn": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/CTTest/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111" } }, "requestID": "b22d8ced-4905-42c4-b1aa-ef713EXAMPLE", "eventID": "f62e339f-1070-41a8-a6ec-12491EXAMPLE", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

DeleteView

The following example shows a CloudTrail log entry that demonstrates the event that can occur when the DeleteView action starts automatically because of a DeleteIndex operation in the same AWS Region.

Note

If the deleted view is the default view for the Region, this action asynchronously also disassociates the view as the default. This produces a DisassociateDefaultView event.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AROAEXAMPLEEXAMPLE:botocore-session-1661282039", "arn": "arn:aws:sts::123456789012:assumed-role/cli-role/botocore-session-1661282039", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws:iam::123456789012:role/cli-role", "accountId": "123456789012", "userName": "cli-role" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-08-23T19:13:59Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-09-16T19:33:27Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "DeleteView", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.delete-view", "requestParameters": null, "responseElements": null, "eventID": "cd174d1e-0a24-4b47-8b67-d024aEXAMPLE", "readOnly": false, "resources": [{ "accountId": "334026708824", "type": "AWS::ResourceExplorer2::View", "ARN": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/CTTest/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111" }], "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

DisassociateDefaultView

The following example shows a CloudTrail log entry that demonstrates the event that can occur when the DisassociateDefaultView action starts automatically because of a DeleteView operation on the current default view.

{ "eventVersion": "1.08", "userIdentity": { "accountId": "123456789012", "invokedBy": "resource-explorer-2.amazonaws.com" }, "eventTime": "2022-09-16T19:33:26Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "DisassociateDefaultView", "awsRegion": "us-east-1", "sourceIPAddress": "10.24.34.15", "userAgent": "aws-cli/2.7.14 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/resource-explorer-2.disassociate-default-view", "requestParameters": null, "responseElements": null, "eventID": "d8016cb1-5c23-4ea4-bda2-70b03EXAMPLE", "readOnly": false, "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }