Logging Amazon Resource Explorer API calls using Amazon CloudTrail - Amazon Resource Explorer
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.

Logging Amazon Resource Explorer API calls using Amazon CloudTrail

Amazon Resource Explorer is integrated with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon Web 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 Amazon CloudTrail User Guide.

Resource Explorer information in CloudTrail

CloudTrail is enabled on your Amazon Web Services account when you create the account. When activity occurs in Resource Explorer, that activity is recorded in a CloudTrail event along with other Amazon Web Service events in Event history. You can view, search, and download recent events in your Amazon Web Services 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 Amazon Web Services 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 Amazon Web Services 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 Web Services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following topics in the Amazon CloudTrail User Guide:

All Resource Explorer actions are logged by CloudTrail and are documented in the Amazon 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 about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or Amazon 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 Amazon Web Service.

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-cn: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": "cn-north-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-cn:resource-explorer-2:cn-north-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-cn:sts::123456789012:assumed-role/My-Admin-Role/My-Delegated-Role", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAEXAMPLEEXAMPLE", "arn": "arn:aws-cn: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": "cn-north-1", "sourceIPAddress": "10.24.34.15", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36", "requestParameters": { "Arn": "arn:aws-cn:resource-explorer-2:cn-north-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-cn:resource-explorer-2:cn-north-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-cn: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": "cn-north-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-cn:resource-explorer-2:cn-north-1:123456789012:index/1a2b3c4d-5d6e-7f8a-9b0c-abcd11111111", "Type": "AGGREGATOR" }, "responseElements": { "Type": "AGGREGATOR", "Arn": "arn:aws-cn:resource-explorer-2:cn-north-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.

{ "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", "userName": "cli-role" }, "eventTime": "2022-08-03T16:50:11Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "Search", "awsRegion": "cn-north-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": "service:ec2" }, "responseElements": null, "requestID": "22320db5-b194-446f-b9f4-e603bEXAMPLE", "eventID": "addb3bca-0c41-46bf-a5e6-42299EXAMPLE", "readOnly": true, "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 Amazon Web Services 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": { "accountId": "123456789012", "invokedBy": "resource-explorer-2.amazonaws.com" }, "eventTime": "2022-09-16T19:33:27Z", "eventSource": "resource-explorer-2.amazonaws.com", "eventName": "DeleteView", "awsRegion": "cn-north-1", "sourceIPAddress": "resource-explorer-2.amazonaws.com", "userAgent": "resource-explorer-2.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "cd174d1e-0a24-4b47-8b67-d024aEXAMPLE", "readOnly": false, "resources": [{ "accountId": "334026708824", "type": "AWS::ResourceExplorer2::View", "ARN": "arn:aws-cn:resource-explorer-2:cn-north-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": "cn-north-1", "sourceIPAddress": "resource-explorer-2.amazonaws.com", "userAgent": "resource-explorer-2.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "d8016cb1-5c23-4ea4-bda2-70b03EXAMPLE", "readOnly": false, "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }