AWS CloudTrail records who did what in your AWS accounts. An API call — from the console, the CLI, an SDK, or another AWS service — is captured as an event with the calling identity, source IP, parameters, and result. It is the system of record for security investigation, compliance evidence, and answering "what changed?"
What lands in that record is set by configuration, not assumed. Trails and event data stores log management events by default; data events, network activity events, and Insights events are captured only where you configure selectors for them. Read a trail's selectors before you treat its history as complete.
With AWS CloudTrail, you can:
Look up recent activity : Search the last 90 days of management events by user, event name, resource, or event source
Inspect trail configuration : Describe trails, check logging status, and read the event and Insights selectors that decide what gets captured
Query history with SQL : Run CloudTrail Lake queries across event data stores for analysis that reaches further back than event lookup
Confirm coverage : Verify that logging is actually enabled and that multi-region and organization trails are delivering
In Sim, CloudTrail is the audit half of the AWS story. Where IAM and Identity Center answer who has access , CloudTrail answers what they actually did with it — so an agent can take a suspicious permission change and trace it back to the principal, the source IP, and the moment it happened, then hand a written timeline to whoever needs to act on it.
This block is read-only with one narrow exception: Cancel Query stops a running CloudTrail Lake query. It never enables or disables logging, alters trail configuration, or deletes a trail. Every operation it ships is covered by this policy, with no residual write risk:
{
" Version " : "2012-10-17" ,
" Statement " : [
{
" Effect " : "Allow" ,
" Action " : [
"cloudtrail:DescribeTrails" ,
"cloudtrail:GetTrail" ,
"cloudtrail:GetTrailStatus" ,
"cloudtrail:GetEventSelectors" ,
"cloudtrail:GetInsightSelectors" ,
"cloudtrail:GetEventDataStore" ,
"cloudtrail:ListTrails" ,
"cloudtrail:ListEventDataStores" ,
"cloudtrail:ListTags" ,
"cloudtrail:LookupEvents" ,
"cloudtrail:StartQuery" ,
"cloudtrail:DescribeQuery" ,
"cloudtrail:GetQueryResults" ,
"cloudtrail:CancelQuery"
],
" Resource " : "*"
}
]
}
cloudtrail:CancelQuery is the action Cancel Query needs, and it is not implied by Describe*, Get*, or List* — omit it and that one operation fails with an access-denied error. Note that Start Query is billed per GB scanned and consumes your account's concurrent-query quota of 10.
Lookup Events is limited by AWS to two requests per second per account per Region. Each call uses AWS adaptive retry mode and allows up to six attempts, so a throttled request backs off exponentially with jitter and usually succeeds instead of surfacing an error. That is a retry budget, not a guarantee: sustained throttling past six attempts fails the call with a ThrottlingException, and because a fresh SDK client is built per invocation, adaptive mode's client-side rate limiter carries no pacing state between calls. Lookup Events also returns one page per call — feed nextToken back in to walk a broad search, and expect to handle a throttling error on a long paging loop.
Integrate AWS CloudTrail into workflows. Look up the last 90 days of management and Insights events by user, event name, resource, or access key; inspect trail configuration, logging status, and event selectors; and run SQL queries against CloudTrail Lake event data stores. This block never changes trail or event data store configuration, and never starts or stops logging. Starting and cancelling a Lake query are the only actions that are not reads, and AWS bills Lake queries on the data they scan. Requires AWS access key and secret access key.
Look up AWS CloudTrail management or Insights events from the last 90 days in a Region
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key attributeKeystring No Lookup attribute to filter on: AccessKeyId, EventId, EventName, EventSource, ReadOnly, ResourceName, ResourceType, or Username. Must be paired with attributeValue attributeValuestring No Value the lookup attribute must equal. Must be paired with attributeKey startTimestring No Only return events at or after this ISO 8601 timestamp endTimestring No Only return events at or before this ISO 8601 timestamp eventCategorystring No Set to the value insight to return CloudTrail Insights events instead of management events maxResultsnumber No Number of events to return, 1 to 50 (default 50) nextTokenstring No Pagination token from a previous lookup, which must repeat the same filters
Parameter Type Description eventsarray Matching events, most recent first ↳ eventId string CloudTrail event ID ↳ eventName string API action that was called ↳ readOnly string Whether the action was read-only, as the string 'true' or 'false' ↳ accessKeyId string Access key ID used to make the call, when applicable ↳ eventTime string When the event occurred (ISO 8601) ↳ eventSource string AWS service endpoint that recorded the event ↳ username string Name of the principal that made the call ↳ resources array Resources referenced by the event, as resourceType and resourceName ↳ cloudTrailEvent object Full CloudTrail event record parsed from JSON, including userIdentity, sourceIPAddress, userAgent, requestParameters, responseElements, and errorCode ↳ cloudTrailEventRaw string Raw CloudTrail event JSON string, populated only when it could not be parsed nextTokenstring Pagination token for the next page of events
Retrieve the full configuration of one or more CloudTrail trails in the current Region
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key trailNameListstring No Comma-separated trail names or ARNs. Leave empty to describe every trail in the Region. Trails in another Region must be given as ARNs includeShadowTrailsboolean No Include shadow trails (replications of trails created in another Region, and organization trails in member accounts). Defaults to true
Parameter Type Description trailsarray Full configuration of each matching trail ↳ name string Trail name ↳ s3BucketName string S3 bucket that receives log files ↳ s3KeyPrefix string S3 key prefix for delivered log files ↳ snsTopicName string SNS topic notified on log delivery ↳ snsTopicArn string ARN of that SNS topic ↳ includeGlobalServiceEvents boolean Whether global service events are recorded ↳ isMultiRegionTrail boolean Whether the trail records events in all Regions ↳ homeRegion string Region in which the trail was created ↳ trailArn string ARN of the trail ↳ logFileValidationEnabled boolean Whether log file integrity validation is enabled ↳ cloudWatchLogsLogGroupArn string CloudWatch Logs log group receiving events ↳ cloudWatchLogsRoleArn string Role CloudTrail assumes to write to CloudWatch Logs ↳ kmsKeyId string KMS key used to encrypt log files ↳ hasCustomEventSelectors boolean Whether the trail has custom event selectors ↳ hasInsightSelectors boolean Whether the trail has Insights event selectors ↳ isOrganizationTrail boolean Whether the trail is an organization trail
Retrieve the settings of a single CloudTrail trail by name or ARN
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namestring Yes Trail name, or the trail ARN for a trail in another Region
Parameter Type Description namestring Trail name s3BucketNamestring Name of the S3 bucket that receives log files s3KeyPrefixstring S3 key prefix prepended to delivered log files snsTopicNamestring Name of the SNS topic notified on log delivery snsTopicArnstring ARN of the SNS topic notified on log delivery includeGlobalServiceEventsboolean Whether the trail records global service events isMultiRegionTrailboolean Whether the trail records events in all Regions homeRegionstring Region in which the trail was created trailArnstring ARN of the trail logFileValidationEnabledboolean Whether log file integrity validation is enabled cloudWatchLogsLogGroupArnstring ARN of the CloudWatch Logs log group receiving events cloudWatchLogsRoleArnstring ARN of the role CloudTrail assumes to write to CloudWatch Logs kmsKeyIdstring KMS key used to encrypt log files hasCustomEventSelectorsboolean Whether the trail has custom event selectors hasInsightSelectorsboolean Whether the trail has Insights event selectors isOrganizationTrailboolean Whether the trail is an organization trail
Check whether a CloudTrail trail is logging and surface its most recent delivery errors
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namestring Yes Trail name, or the trail ARN. An organization trail read from a member account must be given as an ARN
Parameter Type Description isLoggingboolean Whether the trail is currently recording API calls latestDeliveryErrorstring Most recent S3 error encountered delivering log files latestDeliveryTimestring When log files were last delivered to S3 (ISO 8601) latestNotificationErrorstring Most recent SNS error encountered sending a notification latestNotificationTimestring When the last SNS notification was sent (ISO 8601) latestCloudWatchLogsDeliveryErrorstring Most recent CloudWatch Logs delivery error latestCloudWatchLogsDeliveryTimestring When events were last delivered to CloudWatch Logs (ISO 8601) latestDigestDeliveryErrorstring Most recent S3 error encountered delivering a digest file latestDigestDeliveryTimestring When a digest file was last delivered to S3 (ISO 8601) startLoggingTimestring When logging was most recently started (ISO 8601) stopLoggingTimestring When logging was most recently stopped (ISO 8601)
List the ARN, name, and home Region of every CloudTrail trail visible to the account
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key nextTokenstring No Pagination token from a previous list request
Parameter Type Description trailsarray Trail summaries ↳ trailArn string ARN of the trail ↳ name string Trail name ↳ homeRegion string Region in which the trail was created nextTokenstring Pagination token for the next page of trails, or null on the last page
Read which management, data, and network activity events a CloudTrail trail is configured to log
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key trailNamestring Yes Trail name or trail ARN
Parameter Type Description trailArnstring ARN of the trail that owns these selectors eventSelectorsarray Basic event selectors configured on the trail ↳ readWriteType string All, ReadOnly, or WriteOnly ↳ includeManagementEvents boolean Whether management events are recorded ↳ dataResources array Data resources logged by the selector, as type and values ↳ excludeManagementEventSources array Event sources excluded from management event logging advancedEventSelectorsarray Advanced event selectors configured on the trail ↳ name string Name of the advanced event selector ↳ fieldSelectors array Field selectors, each with field plus its equals, startsWith, endsWith, notEquals, notStartsWith, and notEndsWith values
Read which CloudTrail Insights types are enabled on a trail or event data store
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key trailNamestring No Trail name or trail ARN. Cannot be combined with eventDataStore eventDataStorestring No Event data store ARN, or the ID suffix of that ARN. Cannot be combined with trailName
Parameter Type Description trailArnstring ARN of the trail whose Insights selectors were read eventDataStoreArnstring ARN of the source event data store that enabled Insights events insightsDestinationstring ARN of the destination event data store that logs Insights events insightSelectorsarray Enabled Insights types and their event categories ↳ insightType string ApiCallRateInsight or ApiErrorRateInsight ↳ eventCategories array Event categories the Insights type applies to: Management, Data, or both
Start a CloudTrail Lake SQL query over an event data store
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryStatementstring No SQL query to run, up to 10,000 characters. The event data store ID is named in the FROM clause. Supply this or queryAlias, not both queryAliasstring No Alias of a query template used by CloudTrail Lake dashboards. Supply this or queryStatement, not both queryParametersstring No Comma-separated parameter values for the query alias, up to 10 values deliveryS3Uristring No S3 URI where CloudTrail delivers the query results (e.g., s3://my-bucket/results) eventDataStoreOwnerAccountIdstring No Account ID of the event data store owner, for a shared event data store
Parameter Type Description queryIdstring ID of the started query. Pass it to Describe Query to poll status, or to Get Query Results to page through rows eventDataStoreOwnerAccountIdstring Account ID of the event data store owner
Check the status, run time, and scan statistics of a CloudTrail Lake query
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryIdstring No ID of the query returned by Start Query. Supply this or queryAlias, not both queryAliasstring No Query template alias; returns the last run for that alias. Supply this or queryId, not both refreshIdstring No Dashboard refresh ID, used together with queryAlias eventDataStoreOwnerAccountIdstring No Account ID of the event data store owner, for a shared event data store
Parameter Type Description queryIdstring ID of the query queryStringstring SQL body of the query queryStatusstring QUEUED, RUNNING, FINISHED, FAILED, CANCELLED, or TIMED_OUT errorMessagestring Error message returned if the query failed deliveryS3Uristring S3 URI the results were delivered to, if configured deliveryStatusstring Delivery status of the S3 results (SUCCESS, FAILED, PENDING, and similar) promptstring Natural-language prompt used to generate the query, if it was generated eventDataStoreOwnerAccountIdstring Account ID of the event data store owner eventsMatchednumber Number of events that matched the query eventsScannednumber Number of events scanned by the query bytesScannednumber Bytes scanned by the query executionTimeInMillisnumber Query run time in milliseconds creationTimestring When the query was created (ISO 8601)
Fetch a page of result rows from a finished CloudTrail Lake query
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryIdstring Yes ID of the query returned by Start Query maxQueryResultsnumber No Maximum rows to return on a single page, 1 to 1000 nextTokenstring No Pagination token from a previous results request eventDataStoreOwnerAccountIdstring No Account ID of the event data store owner, for a shared event data store
Parameter Type Description queryStatusstring QUEUED, RUNNING, FINISHED, FAILED, CANCELLED, or TIMED_OUT rowsarray Result rows, each flattened into a single object keyed by the query column names resultsCountnumber Number of rows on this page totalResultsCountnumber Total number of rows the query produced bytesScannednumber Bytes scanned by the query errorMessagestring Error message returned if the query failed nextTokenstring Pagination token for the next page of rows
Cancel a running CloudTrail Lake query
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryIdstring Yes ID of the query returned by Start Query eventDataStoreOwnerAccountIdstring No Account ID of the event data store owner, for a shared event data store
Parameter Type Description queryIdstring ID of the cancelled query queryStatusstring Status AWS reported for the query after the cancellation request. Cancellation is asynchronous, so this is typically RUNNING or CANCELLED — poll Describe Lake Query for the terminal status eventDataStoreOwnerAccountIdstring Account ID of the event data store owner, when the query was cross-account
List the CloudTrail Lake event data stores in the account for the current Region
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key maxResultsnumber No Maximum event data stores to return on a single page, 1 to 1000 nextTokenstring No Pagination token from a previous list request
Parameter Type Description eventDataStoresarray Event data stores in the account for the current Region ↳ eventDataStoreArn string ARN of the event data store ↳ name string Name of the event data store ↳ status string CREATED, ENABLED, PENDING_DELETION, or an ingestion state ↳ advancedEventSelectors array Advanced event selectors that define what the store ingests ↳ multiRegionEnabled boolean Whether the store collects events from all Regions ↳ organizationEnabled boolean Whether the store collects events for the organization ↳ retentionPeriod number Retention period in days ↳ terminationProtectionEnabled boolean Whether termination protection is enabled ↳ createdTimestamp string When the store was created (ISO 8601) ↳ updatedTimestamp string When the store was last updated (ISO 8601) nextTokenstring Pagination token for the next page of event data stores
Retrieve the configuration of a single CloudTrail Lake event data store
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key eventDataStorestring Yes Event data store ARN, or the ID suffix of that ARN
Parameter Type Description eventDataStoreArnstring ARN of the event data store namestring Name of the event data store statusstring CREATED, ENABLED, PENDING_DELETION, or an ingestion state advancedEventSelectorsarray Advanced event selectors that define what the store ingests ↳ name string Name of the advanced event selector ↳ fieldSelectors array Field selectors, each with field plus its equals, startsWith, endsWith, notEquals, notStartsWith, and notEndsWith values multiRegionEnabledboolean Whether the store collects events from all Regions organizationEnabledboolean Whether the store collects events for the organization retentionPeriodnumber Retention period in days terminationProtectionEnabledboolean Whether termination protection is enabled createdTimestampstring When the store was created (ISO 8601) updatedTimestampstring When the store was last updated (ISO 8601) kmsKeyIdstring KMS key used to encrypt the store billingModestring EXTENDABLE_RETENTION_PRICING or FIXED_RETENTION_PRICING federationStatusstring Lake Formation federation status federationRoleArnstring ARN of the role used for Lake Formation federation partitionKeysarray Partition keys of the event data store ↳ name string Partition key name ↳ type string Partition key data type
List the tags on CloudTrail trails, event data stores, dashboards, or channels
Parameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key resourceIdListstring Yes Comma-separated CloudTrail resource ARNs, up to 20 nextTokenstring No Reserved for future use by AWS
Parameter Type Description resourceTagsarray Tags for each requested resource ↳ resourceId string ARN of the tagged resource ↳ tags array Tags on the resource, as key and value nextTokenstring Reserved for future use by AWS