SDK for PHP 3.x

Client: Aws\CloudTrail\CloudTrailClient
Service ID: cloudtrail
Version: 2013-11-01

This page describes the parameters and results for the operations of the AWS CloudTrail (2013-11-01), and shows how to use the Aws\CloudTrail\CloudTrailClient object to call the described operations. This documentation is specific to the 2013-11-01 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

AddTags ( array $params = [] )
Adds one or more tags to a trail, event data store, or channel, up to a limit of 50.
CancelQuery ( array $params = [] )
Cancels a query if the query is not in a terminated state, such as CANCELLED, FAILED, TIMED_OUT, or FINISHED.
CreateChannel ( array $params = [] )
Creates a channel for CloudTrail to ingest events from a partner or external source.
CreateEventDataStore ( array $params = [] )
Creates a new event data store.
CreateTrail ( array $params = [] )
Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.
DeleteChannel ( array $params = [] )
Deletes a channel.
DeleteEventDataStore ( array $params = [] )
Disables the event data store specified by EventDataStore, which accepts an event data store ARN.
DeleteResourcePolicy ( array $params = [] )
Deletes the resource-based policy attached to the CloudTrail channel.
DeleteTrail ( array $params = [] )
Deletes a trail.
DeregisterOrganizationDelegatedAdmin ( array $params = [] )
Removes CloudTrail delegated administrator permissions from a member account in an organization.
DescribeQuery ( array $params = [] )
Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status.
DescribeTrails ( array $params = [] )
Retrieves settings for one or more trails associated with the current Region for your account.
DisableFederation ( array $params = [] )
Disables Lake query federation on the specified event data store.
EnableFederation ( array $params = [] )
Enables Lake query federation on the specified event data store.
GetChannel ( array $params = [] )
Returns information about a specific channel.
GetEventDataStore ( array $params = [] )
Returns information about an event data store specified as either an ARN or the ID portion of the ARN.
GetEventSelectors ( array $params = [] )
Describes the settings for the event selectors that you configured for your trail.
GetImport ( array $params = [] )
Returns information about a specific import.
GetInsightSelectors ( array $params = [] )
Describes the settings for the Insights event selectors that you configured for your trail or event data store.
GetQueryResults ( array $params = [] )
Gets event data results of a query.
GetResourcePolicy ( array $params = [] )
Retrieves the JSON text of the resource-based policy document attached to the CloudTrail channel.
GetTrail ( array $params = [] )
Returns settings information for a specified trail.
GetTrailStatus ( array $params = [] )
Returns a JSON-formatted list of information about the specified trail.
ListChannels ( array $params = [] )
Lists the channels in the current account, and their source names.
ListEventDataStores ( array $params = [] )
Returns information about all event data stores in the account, in the current Region.
ListImportFailures ( array $params = [] )
Returns a list of failures for the specified import.
ListImports ( array $params = [] )
Returns information on all imports, or a select set of imports by ImportStatus or Destination.
ListInsightsMetricData ( array $params = [] )
Returns Insights metrics data for trails that have enabled Insights.
ListPublicKeys ( array $params = [] )
Returns all public keys whose private keys were used to sign the digest files within the specified time range.
ListQueries ( array $params = [] )
Returns a list of queries and query statuses for the past seven days.
ListTags ( array $params = [] )
Lists the tags for the specified trails, event data stores, or channels in the current Region.
ListTrails ( array $params = [] )
Lists trails that are in the current account.
LookupEvents ( array $params = [] )
Looks up management events or CloudTrail Insights events that are captured by CloudTrail.
PutEventSelectors ( array $params = [] )
Configures an event selector or advanced event selectors for your trail.
PutInsightSelectors ( array $params = [] )
Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail or event data store.
PutResourcePolicy ( array $params = [] )
Attaches a resource-based permission policy to a CloudTrail channel that is used for an integration with an event source outside of Amazon Web Services.
RegisterOrganizationDelegatedAdmin ( array $params = [] )
Registers an organization’s member account as the CloudTrail delegated administrator.
RemoveTags ( array $params = [] )
Removes the specified tags from a trail, event data store, or channel.
RestoreEventDataStore ( array $params = [] )
Restores a deleted event data store specified by EventDataStore, which accepts an event data store ARN.
StartEventDataStoreIngestion ( array $params = [] )
Starts the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN.
StartImport ( array $params = [] )
Starts an import of logged trail events from a source S3 bucket to a destination event data store.
StartLogging ( array $params = [] )
Starts the recording of Amazon Web Services API calls and log file delivery for a trail.
StartQuery ( array $params = [] )
Starts a CloudTrail Lake query.
StopEventDataStoreIngestion ( array $params = [] )
Stops the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN.
StopImport ( array $params = [] )
Stops a specified import.
StopLogging ( array $params = [] )
Suspends the recording of Amazon Web Services API calls and log file delivery for the specified trail.
UpdateChannel ( array $params = [] )
Updates a channel specified by a required channel ARN or UUID.
UpdateEventDataStore ( array $params = [] )
Updates an event data store.
UpdateTrail ( array $params = [] )
Updates trail settings that control what events you are logging, and how to handle log files.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

DescribeTrails
GetQueryResults
ListChannels
ListEventDataStores
ListImportFailures
ListImports
ListInsightsMetricData
ListPublicKeys
ListQueries
ListTags
ListTrails
LookupEvents

Operations

AddTags

$result = $client->addTags([/* ... */]);
$promise = $client->addTagsAsync([/* ... */]);

Adds one or more tags to a trail, event data store, or channel, up to a limit of 50. Overwrites an existing tag's value when a new value is specified for an existing tag key. Tag key names must be unique; you cannot have two keys with the same name but different values. If you specify a key without a value, the tag will be created with the specified key and a value of null. You can tag a trail or event data store that applies to all Amazon Web Services Regions only from the Region in which the trail or event data store was created (also known as its home Region).

Parameter Syntax

$result = $client->addTags([
    'ResourceId' => '<string>', // REQUIRED
    'TagsList' => [ // REQUIRED
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
ResourceId
Required: Yes
Type: string

Specifies the ARN of the trail, event data store, or channel to which one or more tags will be added.

The format of a trail ARN is: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The format of an event data store ARN is: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The format of a channel ARN is: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

TagsList
Required: Yes
Type: Array of Tag structures

Contains a list of tags, up to a limit of 50

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

TagsLimitExceededException:

The number of tags per trail, event data store, or channel has exceeded the permitted amount. Currently, the limit is 50.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

InvalidTagParameterException:

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

InactiveEventDataStoreException:

The event data store is inactive.

EventDataStoreNotFoundException:

The specified event data store was not found.

ChannelNotFoundException:

This exception is thrown when CloudTrail cannot find the specified channel.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

CancelQuery

$result = $client->cancelQuery([/* ... */]);
$promise = $client->cancelQueryAsync([/* ... */]);

Cancels a query if the query is not in a terminated state, such as CANCELLED, FAILED, TIMED_OUT, or FINISHED. You must specify an ARN value for EventDataStore. The ID of the query that you want to cancel is also required. When you run CancelQuery, the query status might show as CANCELLED even if the operation is not yet finished.

Parameter Syntax

$result = $client->cancelQuery([
    'EventDataStore' => '<string>',
    'QueryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Type: string

The ARN (or the ID suffix of the ARN) of an event data store on which the specified query is running.

QueryId
Required: Yes
Type: string

The ID of the query that you want to cancel. The QueryId comes from the response of a StartQuery operation.

Result Syntax

[
    'QueryId' => '<string>',
    'QueryStatus' => 'QUEUED|RUNNING|FINISHED|FAILED|CANCELLED|TIMED_OUT',
]

Result Details

Members
QueryId
Required: Yes
Type: string

The ID of the canceled query.

QueryStatus
Required: Yes
Type: string

Shows the status of a query after a CancelQuery request. Typically, the values shown are either RUNNING or CANCELLED.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InactiveEventDataStoreException:

The event data store is inactive.

InactiveQueryException:

The specified query cannot be canceled because it is in the FINISHED, FAILED, TIMED_OUT, or CANCELLED state.

InvalidParameterException:

The request includes a parameter that is not valid.

QueryIdNotFoundException:

The query ID does not exist or does not map to a query.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

CreateChannel

$result = $client->createChannel([/* ... */]);
$promise = $client->createChannelAsync([/* ... */]);

Creates a channel for CloudTrail to ingest events from a partner or external source. After you create a channel, a CloudTrail Lake event data store can log events from the partner or source that you specify.

Parameter Syntax

$result = $client->createChannel([
    'Destinations' => [ // REQUIRED
        [
            'Location' => '<string>', // REQUIRED
            'Type' => 'EVENT_DATA_STORE|AWS_SERVICE', // REQUIRED
        ],
        // ...
    ],
    'Name' => '<string>', // REQUIRED
    'Source' => '<string>', // REQUIRED
    'Tags' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
Destinations
Required: Yes
Type: Array of Destination structures

One or more event data stores to which events arriving through a channel will be logged.

Name
Required: Yes
Type: string

The name of the channel.

Source
Required: Yes
Type: string

The name of the partner or external event source. You cannot change this name after you create the channel. A maximum of one channel is allowed per source.

A source can be either Custom for all valid non-Amazon Web Services events, or the name of a partner event source. For information about the source names for available partners, see Additional information about integration partners in the CloudTrail User Guide.

Tags
Type: Array of Tag structures

A list of tags.

Result Syntax

[
    'ChannelArn' => '<string>',
    'Destinations' => [
        [
            'Location' => '<string>',
            'Type' => 'EVENT_DATA_STORE|AWS_SERVICE',
        ],
        // ...
    ],
    'Name' => '<string>',
    'Source' => '<string>',
    'Tags' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
ChannelArn
Type: string

The Amazon Resource Name (ARN) of the new channel.

Destinations
Type: Array of Destination structures

The event data stores that log the events arriving through the channel.

Name
Type: string

The name of the new channel.

Source
Type: string

The partner or external event source name.

Tags
Type: Array of Tag structures

A list of tags.

Errors

ChannelMaxLimitExceededException:

This exception is thrown when the maximum number of channels limit is exceeded.

InvalidSourceException:

This exception is thrown when the specified value of Source is not valid.

ChannelAlreadyExistsException:

This exception is thrown when the provided channel already exists.

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventDataStoreCategoryException:

This exception is thrown when event categories of specified event data stores are not valid.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidTagParameterException:

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

TagsLimitExceededException:

The number of tags per trail, event data store, or channel has exceeded the permitted amount. Currently, the limit is 50.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

CreateEventDataStore

$result = $client->createEventDataStore([/* ... */]);
$promise = $client->createEventDataStoreAsync([/* ... */]);

Creates a new event data store.

Parameter Syntax

$result = $client->createEventDataStore([
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [ // REQUIRED
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>', // REQUIRED
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>', // REQUIRED
    'OrganizationEnabled' => true || false,
    'RetentionPeriod' => <integer>,
    'StartIngestion' => true || false,
    'TagsList' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
    'TerminationProtectionEnabled' => true || false,
]);

Parameter Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors to use to select the events for the data store. You can configure up to five advanced event selectors for each event data store.

For more information about how to use advanced event selectors to log CloudTrail events, see Log events by using advanced event selectors in the CloudTrail User Guide.

For more information about how to use advanced event selectors to include Config configuration items in your event data store, see Create an event data store for Config configuration items in the CloudTrail User Guide.

For more information about how to use advanced event selectors to include events outside of Amazon Web Services events in your event data store, see Create an integration to log events from outside Amazon Web Services in the CloudTrail User Guide.

BillingMode
Type: string

The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store.

The following are the possible values:

  • EXTENDABLE_RETENTION_PRICING - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days.

  • FIXED_RETENTION_PRICING - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days.

The default value is EXTENDABLE_RETENTION_PRICING.

For more information about CloudTrail pricing, see CloudTrail Pricing and Managing CloudTrail Lake costs.

KmsKeyId
Type: string

Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.

CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

Examples:

  • alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

  • 12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Specifies whether the event data store includes events from all Regions, or only from the Region in which the event data store is created.

Name
Required: Yes
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Specifies whether an event data store collects events logged for an organization in Organizations.

RetentionPeriod
Type: int

The retention period of the event data store, in days. If BillingMode is set to EXTENDABLE_RETENTION_PRICING, you can set a retention period of up to 3653 days, the equivalent of 10 years. If BillingMode is set to FIXED_RETENTION_PRICING, you can set a retention period of up to 2557 days, the equivalent of seven years.

CloudTrail Lake determines whether to retain an event by checking if the eventTime of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the eventTime is older than 90 days.

If you plan to copy trail events to this event data store, we recommend that you consider both the age of the events that you want to copy as well as how long you want to keep the copied events in your event data store. For example, if you copy trail events that are 5 years old and specify a retention period of 7 years, the event data store will retain those events for two years.

StartIngestion
Type: boolean

Specifies whether the event data store should start ingesting live events. The default is true.

TagsList
Type: Array of Tag structures

A list of tags.

TerminationProtectionEnabled
Type: boolean

Specifies whether termination protection is enabled for the event data store. If termination protection is enabled, you cannot delete the event data store until termination protection is disabled.

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'CreatedTimestamp' => <DateTime>,
    'EventDataStoreArn' => '<string>',
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>',
    'OrganizationEnabled' => true || false,
    'RetentionPeriod' => <integer>,
    'Status' => 'CREATED|ENABLED|PENDING_DELETION|STARTING_INGESTION|STOPPING_INGESTION|STOPPED_INGESTION',
    'TagsList' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
    'TerminationProtectionEnabled' => true || false,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that were used to select the events for the data store.

BillingMode
Type: string

The billing mode for the event data store.

CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp that shows when the event data store was created.

EventDataStoreArn
Type: string

The ARN of the event data store.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Indicates whether the event data store collects events from all Regions, or only from the Region in which it was created.

Name
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Indicates whether an event data store is collecting logged events for an organization in Organizations.

RetentionPeriod
Type: int

The retention period of an event data store, in days.

Status
Type: string

The status of event data store creation.

TagsList
Type: Array of Tag structures

A list of tags.

TerminationProtectionEnabled
Type: boolean

Indicates whether termination protection is enabled for the event data store.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp that shows when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.

Errors

EventDataStoreAlreadyExistsException:

An event data store with that name already exists.

EventDataStoreMaxLimitExceededException:

Your account has used the maximum number of event data stores.

InvalidEventSelectorsException:

This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250.

You can:

  • Specify a valid number of event selectors (1 to 5) for a trail.

  • Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.

  • Specify up to 500 values for all conditions in all advanced event selectors for a trail.

  • Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidTagParameterException:

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

InvalidKmsKeyIdException:

This exception is thrown when the KMS key ARN is not valid.

KmsKeyNotFoundException:

This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.

KmsException:

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

CreateTrail

$result = $client->createTrail([/* ... */]);
$promise = $client->createTrailAsync([/* ... */]);

Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Parameter Syntax

$result = $client->createTrail([
    'CloudWatchLogsLogGroupArn' => '<string>',
    'CloudWatchLogsRoleArn' => '<string>',
    'EnableLogFileValidation' => true || false,
    'IncludeGlobalServiceEvents' => true || false,
    'IsMultiRegionTrail' => true || false,
    'IsOrganizationTrail' => true || false,
    'KmsKeyId' => '<string>',
    'Name' => '<string>', // REQUIRED
    'S3BucketName' => '<string>', // REQUIRED
    'S3KeyPrefix' => '<string>',
    'SnsTopicName' => '<string>',
    'TagsList' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
CloudWatchLogsLogGroupArn
Type: string

Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account.

Not required unless you specify CloudWatchLogsRoleArn.

CloudWatchLogsRoleArn
Type: string

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.

EnableLogFileValidation
Type: boolean

Specifies whether log file integrity validation is enabled. The default is false.

When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.

IncludeGlobalServiceEvents
Type: boolean

Specifies whether the trail is publishing events from global services such as IAM to the log files.

IsMultiRegionTrail
Type: boolean

Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.

IsOrganizationTrail
Type: boolean

Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.

KmsKeyId
Type: string

Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

Examples:

  • alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

  • 12345678-1234-1234-1234-123456789012

Name
Required: Yes
Type: string

Specifies the name of the trail. The name must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

S3BucketName
Required: Yes
Type: string

Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see Bucket naming rules in the Amazon Simple Storage Service User Guide.

S3KeyPrefix
Type: string

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.

SnsTopicName
Type: string

Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

TagsList
Type: Array of Tag structures

A list of tags.

Result Syntax

[
    'CloudWatchLogsLogGroupArn' => '<string>',
    'CloudWatchLogsRoleArn' => '<string>',
    'IncludeGlobalServiceEvents' => true || false,
    'IsMultiRegionTrail' => true || false,
    'IsOrganizationTrail' => true || false,
    'KmsKeyId' => '<string>',
    'LogFileValidationEnabled' => true || false,
    'Name' => '<string>',
    'S3BucketName' => '<string>',
    'S3KeyPrefix' => '<string>',
    'SnsTopicARN' => '<string>',
    'SnsTopicName' => '<string>',
    'TrailARN' => '<string>',
]

Result Details

Members
CloudWatchLogsLogGroupArn
Type: string

Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.

CloudWatchLogsRoleArn
Type: string

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

IncludeGlobalServiceEvents
Type: boolean

Specifies whether the trail is publishing events from global services such as IAM to the log files.

IsMultiRegionTrail
Type: boolean

Specifies whether the trail exists in one Region or in all Regions.

IsOrganizationTrail
Type: boolean

Specifies whether the trail is an organization trail.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

LogFileValidationEnabled
Type: boolean

Specifies whether log file integrity validation is enabled.

Name
Type: string

Specifies the name of the trail.

S3BucketName
Type: string

Specifies the name of the Amazon S3 bucket designated for publishing log files.

S3KeyPrefix
Type: string

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.

SnsTopicARN
Type: string

Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:

arn:aws:sns:us-east-2:123456789012:MyTopic

SnsTopicName
Type: string

This field is no longer in use. Use SnsTopicARN.

TrailARN
Type: string

Specifies the ARN of the trail that was created. The format of a trail ARN is:

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Errors

MaximumNumberOfTrailsExceededException:

This exception is thrown when the maximum number of trails is reached.

TrailAlreadyExistsException:

This exception is thrown when the specified trail already exists.

S3BucketDoesNotExistException:

This exception is thrown when the specified S3 bucket does not exist.

InsufficientS3BucketPolicyException:

This exception is thrown when the policy on the S3 bucket is not sufficient.

InsufficientSnsTopicPolicyException:

This exception is thrown when the policy on the Amazon SNS topic is not sufficient.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

InvalidS3BucketNameException:

This exception is thrown when the provided S3 bucket name is not valid.

InvalidS3PrefixException:

This exception is thrown when the provided S3 prefix is not valid.

InvalidSnsTopicNameException:

This exception is thrown when the provided SNS topic name is not valid.

InvalidKmsKeyIdException:

This exception is thrown when the KMS key ARN is not valid.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

TrailNotProvidedException:

This exception is no longer in use.

TagsLimitExceededException:

The number of tags per trail, event data store, or channel has exceeded the permitted amount. Currently, the limit is 50.

InvalidParameterCombinationException:

This exception is thrown when the combination of parameters provided is not valid.

InvalidParameterException:

The request includes a parameter that is not valid.

KmsKeyNotFoundException:

This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.

KmsKeyDisabledException:

This exception is no longer in use.

KmsException:

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

InvalidCloudWatchLogsLogGroupArnException:

This exception is thrown when the provided CloudWatch Logs log group is not valid.

InvalidCloudWatchLogsRoleArnException:

This exception is thrown when the provided role is not valid.

CloudWatchLogsDeliveryUnavailableException:

Cannot set a CloudWatch Logs delivery for this Region.

InvalidTagParameterException:

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

CloudTrailInvalidClientTokenIdException:

This exception is thrown when a call results in the InvalidClientTokenId error code. This can occur when you are creating or updating a trail to send notifications to an Amazon SNS topic that is in a suspended Amazon Web Services account.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

DeleteChannel

$result = $client->deleteChannel([/* ... */]);
$promise = $client->deleteChannelAsync([/* ... */]);

Deletes a channel.

Parameter Syntax

$result = $client->deleteChannel([
    'Channel' => '<string>', // REQUIRED
]);

Parameter Details

Members
Channel
Required: Yes
Type: string

The ARN or the UUID value of the channel that you want to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ChannelNotFoundException:

This exception is thrown when CloudTrail cannot find the specified channel.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

DeleteEventDataStore

$result = $client->deleteEventDataStore([/* ... */]);
$promise = $client->deleteEventDataStoreAsync([/* ... */]);

Disables the event data store specified by EventDataStore, which accepts an event data store ARN. After you run DeleteEventDataStore, the event data store enters a PENDING_DELETION state, and is automatically deleted after a wait period of seven days. TerminationProtectionEnabled must be set to False on the event data store and the FederationStatus must be DISABLED. You cannot delete an event data store if TerminationProtectionEnabled is True or the FederationStatus is ENABLED.

After you run DeleteEventDataStore on an event data store, you cannot run ListQueries, DescribeQuery, or GetQueryResults on queries that are using an event data store in a PENDING_DELETION state. An event data store in the PENDING_DELETION state does not incur costs.

Parameter Syntax

$result = $client->deleteEventDataStore([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or the ID suffix of the ARN) of the event data store to delete.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

EventDataStoreTerminationProtectedException:

The event data store cannot be deleted because termination protection is enabled for it.

EventDataStoreHasOngoingImportException:

This exception is thrown when you try to update or delete an event data store that currently has an import in progress.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ChannelExistsForEDSException:

This exception is thrown when the specified event data store cannot yet be deleted because it is in use by a channel.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

EventDataStoreFederationEnabledException:

You cannot delete the event data store because Lake query federation is enabled. To delete the event data store, run the DisableFederation operation to disable Lake query federation on the event data store.

DeleteResourcePolicy

$result = $client->deleteResourcePolicy([/* ... */]);
$promise = $client->deleteResourcePolicyAsync([/* ... */]);

Deletes the resource-based policy attached to the CloudTrail channel.

Parameter Syntax

$result = $client->deleteResourcePolicy([
    'ResourceArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the CloudTrail channel you're deleting the resource-based policy from. The following is the format of a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceARNNotValidException:

This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid. The following is the valid format for a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

ResourcePolicyNotFoundException:

This exception is thrown when the specified resource policy is not found.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

DeleteTrail

$result = $client->deleteTrail([/* ... */]);
$promise = $client->deleteTrailAsync([/* ... */]);

Deletes a trail. This operation must be called from the Region in which the trail was created. DeleteTrail cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions.

Parameter Syntax

$result = $client->deleteTrail([
    'Name' => '<string>', // REQUIRED
]);

Parameter Details

Members
Name
Required: Yes
Type: string

Specifies the name or the CloudTrail ARN of the trail to be deleted. The following is the format of a trail ARN. arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

DeregisterOrganizationDelegatedAdmin

$result = $client->deregisterOrganizationDelegatedAdmin([/* ... */]);
$promise = $client->deregisterOrganizationDelegatedAdminAsync([/* ... */]);

Removes CloudTrail delegated administrator permissions from a member account in an organization.

Parameter Syntax

$result = $client->deregisterOrganizationDelegatedAdmin([
    'DelegatedAdminAccountId' => '<string>', // REQUIRED
]);

Parameter Details

Members
DelegatedAdminAccountId
Required: Yes
Type: string

A delegated administrator account ID. This is a member account in an organization that is currently designated as a delegated administrator.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

AccountNotFoundException:

This exception is thrown when the specified account is not found or not part of an organization.

AccountNotRegisteredException:

This exception is thrown when the specified account is not registered as the CloudTrail delegated administrator.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

InvalidParameterException:

The request includes a parameter that is not valid.

NotOrganizationManagementAccountException:

This exception is thrown when the account making the request is not the organization's management account.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

DescribeQuery

$result = $client->describeQuery([/* ... */]);
$promise = $client->describeQueryAsync([/* ... */]);

Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. If the query results were delivered to an S3 bucket, the response also provides the S3 URI and the delivery status.

You must specify either a QueryID or a QueryAlias. Specifying the QueryAlias parameter returns information about the last query run for the alias.

Parameter Syntax

$result = $client->describeQuery([
    'EventDataStore' => '<string>',
    'QueryAlias' => '<string>',
    'QueryId' => '<string>',
]);

Parameter Details

Members
EventDataStore
Type: string

The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.

QueryAlias
Type: string

The alias that identifies a query template.

QueryId
Type: string

The query ID.

Result Syntax

[
    'DeliveryS3Uri' => '<string>',
    'DeliveryStatus' => 'SUCCESS|FAILED|FAILED_SIGNING_FILE|PENDING|RESOURCE_NOT_FOUND|ACCESS_DENIED|ACCESS_DENIED_SIGNING_FILE|CANCELLED|UNKNOWN',
    'ErrorMessage' => '<string>',
    'QueryId' => '<string>',
    'QueryStatistics' => [
        'BytesScanned' => <integer>,
        'CreationTime' => <DateTime>,
        'EventsMatched' => <integer>,
        'EventsScanned' => <integer>,
        'ExecutionTimeInMillis' => <integer>,
    ],
    'QueryStatus' => 'QUEUED|RUNNING|FINISHED|FAILED|CANCELLED|TIMED_OUT',
    'QueryString' => '<string>',
]

Result Details

Members
DeliveryS3Uri
Type: string

The URI for the S3 bucket where CloudTrail delivered query results, if applicable.

DeliveryStatus
Type: string

The delivery status.

ErrorMessage
Type: string

The error message returned if a query failed.

QueryId
Type: string

The ID of the query.

QueryStatistics

Metadata about a query, including the number of events that were matched, the total number of events scanned, the query run time in milliseconds, and the query's creation time.

QueryStatus
Type: string

The status of a query. Values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED

QueryString
Type: string

The SQL code of a query.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

QueryIdNotFoundException:

The query ID does not exist or does not map to a query.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

DescribeTrails

$result = $client->describeTrails([/* ... */]);
$promise = $client->describeTrailsAsync([/* ... */]);

Retrieves settings for one or more trails associated with the current Region for your account.

Parameter Syntax

$result = $client->describeTrails([
    'includeShadowTrails' => true || false,
    'trailNameList' => ['<string>', ...],
]);

Parameter Details

Members
includeShadowTrails
Type: boolean

Specifies whether to include shadow trails in the response. A shadow trail is the replication in a Region of a trail that was created in a different Region, or in the case of an organization trail, the replication of an organization trail in member accounts. If you do not include shadow trails, organization trails in a member account and Region replication trails will not be returned. The default is true.

trailNameList
Type: Array of strings

Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is:

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

If an empty list is specified, information for the trail in the current Region is returned.

  • If an empty list is specified and IncludeShadowTrails is false, then information for all trails in the current Region is returned.

  • If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current Region and any associated shadow trails in other Regions is returned.

If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current Region and current account. To return information about a trail in another Region, you must specify its trail ARN.

Result Syntax

[
    'trailList' => [
        [
            'CloudWatchLogsLogGroupArn' => '<string>',
            'CloudWatchLogsRoleArn' => '<string>',
            'HasCustomEventSelectors' => true || false,
            'HasInsightSelectors' => true || false,
            'HomeRegion' => '<string>',
            'IncludeGlobalServiceEvents' => true || false,
            'IsMultiRegionTrail' => true || false,
            'IsOrganizationTrail' => true || false,
            'KmsKeyId' => '<string>',
            'LogFileValidationEnabled' => true || false,
            'Name' => '<string>',
            'S3BucketName' => '<string>',
            'S3KeyPrefix' => '<string>',
            'SnsTopicARN' => '<string>',
            'SnsTopicName' => '<string>',
            'TrailARN' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
trailList
Type: Array of Trail structures

The list of trail objects. Trail objects with string values are only returned if values for the objects exist in a trail's configuration. For example, SNSTopicName and SNSTopicARN are only returned in results if a trail is configured to send SNS notifications. Similarly, KMSKeyId only appears in results if a trail's log files are encrypted with KMS customer managed keys.

Errors

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

DisableFederation

$result = $client->disableFederation([/* ... */]);
$promise = $client->disableFederationAsync([/* ... */]);

Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail disables the integration with Glue, Lake Formation, and Amazon Athena. After disabling Lake query federation, you can no longer query your event data in Amazon Athena.

No CloudTrail Lake data is deleted when you disable federation and you can continue to run queries in CloudTrail Lake.

Parameter Syntax

$result = $client->disableFederation([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or ID suffix of the ARN) of the event data store for which you want to disable Lake query federation.

Result Syntax

[
    'EventDataStoreArn' => '<string>',
    'FederationStatus' => 'ENABLING|ENABLED|DISABLING|DISABLED',
]

Result Details

Members
EventDataStoreArn
Type: string

The ARN of the event data store for which you disabled Lake query federation.

FederationStatus
Type: string

The federation status.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

InactiveEventDataStoreException:

The event data store is inactive.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

ConcurrentModificationException:

You are trying to update a resource when another request is in progress. Allow sufficient wait time for the previous request to complete, then retry your request.

AccessDeniedException:

You do not have sufficient access to perform this action.

EnableFederation

$result = $client->enableFederation([/* ... */]);
$promise = $client->enableFederationAsync([/* ... */]);

Enables Lake query federation on the specified event data store. Federating an event data store lets you view the metadata associated with the event data store in the Glue Data Catalog and run SQL queries against your event data using Amazon Athena. The table metadata stored in the Glue Data Catalog lets the Athena query engine know how to find, read, and process the data that you want to query.

When you enable Lake query federation, CloudTrail creates a managed database named aws:cloudtrail (if the database doesn't already exist) and a managed federated table in the Glue Data Catalog. The event data store ID is used for the table name. CloudTrail registers the role ARN and event data store in Lake Formation, the service responsible for allowing fine-grained access control of the federated resources in the Glue Data Catalog.

For more information about Lake query federation, see Federate an event data store.

Parameter Syntax

$result = $client->enableFederation([
    'EventDataStore' => '<string>', // REQUIRED
    'FederationRoleArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or ID suffix of the ARN) of the event data store for which you want to enable Lake query federation.

FederationRoleArn
Required: Yes
Type: string

The ARN of the federation role to use for the event data store. Amazon Web Services services like Lake Formation use this federation role to access data for the federated event data store. The federation role must exist in your account and provide the required minimum permissions.

Result Syntax

[
    'EventDataStoreArn' => '<string>',
    'FederationRoleArn' => '<string>',
    'FederationStatus' => 'ENABLING|ENABLED|DISABLING|DISABLED',
]

Result Details

Members
EventDataStoreArn
Type: string

The ARN of the event data store for which you enabled Lake query federation.

FederationRoleArn
Type: string

The ARN of the federation role.

FederationStatus
Type: string

The federation status.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

InactiveEventDataStoreException:

The event data store is inactive.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

ConcurrentModificationException:

You are trying to update a resource when another request is in progress. Allow sufficient wait time for the previous request to complete, then retry your request.

AccessDeniedException:

You do not have sufficient access to perform this action.

EventDataStoreFederationEnabledException:

You cannot delete the event data store because Lake query federation is enabled. To delete the event data store, run the DisableFederation operation to disable Lake query federation on the event data store.

GetChannel

$result = $client->getChannel([/* ... */]);
$promise = $client->getChannelAsync([/* ... */]);

Returns information about a specific channel.

Parameter Syntax

$result = $client->getChannel([
    'Channel' => '<string>', // REQUIRED
]);

Parameter Details

Members
Channel
Required: Yes
Type: string

The ARN or UUID of a channel.

Result Syntax

[
    'ChannelArn' => '<string>',
    'Destinations' => [
        [
            'Location' => '<string>',
            'Type' => 'EVENT_DATA_STORE|AWS_SERVICE',
        ],
        // ...
    ],
    'IngestionStatus' => [
        'LatestIngestionAttemptEventID' => '<string>',
        'LatestIngestionAttemptTime' => <DateTime>,
        'LatestIngestionErrorCode' => '<string>',
        'LatestIngestionSuccessEventID' => '<string>',
        'LatestIngestionSuccessTime' => <DateTime>,
    ],
    'Name' => '<string>',
    'Source' => '<string>',
    'SourceConfig' => [
        'AdvancedEventSelectors' => [
            [
                'FieldSelectors' => [
                    [
                        'EndsWith' => ['<string>', ...],
                        'Equals' => ['<string>', ...],
                        'Field' => '<string>',
                        'NotEndsWith' => ['<string>', ...],
                        'NotEquals' => ['<string>', ...],
                        'NotStartsWith' => ['<string>', ...],
                        'StartsWith' => ['<string>', ...],
                    ],
                    // ...
                ],
                'Name' => '<string>',
            ],
            // ...
        ],
        'ApplyToAllRegions' => true || false,
    ],
]

Result Details

Members
ChannelArn
Type: string

The ARN of an channel returned by a GetChannel request.

Destinations
Type: Array of Destination structures

The destinations for the channel. For channels created for integrations, the destinations are the event data stores that log events arriving through the channel. For service-linked channels, the destination is the Amazon Web Services service that created the service-linked channel to receive events.

IngestionStatus
Type: IngestionStatus structure

A table showing information about the most recent successful and failed attempts to ingest events.

Name
Type: string

The name of the CloudTrail channel. For service-linked channels, the name is aws-service-channel/service-name/custom-suffix where service-name represents the name of the Amazon Web Services service that created the channel and custom-suffix represents the suffix generated by the Amazon Web Services service.

Source
Type: string

The source for the CloudTrail channel.

SourceConfig
Type: SourceConfig structure

Provides information about the advanced event selectors configured for the channel, and whether the channel applies to all Regions or a single Region.

Errors

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ChannelNotFoundException:

This exception is thrown when CloudTrail cannot find the specified channel.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

GetEventDataStore

$result = $client->getEventDataStore([/* ... */]);
$promise = $client->getEventDataStoreAsync([/* ... */]);

Returns information about an event data store specified as either an ARN or the ID portion of the ARN.

Parameter Syntax

$result = $client->getEventDataStore([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or ID suffix of the ARN) of the event data store about which you want information.

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'CreatedTimestamp' => <DateTime>,
    'EventDataStoreArn' => '<string>',
    'FederationRoleArn' => '<string>',
    'FederationStatus' => 'ENABLING|ENABLED|DISABLING|DISABLED',
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>',
    'OrganizationEnabled' => true || false,
    'PartitionKeys' => [
        [
            'Name' => '<string>',
            'Type' => '<string>',
        ],
        // ...
    ],
    'RetentionPeriod' => <integer>,
    'Status' => 'CREATED|ENABLED|PENDING_DELETION|STARTING_INGESTION|STOPPING_INGESTION|STOPPED_INGESTION',
    'TerminationProtectionEnabled' => true || false,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors used to select events for the data store.

BillingMode
Type: string

The billing mode for the event data store.

CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the event data store's creation.

EventDataStoreArn
Type: string

The event data store Amazon Resource Number (ARN).

FederationRoleArn
Type: string

If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store.

FederationStatus
Type: string

Indicates the Lake query federation status. The status is ENABLED if Lake query federation is enabled, or DISABLED if Lake query federation is disabled. You cannot delete an event data store if the FederationStatus is ENABLED.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.

Name
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Indicates whether an event data store is collecting logged events for an organization in Organizations.

PartitionKeys
Type: Array of PartitionKey structures

The partition keys for the event data store. To improve query performance and efficiency, CloudTrail Lake organizes event data into partitions based on values derived from partition keys.

RetentionPeriod
Type: int

The retention period of the event data store, in days.

Status
Type: string

The status of an event data store.

TerminationProtectionEnabled
Type: boolean

Indicates that termination protection is enabled.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

Shows the time that an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

GetEventSelectors

$result = $client->getEventSelectors([/* ... */]);
$promise = $client->getEventSelectorsAsync([/* ... */]);

Describes the settings for the event selectors that you configured for your trail. The information returned for your event selectors includes the following:

  • If your event selector includes read-only events, write-only events, or all events. This applies to both management events and data events.

  • If your event selector includes management events.

  • If your event selector includes data events, the resources on which you are logging data events.

For more information about logging management and data events, see the following topics in the CloudTrail User Guide:

Parameter Syntax

$result = $client->getEventSelectors([
    'TrailName' => '<string>', // REQUIRED
]);

Parameter Details

Members
TrailName
Required: Yes
Type: string

Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

If you specify a trail ARN, it must be in the format:

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'EventSelectors' => [
        [
            'DataResources' => [
                [
                    'Type' => '<string>',
                    'Values' => ['<string>', ...],
                ],
                // ...
            ],
            'ExcludeManagementEventSources' => ['<string>', ...],
            'IncludeManagementEvents' => true || false,
            'ReadWriteType' => 'ReadOnly|WriteOnly|All',
        ],
        // ...
    ],
    'TrailARN' => '<string>',
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that are configured for the trail.

EventSelectors
Type: Array of EventSelector structures

The event selectors that are configured for the trail.

TrailARN
Type: string

The specified trail ARN that has the event selectors.

Errors

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

GetImport

$result = $client->getImport([/* ... */]);
$promise = $client->getImportAsync([/* ... */]);

Returns information about a specific import.

Parameter Syntax

$result = $client->getImport([
    'ImportId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ImportId
Required: Yes
Type: string

The ID for the import.

Result Syntax

[
    'CreatedTimestamp' => <DateTime>,
    'Destinations' => ['<string>', ...],
    'EndEventTime' => <DateTime>,
    'ImportId' => '<string>',
    'ImportSource' => [
        'S3' => [
            'S3BucketAccessRoleArn' => '<string>',
            'S3BucketRegion' => '<string>',
            'S3LocationUri' => '<string>',
        ],
    ],
    'ImportStatistics' => [
        'EventsCompleted' => <integer>,
        'FailedEntries' => <integer>,
        'FilesCompleted' => <integer>,
        'PrefixesCompleted' => <integer>,
        'PrefixesFound' => <integer>,
    ],
    'ImportStatus' => 'INITIALIZING|IN_PROGRESS|FAILED|STOPPED|COMPLETED',
    'StartEventTime' => <DateTime>,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's creation.

Destinations
Type: Array of strings

The ARN of the destination event data store.

EndEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

ImportId
Type: string

The ID of the import.

ImportSource
Type: ImportSource structure

The source S3 bucket.

ImportStatistics
Type: ImportStatistics structure

Provides statistics for the import. CloudTrail does not update import statistics in real-time. Returned values for parameters such as EventsCompleted may be lower than the actual value, because CloudTrail updates statistics incrementally over the course of the import.

ImportStatus
Type: string

The status of the import.

StartEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of when the import was updated.

Errors

ImportNotFoundException:

The specified import was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

GetInsightSelectors

$result = $client->getInsightSelectors([/* ... */]);
$promise = $client->getInsightSelectorsAsync([/* ... */]);

Describes the settings for the Insights event selectors that you configured for your trail or event data store. GetInsightSelectors shows if CloudTrail Insights event logging is enabled on the trail or event data store, and if it is, which Insights types are enabled. If you run GetInsightSelectors on a trail or event data store that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException

Specify either the EventDataStore parameter to get Insights event selectors for an event data store, or the TrailName parameter to the get Insights event selectors for a trail. You cannot specify these parameters together.

For more information, see Logging CloudTrail Insights events in the CloudTrail User Guide.

Parameter Syntax

$result = $client->getInsightSelectors([
    'EventDataStore' => '<string>',
    'TrailName' => '<string>',
]);

Parameter Details

Members
EventDataStore
Type: string

Specifies the ARN (or ID suffix of the ARN) of the event data store for which you want to get Insights selectors.

You cannot use this parameter with the TrailName parameter.

TrailName
Type: string

Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

If you specify a trail ARN, it must be in the format:

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

You cannot use this parameter with the EventDataStore parameter.

Result Syntax

[
    'EventDataStoreArn' => '<string>',
    'InsightSelectors' => [
        [
            'InsightType' => 'ApiCallRateInsight|ApiErrorRateInsight',
        ],
        // ...
    ],
    'InsightsDestination' => '<string>',
    'TrailARN' => '<string>',
]

Result Details

Members
EventDataStoreArn
Type: string

The ARN of the source event data store that enabled Insights events.

InsightSelectors
Type: Array of InsightSelector structures

A JSON string that contains the Insight types you want to log on a trail or event data store. ApiErrorRateInsight and ApiCallRateInsight are supported as Insights types.

InsightsDestination
Type: string

The ARN of the destination event data store that logs Insights events.

TrailARN
Type: string

The Amazon Resource Name (ARN) of a trail for which you want to get Insights selectors.

Errors

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidParameterCombinationException:

This exception is thrown when the combination of parameters provided is not valid.

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

InsightNotEnabledException:

If you run GetInsightSelectors on a trail or event data store that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

GetQueryResults

$result = $client->getQueryResults([/* ... */]);
$promise = $client->getQueryResultsAsync([/* ... */]);

Gets event data results of a query. You must specify the QueryID value returned by the StartQuery operation.

Parameter Syntax

$result = $client->getQueryResults([
    'EventDataStore' => '<string>',
    'MaxQueryResults' => <integer>,
    'NextToken' => '<string>',
    'QueryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Type: string

The ARN (or ID suffix of the ARN) of the event data store against which the query was run.

MaxQueryResults
Type: int

The maximum number of query results to display on a single page.

NextToken
Type: string

A token you can use to get the next page of query results.

QueryId
Required: Yes
Type: string

The ID of the query for which you want to get results.

Result Syntax

[
    'ErrorMessage' => '<string>',
    'NextToken' => '<string>',
    'QueryResultRows' => [
        [
            ['<string>', ...],
            // ...
        ],
        // ...
    ],
    'QueryStatistics' => [
        'BytesScanned' => <integer>,
        'ResultsCount' => <integer>,
        'TotalResultsCount' => <integer>,
    ],
    'QueryStatus' => 'QUEUED|RUNNING|FINISHED|FAILED|CANCELLED|TIMED_OUT',
]

Result Details

Members
ErrorMessage
Type: string

The error message returned if a query failed.

NextToken
Type: string

A token you can use to get the next page of query results.

QueryResultRows
Type: Array of lists

Contains the individual event results of the query.

QueryStatistics
Type: QueryStatistics structure

Shows the count of query results.

QueryStatus
Type: string

The status of the query. Values include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidMaxResultsException:

This exception is thrown if the limit specified is not valid.

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

InvalidParameterException:

The request includes a parameter that is not valid.

QueryIdNotFoundException:

The query ID does not exist or does not map to a query.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

GetResourcePolicy

$result = $client->getResourcePolicy([/* ... */]);
$promise = $client->getResourcePolicyAsync([/* ... */]);

Retrieves the JSON text of the resource-based policy document attached to the CloudTrail channel.

Parameter Syntax

$result = $client->getResourcePolicy([
    'ResourceArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the CloudTrail channel attached to the resource-based policy. The following is the format of a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

Result Syntax

[
    'ResourceArn' => '<string>',
    'ResourcePolicy' => '<string>',
]

Result Details

Members
ResourceArn
Type: string

The Amazon Resource Name (ARN) of the CloudTrail channel attached to resource-based policy.

ResourcePolicy
Type: string

A JSON-formatted string that contains the resource-based policy attached to the CloudTrail channel.

Errors

ResourceARNNotValidException:

This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid. The following is the valid format for a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

ResourcePolicyNotFoundException:

This exception is thrown when the specified resource policy is not found.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

GetTrail

$result = $client->getTrail([/* ... */]);
$promise = $client->getTrailAsync([/* ... */]);

Returns settings information for a specified trail.

Parameter Syntax

$result = $client->getTrail([
    'Name' => '<string>', // REQUIRED
]);

Parameter Details

Members
Name
Required: Yes
Type: string

The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information.

Result Syntax

[
    'Trail' => [
        'CloudWatchLogsLogGroupArn' => '<string>',
        'CloudWatchLogsRoleArn' => '<string>',
        'HasCustomEventSelectors' => true || false,
        'HasInsightSelectors' => true || false,
        'HomeRegion' => '<string>',
        'IncludeGlobalServiceEvents' => true || false,
        'IsMultiRegionTrail' => true || false,
        'IsOrganizationTrail' => true || false,
        'KmsKeyId' => '<string>',
        'LogFileValidationEnabled' => true || false,
        'Name' => '<string>',
        'S3BucketName' => '<string>',
        'S3KeyPrefix' => '<string>',
        'SnsTopicARN' => '<string>',
        'SnsTopicName' => '<string>',
        'TrailARN' => '<string>',
    ],
]

Result Details

Members
Trail
Type: Trail structure

The settings for a trail.

Errors

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

GetTrailStatus

$result = $client->getTrailStatus([/* ... */]);
$promise = $client->getTrailStatusAsync([/* ... */]);

Returns a JSON-formatted list of information about the specified trail. Fields include information on delivery errors, Amazon SNS and Amazon S3 errors, and start and stop logging times for each trail. This operation returns trail status from a single Region. To return trail status from all Regions, you must call the operation on each Region.

Parameter Syntax

$result = $client->getTrailStatus([
    'Name' => '<string>', // REQUIRED
]);

Parameter Details

Members
Name
Required: Yes
Type: string

Specifies the name or the CloudTrail ARN of the trail for which you are requesting status. To get the status of a shadow trail (a replication of the trail in another Region), you must specify its ARN. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[
    'IsLogging' => true || false,
    'LatestCloudWatchLogsDeliveryError' => '<string>',
    'LatestCloudWatchLogsDeliveryTime' => <DateTime>,
    'LatestDeliveryAttemptSucceeded' => '<string>',
    'LatestDeliveryAttemptTime' => '<string>',
    'LatestDeliveryError' => '<string>',
    'LatestDeliveryTime' => <DateTime>,
    'LatestDigestDeliveryError' => '<string>',
    'LatestDigestDeliveryTime' => <DateTime>,
    'LatestNotificationAttemptSucceeded' => '<string>',
    'LatestNotificationAttemptTime' => '<string>',
    'LatestNotificationError' => '<string>',
    'LatestNotificationTime' => <DateTime>,
    'StartLoggingTime' => <DateTime>,
    'StopLoggingTime' => <DateTime>,
    'TimeLoggingStarted' => '<string>',
    'TimeLoggingStopped' => '<string>',
]

Result Details

Members
IsLogging
Type: boolean

Whether the CloudTrail trail is currently logging Amazon Web Services API calls.

LatestCloudWatchLogsDeliveryError
Type: string

Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs.

LatestCloudWatchLogsDeliveryTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs.

LatestDeliveryAttemptSucceeded
Type: string

This field is no longer in use.

LatestDeliveryAttemptTime
Type: string

This field is no longer in use.

LatestDeliveryError
Type: string

Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver log files to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference.

This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, fix the bucket policy so that CloudTrail can write to the bucket; or create a new bucket and call UpdateTrail to specify the new bucket.

LatestDeliveryTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies the date and time that CloudTrail last delivered log files to an account's Amazon S3 bucket.

LatestDigestDeliveryError
Type: string

Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver a digest file to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference.

This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, fix the bucket policy so that CloudTrail can write to the bucket; or create a new bucket and call UpdateTrail to specify the new bucket.

LatestDigestDeliveryTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies the date and time that CloudTrail last delivered a digest file to an account's Amazon S3 bucket.

LatestNotificationAttemptSucceeded
Type: string

This field is no longer in use.

LatestNotificationAttemptTime
Type: string

This field is no longer in use.

LatestNotificationError
Type: string

Displays any Amazon SNS error that CloudTrail encountered when attempting to send a notification. For more information about Amazon SNS errors, see the Amazon SNS Developer Guide.

LatestNotificationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies the date and time of the most recent Amazon SNS notification that CloudTrail has written a new log file to an account's Amazon S3 bucket.

StartLoggingTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies the most recent date and time when CloudTrail started recording API calls for an Amazon Web Services account.

StopLoggingTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies the most recent date and time when CloudTrail stopped recording API calls for an Amazon Web Services account.

TimeLoggingStarted
Type: string

This field is no longer in use.

TimeLoggingStopped
Type: string

This field is no longer in use.

Errors

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

ListChannels

$result = $client->listChannels([/* ... */]);
$promise = $client->listChannelsAsync([/* ... */]);

Lists the channels in the current account, and their source names.

Parameter Syntax

$result = $client->listChannels([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of CloudTrail channels to display on a single page.

NextToken
Type: string

The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Result Syntax

[
    'Channels' => [
        [
            'ChannelArn' => '<string>',
            'Name' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Channels
Type: Array of Channel structures

The list of channels in the account.

NextToken
Type: string

The token to use to get the next page of results after a previous API call.

Errors

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

ListEventDataStores

$result = $client->listEventDataStores([/* ... */]);
$promise = $client->listEventDataStoresAsync([/* ... */]);

Returns information about all event data stores in the account, in the current Region.

Parameter Syntax

$result = $client->listEventDataStores([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of event data stores to display on a single page.

NextToken
Type: string

A token you can use to get the next page of event data store results.

Result Syntax

[
    'EventDataStores' => [
        [
            'AdvancedEventSelectors' => [
                [
                    'FieldSelectors' => [
                        [
                            'EndsWith' => ['<string>', ...],
                            'Equals' => ['<string>', ...],
                            'Field' => '<string>',
                            'NotEndsWith' => ['<string>', ...],
                            'NotEquals' => ['<string>', ...],
                            'NotStartsWith' => ['<string>', ...],
                            'StartsWith' => ['<string>', ...],
                        ],
                        // ...
                    ],
                    'Name' => '<string>',
                ],
                // ...
            ],
            'CreatedTimestamp' => <DateTime>,
            'EventDataStoreArn' => '<string>',
            'MultiRegionEnabled' => true || false,
            'Name' => '<string>',
            'OrganizationEnabled' => true || false,
            'RetentionPeriod' => <integer>,
            'Status' => 'CREATED|ENABLED|PENDING_DELETION|STARTING_INGESTION|STOPPING_INGESTION|STOPPED_INGESTION',
            'TerminationProtectionEnabled' => true || false,
            'UpdatedTimestamp' => <DateTime>,
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
EventDataStores
Type: Array of EventDataStore structures

Contains information about event data stores in the account, in the current Region.

NextToken
Type: string

A token you can use to get the next page of results.

Errors

InvalidMaxResultsException:

This exception is thrown if the limit specified is not valid.

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ListImportFailures

$result = $client->listImportFailures([/* ... */]);
$promise = $client->listImportFailuresAsync([/* ... */]);

Returns a list of failures for the specified import.

Parameter Syntax

$result = $client->listImportFailures([
    'ImportId' => '<string>', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
ImportId
Required: Yes
Type: string

The ID of the import.

MaxResults
Type: int

The maximum number of failures to display on a single page.

NextToken
Type: string

A token you can use to get the next page of import failures.

Result Syntax

[
    'Failures' => [
        [
            'ErrorMessage' => '<string>',
            'ErrorType' => '<string>',
            'LastUpdatedTime' => <DateTime>,
            'Location' => '<string>',
            'Status' => 'FAILED|RETRY|SUCCEEDED',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Failures
Type: Array of ImportFailureListItem structures

Contains information about the import failures.

NextToken
Type: string

A token you can use to get the next page of results.

Errors

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

InvalidParameterException:

The request includes a parameter that is not valid.

ListImports

$result = $client->listImports([/* ... */]);
$promise = $client->listImportsAsync([/* ... */]);

Returns information on all imports, or a select set of imports by ImportStatus or Destination.

Parameter Syntax

$result = $client->listImports([
    'Destination' => '<string>',
    'ImportStatus' => 'INITIALIZING|IN_PROGRESS|FAILED|STOPPED|COMPLETED',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
Destination
Type: string

The ARN of the destination event data store.

ImportStatus
Type: string

The status of the import.

MaxResults
Type: int

The maximum number of imports to display on a single page.

NextToken
Type: string

A token you can use to get the next page of import results.

Result Syntax

[
    'Imports' => [
        [
            'CreatedTimestamp' => <DateTime>,
            'Destinations' => ['<string>', ...],
            'ImportId' => '<string>',
            'ImportStatus' => 'INITIALIZING|IN_PROGRESS|FAILED|STOPPED|COMPLETED',
            'UpdatedTimestamp' => <DateTime>,
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Imports
Type: Array of ImportsListItem structures

The list of returned imports.

NextToken
Type: string

A token you can use to get the next page of import results.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

ListInsightsMetricData

$result = $client->listInsightsMetricData([/* ... */]);
$promise = $client->listInsightsMetricDataAsync([/* ... */]);

Returns Insights metrics data for trails that have enabled Insights. The request must include the EventSource, EventName, and InsightType parameters.

If the InsightType is set to ApiErrorRateInsight, the request must also include the ErrorCode parameter.

The following are the available time periods for ListInsightsMetricData. Each cutoff is inclusive.

  • Data points with a period of 60 seconds (1-minute) are available for 15 days.

  • Data points with a period of 300 seconds (5-minute) are available for 63 days.

  • Data points with a period of 3600 seconds (1 hour) are available for 90 days.

Access to the ListInsightsMetricData API operation is linked to the cloudtrail:LookupEvents action. To use this operation, you must have permissions to perform the cloudtrail:LookupEvents action.

Parameter Syntax

$result = $client->listInsightsMetricData([
    'DataType' => 'FillWithZeros|NonZeroData',
    'EndTime' => <integer || string || DateTime>,
    'ErrorCode' => '<string>',
    'EventName' => '<string>', // REQUIRED
    'EventSource' => '<string>', // REQUIRED
    'InsightType' => 'ApiCallRateInsight|ApiErrorRateInsight', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'Period' => <integer>,
    'StartTime' => <integer || string || DateTime>,
]);

Parameter Details

Members
DataType
Type: string

Type of datapoints to return. Valid values are NonZeroData and FillWithZeros. The default is NonZeroData.

EndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies, in UTC, the end time for time-series data. The value specified is exclusive; results include data points up to the specified time stamp.

The default is the time of request.

ErrorCode
Type: string

Conditionally required if the InsightType parameter is set to ApiErrorRateInsight.

If returning metrics for the ApiErrorRateInsight Insights type, this is the error to retrieve data for. For example, AccessDenied.

EventName
Required: Yes
Type: string

The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.

EventSource
Required: Yes
Type: string

The Amazon Web Services service to which the request was made, such as iam.amazonaws.com or s3.amazonaws.com.

InsightType
Required: Yes
Type: string

The type of CloudTrail Insights event, which is either ApiCallRateInsight or ApiErrorRateInsight. The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes.

MaxResults
Type: int

The maximum number of datapoints to return. Valid values are integers from 1 to 21600. The default value is 21600.

NextToken
Type: string

Returned if all datapoints can't be returned in a single call. For example, due to reaching MaxResults.

Add this parameter to the request to continue retrieving results starting from the last evaluated point.

Period
Type: int

Granularity of data to retrieve, in seconds. Valid values are 60, 300, and 3600. If you specify any other value, you will get an error. The default is 3600 seconds.

StartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies, in UTC, the start time for time-series data. The value specified is inclusive; results include data points with the specified time stamp.

The default is 90 days before the time of request.

Result Syntax

[
    'ErrorCode' => '<string>',
    'EventName' => '<string>',
    'EventSource' => '<string>',
    'InsightType' => 'ApiCallRateInsight|ApiErrorRateInsight',
    'NextToken' => '<string>',
    'Timestamps' => [<DateTime>, ...],
    'Values' => [<float>, ...],
]

Result Details

Members
ErrorCode
Type: string

Only returned if InsightType parameter was set to ApiErrorRateInsight.

If returning metrics for the ApiErrorRateInsight Insights type, this is the error to retrieve data for. For example, AccessDenied.

EventName
Type: string

The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.

EventSource
Type: string

The Amazon Web Services service to which the request was made, such as iam.amazonaws.com or s3.amazonaws.com.

InsightType
Type: string

The type of CloudTrail Insights event, which is either ApiCallRateInsight or ApiErrorRateInsight. The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes.

NextToken
Type: string

Only returned if the full results could not be returned in a single query. You can set the NextToken parameter in the next request to this value to continue retrieval.

Timestamps
Type: Array of timestamp (string|DateTime or anything parsable by strtotime)s

List of timestamps at intervals corresponding to the specified time period.

Values
Type: Array of doubles

List of values representing the API call rate or error rate at each timestamp. The number of values is equal to the number of timestamps.

Errors

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

ListPublicKeys

$result = $client->listPublicKeys([/* ... */]);
$promise = $client->listPublicKeysAsync([/* ... */]);

Returns all public keys whose private keys were used to sign the digest files within the specified time range. The public key is needed to validate digest files that were signed with its corresponding private key.

CloudTrail uses different private and public key pairs per Region. Each digest file is signed with a private key unique to its Region. When you validate a digest file from a specific Region, you must look in the same Region for its corresponding public key.

Parameter Syntax

$result = $client->listPublicKeys([
    'EndTime' => <integer || string || DateTime>,
    'NextToken' => '<string>',
    'StartTime' => <integer || string || DateTime>,
]);

Parameter Details

Members
EndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.

NextToken
Type: string

Reserved for future use.

StartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.

Result Syntax

[
    'NextToken' => '<string>',
    'PublicKeyList' => [
        [
            'Fingerprint' => '<string>',
            'ValidityEndTime' => <DateTime>,
            'ValidityStartTime' => <DateTime>,
            'Value' => <string || resource || Psr\Http\Message\StreamInterface>,
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

Reserved for future use.

PublicKeyList
Type: Array of PublicKey structures

Contains an array of PublicKey objects.

The returned public keys may have validity time ranges that overlap.

Errors

InvalidTimeRangeException:

Occurs if the timestamp values are not valid. Either the start time occurs after the end time, or the time range is outside the range of possible values.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

InvalidTokenException:

Reserved for future use.

ListQueries

$result = $client->listQueries([/* ... */]);
$promise = $client->listQueriesAsync([/* ... */]);

Returns a list of queries and query statuses for the past seven days. You must specify an ARN value for EventDataStore. Optionally, to shorten the list of results, you can specify a time range, formatted as timestamps, by adding StartTime and EndTime parameters, and a QueryStatus value. Valid values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

Parameter Syntax

$result = $client->listQueries([
    'EndTime' => <integer || string || DateTime>,
    'EventDataStore' => '<string>', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'QueryStatus' => 'QUEUED|RUNNING|FINISHED|FAILED|CANCELLED|TIMED_OUT',
    'StartTime' => <integer || string || DateTime>,
]);

Parameter Details

Members
EndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Use with StartTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.

EventDataStore
Required: Yes
Type: string

The ARN (or the ID suffix of the ARN) of an event data store on which queries were run.

MaxResults
Type: int

The maximum number of queries to show on a page.

NextToken
Type: string

A token you can use to get the next page of results.

QueryStatus
Type: string

The status of queries that you want to return in results. Valid values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

StartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Use with EndTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.

Result Syntax

[
    'NextToken' => '<string>',
    'Queries' => [
        [
            'CreationTime' => <DateTime>,
            'QueryId' => '<string>',
            'QueryStatus' => 'QUEUED|RUNNING|FINISHED|FAILED|CANCELLED|TIMED_OUT',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A token you can use to get the next page of results.

Queries
Type: Array of Query structures

Lists matching query results, and shows query ID, status, and creation time of each query.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidDateRangeException:

A date range for the query was specified that is not valid. Be sure that the start time is chronologically before the end time. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.

InvalidMaxResultsException:

This exception is thrown if the limit specified is not valid.

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidQueryStatusException:

The query status is not valid for the operation.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ListTags

$result = $client->listTags([/* ... */]);
$promise = $client->listTagsAsync([/* ... */]);

Lists the tags for the specified trails, event data stores, or channels in the current Region.

Parameter Syntax

$result = $client->listTags([
    'NextToken' => '<string>',
    'ResourceIdList' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
NextToken
Type: string

Reserved for future use.

ResourceIdList
Required: Yes
Type: Array of strings

Specifies a list of trail, event data store, or channel ARNs whose tags will be listed. The list has a limit of 20 ARNs.

Example trail ARN format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

Result Syntax

[
    'NextToken' => '<string>',
    'ResourceTagList' => [
        [
            'ResourceId' => '<string>',
            'TagsList' => [
                [
                    'Key' => '<string>',
                    'Value' => '<string>',
                ],
                // ...
            ],
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

Reserved for future use.

ResourceTagList
Type: Array of ResourceTag structures

A list of resource tags.

Errors

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

InactiveEventDataStoreException:

The event data store is inactive.

EventDataStoreNotFoundException:

The specified event data store was not found.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

InvalidTokenException:

Reserved for future use.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ListTrails

$result = $client->listTrails([/* ... */]);
$promise = $client->listTrailsAsync([/* ... */]);

Lists trails that are in the current account.

Parameter Syntax

$result = $client->listTrails([
    'NextToken' => '<string>',
]);

Parameter Details

Members
NextToken
Type: string

The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Result Syntax

[
    'NextToken' => '<string>',
    'Trails' => [
        [
            'HomeRegion' => '<string>',
            'Name' => '<string>',
            'TrailARN' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Trails
Type: Array of TrailInfo structures

Returns the name, ARN, and home Region of trails in the current account.

Errors

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

LookupEvents

$result = $client->lookupEvents([/* ... */]);
$promise = $client->lookupEventsAsync([/* ... */]);

Looks up management events or CloudTrail Insights events that are captured by CloudTrail. You can look up events that occurred in a Region within the last 90 days.

LookupEvents returns recent Insights events for trails that enable Insights. To view Insights events for an event data store, you can run queries on your Insights event data store, and you can also view the Lake dashboard for Insights.

Lookup supports the following attributes for management events:

  • Amazon Web Services access key

  • Event ID

  • Event name

  • Event source

  • Read only

  • Resource name

  • Resource type

  • User name

Lookup supports the following attributes for Insights events:

  • Event ID

  • Event name

  • Event source

All attributes are optional. The default number of results returned is 50, with a maximum of 50 possible. The response includes a token that you can use to get the next page of results.

The rate of lookup requests is limited to two per second, per account, per Region. If this limit is exceeded, a throttling error occurs.

Parameter Syntax

$result = $client->lookupEvents([
    'EndTime' => <integer || string || DateTime>,
    'EventCategory' => 'insight',
    'LookupAttributes' => [
        [
            'AttributeKey' => 'EventId|EventName|ReadOnly|Username|ResourceType|ResourceName|EventSource|AccessKeyId', // REQUIRED
            'AttributeValue' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'StartTime' => <integer || string || DateTime>,
]);

Parameter Details

Members
EndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned.

EventCategory
Type: string

Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify insight as the value of EventCategory, no Insights events are returned.

LookupAttributes
Type: Array of LookupAttribute structures

Contains a list of lookup attributes. Currently the list can contain only one item.

MaxResults
Type: int

The number of events to return. Possible values are 1 through 50. The default is 50.

NextToken
Type: string

The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

StartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned.

Result Syntax

[
    'Events' => [
        [
            'AccessKeyId' => '<string>',
            'CloudTrailEvent' => '<string>',
            'EventId' => '<string>',
            'EventName' => '<string>',
            'EventSource' => '<string>',
            'EventTime' => <DateTime>,
            'ReadOnly' => '<string>',
            'Resources' => [
                [
                    'ResourceName' => '<string>',
                    'ResourceType' => '<string>',
                ],
                // ...
            ],
            'Username' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
Events
Type: Array of Event structures

A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.

NextToken
Type: string

The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Errors

InvalidLookupAttributesException:

Occurs when a lookup attribute is specified that is not valid.

InvalidTimeRangeException:

Occurs if the timestamp values are not valid. Either the start time occurs after the end time, or the time range is outside the range of possible values.

InvalidMaxResultsException:

This exception is thrown if the limit specified is not valid.

InvalidNextTokenException:

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

InvalidEventCategoryException:

Occurs if an event category that is not valid is specified as a value of EventCategory.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

PutEventSelectors

$result = $client->putEventSelectors([/* ... */]);
$promise = $client->putEventSelectorsAsync([/* ... */]);

Configures an event selector or advanced event selectors for your trail. Use event selectors or advanced event selectors to specify management and data event settings for your trail. If you want your trail to log Insights events, be sure the event selector enables logging of the Insights event types you want configured for your trail. For more information about logging Insights events, see Logging Insights events in the CloudTrail User Guide. By default, trails created without specific event selectors are configured to log all read and write management events, and no data events.

When an event occurs in your account, CloudTrail evaluates the event selectors or advanced event selectors in all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.

Example

  1. You create an event selector for a trail and specify that you want write-only events.

  2. The EC2 GetConsoleOutput and RunInstances API operations occur in your account.

  3. CloudTrail evaluates whether the events match your event selectors.

  4. The RunInstances is a write-only event and it matches your event selector. The trail logs the event.

  5. The GetConsoleOutput is a read-only event that doesn't match your event selector. The trail doesn't log the event.

The PutEventSelectors operation must be called from the Region in which the trail was created; otherwise, an InvalidHomeRegionException exception is thrown.

You can configure up to five event selectors for each trail. For more information, see Logging management events, Logging data events, and Quotas in CloudTrail in the CloudTrail User Guide.

You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors, but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events in the CloudTrail User Guide.

Parameter Syntax

$result = $client->putEventSelectors([
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [ // REQUIRED
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>', // REQUIRED
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'EventSelectors' => [
        [
            'DataResources' => [
                [
                    'Type' => '<string>',
                    'Values' => ['<string>', ...],
                ],
                // ...
            ],
            'ExcludeManagementEventSources' => ['<string>', ...],
            'IncludeManagementEvents' => true || false,
            'ReadWriteType' => 'ReadOnly|WriteOnly|All',
        ],
        // ...
    ],
    'TrailName' => '<string>', // REQUIRED
]);

Parameter Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

Specifies the settings for advanced event selectors. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors, but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events in the CloudTrail User Guide.

EventSelectors
Type: Array of EventSelector structures

Specifies the settings for your event selectors. You can configure up to five event selectors for a trail. You can use either EventSelectors or AdvancedEventSelectors in a PutEventSelectors request, but not both. If you apply EventSelectors to a trail, any existing AdvancedEventSelectors are overwritten.

TrailName
Required: Yes
Type: string

Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

If you specify a trail ARN, it must be in the following format.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'EventSelectors' => [
        [
            'DataResources' => [
                [
                    'Type' => '<string>',
                    'Values' => ['<string>', ...],
                ],
                // ...
            ],
            'ExcludeManagementEventSources' => ['<string>', ...],
            'IncludeManagementEvents' => true || false,
            'ReadWriteType' => 'ReadOnly|WriteOnly|All',
        ],
        // ...
    ],
    'TrailARN' => '<string>',
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

Specifies the advanced event selectors configured for your trail.

EventSelectors
Type: Array of EventSelector structures

Specifies the event selectors configured for your trail.

TrailARN
Type: string

Specifies the ARN of the trail that was updated with event selectors. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Errors

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

InvalidEventSelectorsException:

This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250.

You can:

  • Specify a valid number of event selectors (1 to 5) for a trail.

  • Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.

  • Specify up to 500 values for all conditions in all advanced event selectors for a trail.

  • Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

PutInsightSelectors

$result = $client->putInsightSelectors([/* ... */]);
$promise = $client->putInsightSelectorsAsync([/* ... */]);

Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail or event data store. You also use PutInsightSelectors to turn off Insights event logging, by passing an empty list of Insights types. The valid Insights event types are ApiErrorRateInsight and ApiCallRateInsight.

To enable Insights on an event data store, you must specify the ARNs (or ID suffix of the ARNs) for the source event data store (EventDataStore) and the destination event data store (InsightsDestination). The source event data store logs management events and enables Insights. The destination event data store logs Insights events based upon the management event activity of the source event data store. The source and destination event data stores must belong to the same Amazon Web Services account.

To log Insights events for a trail, you must specify the name (TrailName) of the CloudTrail trail for which you want to change or add Insights selectors.

To log CloudTrail Insights events on API call volume, the trail or event data store must log write management events. To log CloudTrail Insights events on API error rate, the trail or event data store must log read or write management events. You can call GetEventSelectors on a trail to check whether the trail logs management events. You can call GetEventDataStore on an event data store to check whether the event data store logs management events.

For more information, see Logging CloudTrail Insights events in the CloudTrail User Guide.

Parameter Syntax

$result = $client->putInsightSelectors([
    'EventDataStore' => '<string>',
    'InsightSelectors' => [ // REQUIRED
        [
            'InsightType' => 'ApiCallRateInsight|ApiErrorRateInsight',
        ],
        // ...
    ],
    'InsightsDestination' => '<string>',
    'TrailName' => '<string>',
]);

Parameter Details

Members
EventDataStore
Type: string

The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the EventDataStore and InsightsDestination parameters.

You cannot use this parameter with the TrailName parameter.

InsightSelectors
Required: Yes
Type: Array of InsightSelector structures

A JSON string that contains the Insights types you want to log on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types.

The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.

The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.

InsightsDestination
Type: string

The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the EventDataStore and InsightsDestination parameters.

You cannot use this parameter with the TrailName parameter.

TrailName
Type: string

The name of the CloudTrail trail for which you want to change or add Insights selectors.

You cannot use this parameter with the EventDataStore and InsightsDestination parameters.

Result Syntax

[
    'EventDataStoreArn' => '<string>',
    'InsightSelectors' => [
        [
            'InsightType' => 'ApiCallRateInsight|ApiErrorRateInsight',
        ],
        // ...
    ],
    'InsightsDestination' => '<string>',
    'TrailARN' => '<string>',
]

Result Details

Members
EventDataStoreArn
Type: string

The Amazon Resource Name (ARN) of the source event data store for which you want to change or add Insights selectors.

InsightSelectors
Type: Array of InsightSelector structures

A JSON string that contains the Insights event types that you want to log on a trail or event data store. The valid Insights types are ApiErrorRateInsight and ApiCallRateInsight.

InsightsDestination
Type: string

The ARN of the destination event data store that logs Insights events.

TrailARN
Type: string

The Amazon Resource Name (ARN) of a trail for which you want to change or add Insights selectors.

Errors

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidParameterCombinationException:

This exception is thrown when the combination of parameters provided is not valid.

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

InvalidInsightSelectorsException:

For PutInsightSelectors, this exception is thrown when the formatting or syntax of the InsightSelectors JSON statement is not valid, or the specified InsightType in the InsightSelectors statement is not valid. Valid values for InsightType are ApiCallRateInsight and ApiErrorRateInsight. To enable Insights on an event data store, the destination event data store specified by the InsightsDestination parameter must log Insights events and the source event data store specified by the EventDataStore parameter must log management events.

For UpdateEventDataStore, this exception is thrown if Insights are enabled on the event data store and the updated advanced event selectors are not compatible with the configured InsightSelectors. If the InsightSelectors includes an InsightType of ApiCallRateInsight, the source event data store must log write management events. If the InsightSelectors includes an InsightType of ApiErrorRateInsight, the source event data store must log management events.

InsufficientS3BucketPolicyException:

This exception is thrown when the policy on the S3 bucket is not sufficient.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

S3BucketDoesNotExistException:

This exception is thrown when the specified S3 bucket does not exist.

KmsException:

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

PutResourcePolicy

$result = $client->putResourcePolicy([/* ... */]);
$promise = $client->putResourcePolicyAsync([/* ... */]);

Attaches a resource-based permission policy to a CloudTrail channel that is used for an integration with an event source outside of Amazon Web Services. For more information about resource-based policies, see CloudTrail resource-based policy examples in the CloudTrail User Guide.

Parameter Syntax

$result = $client->putResourcePolicy([
    'ResourceArn' => '<string>', // REQUIRED
    'ResourcePolicy' => '<string>', // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the CloudTrail channel attached to the resource-based policy. The following is the format of a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

ResourcePolicy
Required: Yes
Type: string

A JSON-formatted string for an Amazon Web Services resource-based policy.

The following are requirements for the resource policy:

  • Contains only one action: cloudtrail-data:PutAuditEvents

  • Contains at least one statement. The policy can have a maximum of 20 statements.

  • Each statement contains at least one principal. A statement can have a maximum of 50 principals.

Result Syntax

[
    'ResourceArn' => '<string>',
    'ResourcePolicy' => '<string>',
]

Result Details

Members
ResourceArn
Type: string

The Amazon Resource Name (ARN) of the CloudTrail channel attached to the resource-based policy.

ResourcePolicy
Type: string

The JSON-formatted string of the Amazon Web Services resource-based policy attached to the CloudTrail channel.

Errors

ResourceARNNotValidException:

This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid. The following is the valid format for a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

ResourcePolicyNotValidException:

This exception is thrown when the resouce-based policy has syntax errors, or contains a principal that is not valid.

The following are requirements for the resource policy:

  • Contains only one action: cloudtrail-data:PutAuditEvents

  • Contains at least one statement. The policy can have a maximum of 20 statements.

  • Each statement contains at least one principal. A statement can have a maximum of 50 principals.

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

RegisterOrganizationDelegatedAdmin

$result = $client->registerOrganizationDelegatedAdmin([/* ... */]);
$promise = $client->registerOrganizationDelegatedAdminAsync([/* ... */]);

Registers an organization’s member account as the CloudTrail delegated administrator.

Parameter Syntax

$result = $client->registerOrganizationDelegatedAdmin([
    'MemberAccountId' => '<string>', // REQUIRED
]);

Parameter Details

Members
MemberAccountId
Required: Yes
Type: string

An organization member account ID that you want to designate as a delegated administrator.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

AccountRegisteredException:

This exception is thrown when the account is already registered as the CloudTrail delegated administrator.

AccountNotFoundException:

This exception is thrown when the specified account is not found or not part of an organization.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

InvalidParameterException:

The request includes a parameter that is not valid.

CannotDelegateManagementAccountException:

This exception is thrown when the management account of an organization is registered as the CloudTrail delegated administrator.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

DelegatedAdminAccountLimitExceededException:

This exception is thrown when the maximum number of CloudTrail delegated administrators is reached.

NotOrganizationManagementAccountException:

This exception is thrown when the account making the request is not the organization's management account.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

RemoveTags

$result = $client->removeTags([/* ... */]);
$promise = $client->removeTagsAsync([/* ... */]);

Removes the specified tags from a trail, event data store, or channel.

Parameter Syntax

$result = $client->removeTags([
    'ResourceId' => '<string>', // REQUIRED
    'TagsList' => [ // REQUIRED
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>',
        ],
        // ...
    ],
]);

Parameter Details

Members
ResourceId
Required: Yes
Type: string

Specifies the ARN of the trail, event data store, or channel from which tags should be removed.

Example trail ARN format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

TagsList
Required: Yes
Type: Array of Tag structures

Specifies a list of tags to be removed.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

This exception is thrown when the specified resource is not found.

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ResourceTypeNotSupportedException:

This exception is thrown when the specified resource type is not supported by CloudTrail.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

InvalidTagParameterException:

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

InactiveEventDataStoreException:

The event data store is inactive.

EventDataStoreNotFoundException:

The specified event data store was not found.

ChannelNotFoundException:

This exception is thrown when CloudTrail cannot find the specified channel.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

RestoreEventDataStore

$result = $client->restoreEventDataStore([/* ... */]);
$promise = $client->restoreEventDataStoreAsync([/* ... */]);

Restores a deleted event data store specified by EventDataStore, which accepts an event data store ARN. You can only restore a deleted event data store within the seven-day wait period after deletion. Restoring an event data store can take several minutes, depending on the size of the event data store.

Parameter Syntax

$result = $client->restoreEventDataStore([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or the ID suffix of the ARN) of the event data store that you want to restore.

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'CreatedTimestamp' => <DateTime>,
    'EventDataStoreArn' => '<string>',
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>',
    'OrganizationEnabled' => true || false,
    'RetentionPeriod' => <integer>,
    'Status' => 'CREATED|ENABLED|PENDING_DELETION|STARTING_INGESTION|STOPPING_INGESTION|STOPPED_INGESTION',
    'TerminationProtectionEnabled' => true || false,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that were used to select events.

BillingMode
Type: string

The billing mode for the event data store.

CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of an event data store's creation.

EventDataStoreArn
Type: string

The event data store ARN.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Indicates whether the event data store is collecting events from all Regions, or only from the Region in which the event data store was created.

Name
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Indicates whether an event data store is collecting logged events for an organization in Organizations.

RetentionPeriod
Type: int

The retention period, in days.

Status
Type: string

The status of the event data store.

TerminationProtectionEnabled
Type: boolean

Indicates that termination protection is enabled and the event data store cannot be automatically deleted.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp that shows when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

EventDataStoreMaxLimitExceededException:

Your account has used the maximum number of event data stores.

InvalidEventDataStoreStatusException:

The event data store is not in a status that supports the operation.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

StartEventDataStoreIngestion

$result = $client->startEventDataStoreIngestion([/* ... */]);
$promise = $client->startEventDataStoreIngestionAsync([/* ... */]);

Starts the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To start ingestion, the event data store Status must be STOPPED_INGESTION and the eventCategory must be Management, Data, or ConfigurationItem.

Parameter Syntax

$result = $client->startEventDataStoreIngestion([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or ID suffix of the ARN) of the event data store for which you want to start ingestion.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventDataStoreStatusException:

The event data store is not in a status that supports the operation.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidEventDataStoreCategoryException:

This exception is thrown when event categories of specified event data stores are not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

StartImport

$result = $client->startImport([/* ... */]);
$promise = $client->startImportAsync([/* ... */]);

Starts an import of logged trail events from a source S3 bucket to a destination event data store. By default, CloudTrail only imports events contained in the S3 bucket's CloudTrail prefix and the prefixes inside the CloudTrail prefix, and does not check prefixes for other Amazon Web Services services. If you want to import CloudTrail events contained in another prefix, you must include the prefix in the S3LocationUri. For more considerations about importing trail events, see Considerations for copying trail events in the CloudTrail User Guide.

When you start a new import, the Destinations and ImportSource parameters are required. Before starting a new import, disable any access control lists (ACLs) attached to the source S3 bucket. For more information about disabling ACLs, see Controlling ownership of objects and disabling ACLs for your bucket.

When you retry an import, the ImportID parameter is required.

If the destination event data store is for an organization, you must use the management account to import trail events. You cannot use the delegated administrator account for the organization.

Parameter Syntax

$result = $client->startImport([
    'Destinations' => ['<string>', ...],
    'EndEventTime' => <integer || string || DateTime>,
    'ImportId' => '<string>',
    'ImportSource' => [
        'S3' => [ // REQUIRED
            'S3BucketAccessRoleArn' => '<string>', // REQUIRED
            'S3BucketRegion' => '<string>', // REQUIRED
            'S3LocationUri' => '<string>', // REQUIRED
        ],
    ],
    'StartEventTime' => <integer || string || DateTime>,
]);

Parameter Details

Members
Destinations
Type: Array of strings

The ARN of the destination event data store. Use this parameter for a new import.

EndEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Use with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.

ImportId
Type: string

The ID of the import. Use this parameter when you are retrying an import.

ImportSource
Type: ImportSource structure

The source S3 bucket for the import. Use this parameter for a new import.

StartEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Use with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.

Result Syntax

[
    'CreatedTimestamp' => <DateTime>,
    'Destinations' => ['<string>', ...],
    'EndEventTime' => <DateTime>,
    'ImportId' => '<string>',
    'ImportSource' => [
        'S3' => [
            'S3BucketAccessRoleArn' => '<string>',
            'S3BucketRegion' => '<string>',
            'S3LocationUri' => '<string>',
        ],
    ],
    'ImportStatus' => 'INITIALIZING|IN_PROGRESS|FAILED|STOPPED|COMPLETED',
    'StartEventTime' => <DateTime>,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp for the import's creation.

Destinations
Type: Array of strings

The ARN of the destination event data store.

EndEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

ImportId
Type: string

The ID of the import.

ImportSource
Type: ImportSource structure

The source S3 bucket for the import.

ImportStatus
Type: string

Shows the status of the import after a StartImport request. An import finishes with a status of COMPLETED if there were no failures, or FAILED if there were failures.

StartEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's last update, if applicable.

Errors

AccountHasOngoingImportException:

This exception is thrown when you start a new import and a previous import is still in progress.

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventDataStoreStatusException:

The event data store is not in a status that supports the operation.

InvalidEventDataStoreCategoryException:

This exception is thrown when event categories of specified event data stores are not valid.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidImportSourceException:

This exception is thrown when the provided source S3 bucket is not valid for import.

ImportNotFoundException:

The specified import was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

StartLogging

$result = $client->startLogging([/* ... */]);
$promise = $client->startLoggingAsync([/* ... */]);

Starts the recording of Amazon Web Services API calls and log file delivery for a trail. For a trail that is enabled in all Regions, this operation must be called from the Region in which the trail was created. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions.

Parameter Syntax

$result = $client->startLogging([
    'Name' => '<string>', // REQUIRED
]);

Parameter Details

Members
Name
Required: Yes
Type: string

Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs Amazon Web Services API calls. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

StartQuery

$result = $client->startQuery([/* ... */]);
$promise = $client->startQueryAsync([/* ... */]);

Starts a CloudTrail Lake query. Use the QueryStatement parameter to provide your SQL query, enclosed in single quotation marks. Use the optional DeliveryS3Uri parameter to deliver the query results to an S3 bucket.

StartQuery requires you specify either the QueryStatement parameter, or a QueryAlias and any QueryParameters. In the current release, the QueryAlias and QueryParameters parameters are used only for the queries that populate the CloudTrail Lake dashboards.

Parameter Syntax

$result = $client->startQuery([
    'DeliveryS3Uri' => '<string>',
    'QueryAlias' => '<string>',
    'QueryParameters' => ['<string>', ...],
    'QueryStatement' => '<string>',
]);

Parameter Details

Members
DeliveryS3Uri
Type: string

The URI for the S3 bucket where CloudTrail delivers the query results.

QueryAlias
Type: string

The alias that identifies a query template.

QueryParameters
Type: Array of strings

The query parameters for the specified QueryAlias.

QueryStatement
Type: string

The SQL code of your query.

Result Syntax

[
    'QueryId' => '<string>',
]

Result Details

Members
QueryId
Type: string

The ID of the started query.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidQueryStatementException:

The query that was submitted has validation errors, or uses incorrect syntax or unsupported keywords. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.

MaxConcurrentQueriesException:

You are already running the maximum number of concurrent queries. The maximum number of concurrent queries is 10. Wait a minute for some queries to finish, and then run the query again.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

InvalidS3PrefixException:

This exception is thrown when the provided S3 prefix is not valid.

InvalidS3BucketNameException:

This exception is thrown when the provided S3 bucket name is not valid.

InsufficientS3BucketPolicyException:

This exception is thrown when the policy on the S3 bucket is not sufficient.

S3BucketDoesNotExistException:

This exception is thrown when the specified S3 bucket does not exist.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

StopEventDataStoreIngestion

$result = $client->stopEventDataStoreIngestion([/* ... */]);
$promise = $client->stopEventDataStoreIngestionAsync([/* ... */]);

Stops the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To stop ingestion, the event data store Status must be ENABLED and the eventCategory must be Management, Data, or ConfigurationItem.

Parameter Syntax

$result = $client->stopEventDataStoreIngestion([
    'EventDataStore' => '<string>', // REQUIRED
]);

Parameter Details

Members
EventDataStore
Required: Yes
Type: string

The ARN (or ID suffix of the ARN) of the event data store for which you want to stop ingestion.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventDataStoreStatusException:

The event data store is not in a status that supports the operation.

InvalidParameterException:

The request includes a parameter that is not valid.

InvalidEventDataStoreCategoryException:

This exception is thrown when event categories of specified event data stores are not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

StopImport

$result = $client->stopImport([/* ... */]);
$promise = $client->stopImportAsync([/* ... */]);

Stops a specified import.

Parameter Syntax

$result = $client->stopImport([
    'ImportId' => '<string>', // REQUIRED
]);

Parameter Details

Members
ImportId
Required: Yes
Type: string

The ID of the import.

Result Syntax

[
    'CreatedTimestamp' => <DateTime>,
    'Destinations' => ['<string>', ...],
    'EndEventTime' => <DateTime>,
    'ImportId' => '<string>',
    'ImportSource' => [
        'S3' => [
            'S3BucketAccessRoleArn' => '<string>',
            'S3BucketRegion' => '<string>',
            'S3LocationUri' => '<string>',
        ],
    ],
    'ImportStatistics' => [
        'EventsCompleted' => <integer>,
        'FailedEntries' => <integer>,
        'FilesCompleted' => <integer>,
        'PrefixesCompleted' => <integer>,
        'PrefixesFound' => <integer>,
    ],
    'ImportStatus' => 'INITIALIZING|IN_PROGRESS|FAILED|STOPPED|COMPLETED',
    'StartEventTime' => <DateTime>,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's creation.

Destinations
Type: Array of strings

The ARN of the destination event data store.

EndEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

ImportId
Type: string

The ID for the import.

ImportSource
Type: ImportSource structure

The source S3 bucket for the import.

ImportStatistics
Type: ImportStatistics structure

Returns information on the stopped import.

ImportStatus
Type: string

The status of the import.

StartEventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's last update.

Errors

ImportNotFoundException:

The specified import was not found.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

StopLogging

$result = $client->stopLogging([/* ... */]);
$promise = $client->stopLoggingAsync([/* ... */]);

Suspends the recording of Amazon Web Services API calls and log file delivery for the specified trail. Under most circumstances, there is no need to use this action. You can update a trail without stopping it first. This action is the only way to stop recording. For a trail enabled in all Regions, this operation must be called from the Region in which the trail was created, or an InvalidHomeRegionException will occur. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail enabled in all Regions.

Parameter Syntax

$result = $client->stopLogging([
    'Name' => '<string>', // REQUIRED
]);

Parameter Details

Members
Name
Required: Yes
Type: string

Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging Amazon Web Services API calls. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

UpdateChannel

$result = $client->updateChannel([/* ... */]);
$promise = $client->updateChannelAsync([/* ... */]);

Updates a channel specified by a required channel ARN or UUID.

Parameter Syntax

$result = $client->updateChannel([
    'Channel' => '<string>', // REQUIRED
    'Destinations' => [
        [
            'Location' => '<string>', // REQUIRED
            'Type' => 'EVENT_DATA_STORE|AWS_SERVICE', // REQUIRED
        ],
        // ...
    ],
    'Name' => '<string>',
]);

Parameter Details

Members
Channel
Required: Yes
Type: string

The ARN or ID (the ARN suffix) of the channel that you want to update.

Destinations
Type: Array of Destination structures

The ARNs of event data stores that you want to log events arriving through the channel.

Name
Type: string

Changes the name of the channel.

Result Syntax

[
    'ChannelArn' => '<string>',
    'Destinations' => [
        [
            'Location' => '<string>',
            'Type' => 'EVENT_DATA_STORE|AWS_SERVICE',
        ],
        // ...
    ],
    'Name' => '<string>',
    'Source' => '<string>',
]

Result Details

Members
ChannelArn
Type: string

The ARN of the channel that was updated.

Destinations
Type: Array of Destination structures

The event data stores that log events arriving through the channel.

Name
Type: string

The name of the channel that was updated.

Source
Type: string

The event source of the channel that was updated.

Errors

ChannelARNInvalidException:

This exception is thrown when the specified value of ChannelARN is not valid.

ChannelNotFoundException:

This exception is thrown when CloudTrail cannot find the specified channel.

ChannelAlreadyExistsException:

This exception is thrown when the provided channel already exists.

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventDataStoreCategoryException:

This exception is thrown when event categories of specified event data stores are not valid.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

UpdateEventDataStore

$result = $client->updateEventDataStore([/* ... */]);
$promise = $client->updateEventDataStoreAsync([/* ... */]);

Updates an event data store. The required EventDataStore value is an ARN or the ID portion of the ARN. Other parameters are optional, but at least one optional parameter must be specified, or CloudTrail throws an error. RetentionPeriod is in days, and valid values are integers between 7 and 3653 if the BillingMode is set to EXTENDABLE_RETENTION_PRICING, or between 7 and 2557 if BillingMode is set to FIXED_RETENTION_PRICING. By default, TerminationProtection is enabled.

For event data stores for CloudTrail events, AdvancedEventSelectors includes or excludes management or data events in your event data store. For more information about AdvancedEventSelectors, see AdvancedEventSelectors.

For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or non-Amazon Web Services events, AdvancedEventSelectors includes events of that type in your event data store.

Parameter Syntax

$result = $client->updateEventDataStore([
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [ // REQUIRED
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>', // REQUIRED
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'EventDataStore' => '<string>', // REQUIRED
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>',
    'OrganizationEnabled' => true || false,
    'RetentionPeriod' => <integer>,
    'TerminationProtectionEnabled' => true || false,
]);

Parameter Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors used to select events for the event data store. You can configure up to five advanced event selectors for each event data store.

BillingMode
Type: string

You can't change the billing mode from EXTENDABLE_RETENTION_PRICING to FIXED_RETENTION_PRICING. If BillingMode is set to EXTENDABLE_RETENTION_PRICING and you want to use FIXED_RETENTION_PRICING instead, you'll need to stop ingestion on the event data store and create a new event data store that uses FIXED_RETENTION_PRICING.

The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store.

The following are the possible values:

  • EXTENDABLE_RETENTION_PRICING - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days.

  • FIXED_RETENTION_PRICING - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days.

For more information about CloudTrail pricing, see CloudTrail Pricing and Managing CloudTrail Lake costs.

EventDataStore
Required: Yes
Type: string

The ARN (or the ID suffix of the ARN) of the event data store that you want to update.

KmsKeyId
Type: string

Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.

CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

Examples:

  • alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

  • 12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Specifies whether an event data store collects events from all Regions, or only from the Region in which it was created.

Name
Type: string

The event data store name.

OrganizationEnabled
Type: boolean

Specifies whether an event data store collects events logged for an organization in Organizations.

Only the management account for the organization can convert an organization event data store to a non-organization event data store, or convert a non-organization event data store to an organization event data store.

RetentionPeriod
Type: int

The retention period of the event data store, in days. If BillingMode is set to EXTENDABLE_RETENTION_PRICING, you can set a retention period of up to 3653 days, the equivalent of 10 years. If BillingMode is set to FIXED_RETENTION_PRICING, you can set a retention period of up to 2557 days, the equivalent of seven years.

CloudTrail Lake determines whether to retain an event by checking if the eventTime of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the eventTime is older than 90 days.

If you decrease the retention period of an event data store, CloudTrail will remove any events with an eventTime older than the new retention period. For example, if the previous retention period was 365 days and you decrease it to 100 days, CloudTrail will remove events with an eventTime older than 100 days.

TerminationProtectionEnabled
Type: boolean

Indicates that termination protection is enabled and the event data store cannot be automatically deleted.

Result Syntax

[
    'AdvancedEventSelectors' => [
        [
            'FieldSelectors' => [
                [
                    'EndsWith' => ['<string>', ...],
                    'Equals' => ['<string>', ...],
                    'Field' => '<string>',
                    'NotEndsWith' => ['<string>', ...],
                    'NotEquals' => ['<string>', ...],
                    'NotStartsWith' => ['<string>', ...],
                    'StartsWith' => ['<string>', ...],
                ],
                // ...
            ],
            'Name' => '<string>',
        ],
        // ...
    ],
    'BillingMode' => 'EXTENDABLE_RETENTION_PRICING|FIXED_RETENTION_PRICING',
    'CreatedTimestamp' => <DateTime>,
    'EventDataStoreArn' => '<string>',
    'FederationRoleArn' => '<string>',
    'FederationStatus' => 'ENABLING|ENABLED|DISABLING|DISABLED',
    'KmsKeyId' => '<string>',
    'MultiRegionEnabled' => true || false,
    'Name' => '<string>',
    'OrganizationEnabled' => true || false,
    'RetentionPeriod' => <integer>,
    'Status' => 'CREATED|ENABLED|PENDING_DELETION|STARTING_INGESTION|STOPPING_INGESTION|STOPPED_INGESTION',
    'TerminationProtectionEnabled' => true || false,
    'UpdatedTimestamp' => <DateTime>,
]

Result Details

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that are applied to the event data store.

BillingMode
Type: string

The billing mode for the event data store.

CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp that shows when an event data store was first created.

EventDataStoreArn
Type: string

The ARN of the event data store.

FederationRoleArn
Type: string

If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store.

FederationStatus
Type: string

Indicates the Lake query federation status. The status is ENABLED if Lake query federation is enabled, or DISABLED if Lake query federation is disabled. You cannot delete an event data store if the FederationStatus is ENABLED.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

MultiRegionEnabled
Type: boolean

Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.

Name
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Indicates whether an event data store is collecting logged events for an organization in Organizations.

RetentionPeriod
Type: int

The retention period, in days.

Status
Type: string

The status of an event data store.

TerminationProtectionEnabled
Type: boolean

Indicates whether termination protection is enabled for the event data store.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp that shows when the event data store was last updated. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.

Errors

EventDataStoreAlreadyExistsException:

An event data store with that name already exists.

EventDataStoreARNInvalidException:

The specified event data store ARN is not valid or does not map to an event data store in your account.

EventDataStoreNotFoundException:

The specified event data store was not found.

InvalidEventSelectorsException:

This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250.

You can:

  • Specify a valid number of event selectors (1 to 5) for a trail.

  • Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.

  • Specify up to 500 values for all conditions in all advanced event selectors for a trail.

  • Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.

InvalidInsightSelectorsException:

For PutInsightSelectors, this exception is thrown when the formatting or syntax of the InsightSelectors JSON statement is not valid, or the specified InsightType in the InsightSelectors statement is not valid. Valid values for InsightType are ApiCallRateInsight and ApiErrorRateInsight. To enable Insights on an event data store, the destination event data store specified by the InsightsDestination parameter must log Insights events and the source event data store specified by the EventDataStore parameter must log management events.

For UpdateEventDataStore, this exception is thrown if Insights are enabled on the event data store and the updated advanced event selectors are not compatible with the configured InsightSelectors. If the InsightSelectors includes an InsightType of ApiCallRateInsight, the source event data store must log write management events. If the InsightSelectors includes an InsightType of ApiErrorRateInsight, the source event data store must log management events.

EventDataStoreHasOngoingImportException:

This exception is thrown when you try to update or delete an event data store that currently has an import in progress.

InactiveEventDataStoreException:

The event data store is inactive.

InvalidParameterException:

The request includes a parameter that is not valid.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

InvalidKmsKeyIdException:

This exception is thrown when the KMS key ARN is not valid.

KmsKeyNotFoundException:

This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.

KmsException:

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

UpdateTrail

$result = $client->updateTrail([/* ... */]);
$promise = $client->updateTrailAsync([/* ... */]);

Updates trail settings that control what events you are logging, and how to handle log files. Changes to a trail do not require stopping the CloudTrail service. Use this action to designate an existing bucket for log delivery. If the existing bucket has previously been a target for CloudTrail log files, an IAM policy exists for the bucket. UpdateTrail must be called from the Region in which the trail was created; otherwise, an InvalidHomeRegionException is thrown.

Parameter Syntax

$result = $client->updateTrail([
    'CloudWatchLogsLogGroupArn' => '<string>',
    'CloudWatchLogsRoleArn' => '<string>',
    'EnableLogFileValidation' => true || false,
    'IncludeGlobalServiceEvents' => true || false,
    'IsMultiRegionTrail' => true || false,
    'IsOrganizationTrail' => true || false,
    'KmsKeyId' => '<string>',
    'Name' => '<string>', // REQUIRED
    'S3BucketName' => '<string>',
    'S3KeyPrefix' => '<string>',
    'SnsTopicName' => '<string>',
]);

Parameter Details

Members
CloudWatchLogsLogGroupArn
Type: string

Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered. You must use a log group that exists in your account.

Not required unless you specify CloudWatchLogsRoleArn.

CloudWatchLogsRoleArn
Type: string

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.

EnableLogFileValidation
Type: boolean

Specifies whether log file validation is enabled. The default is false.

When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.

IncludeGlobalServiceEvents
Type: boolean

Specifies whether the trail is publishing events from global services such as IAM to the log files.

IsMultiRegionTrail
Type: boolean

Specifies whether the trail applies only to the current Region or to all Regions. The default is false. If the trail exists only in the current Region and this value is set to true, shadow trails (replications of the trail) will be created in the other Regions. If the trail exists in all Regions and this value is set to false, the trail will remain in the Region where it was created, and its shadow trails in other Regions will be deleted. As a best practice, consider using trails that log events in all Regions.

IsOrganizationTrail
Type: boolean

Specifies whether the trail is applied to all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations. If the trail is not an organization trail and this is set to true, the trail will be created in all Amazon Web Services accounts that belong to the organization. If the trail is an organization trail and this is set to false, the trail will remain in the current Amazon Web Services account but be deleted from all member accounts in the organization.

Only the management account for the organization can convert an organization trail to a non-organization trail, or convert a non-organization trail to an organization trail.

KmsKeyId
Type: string

Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.

CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

Examples:

  • alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

  • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

  • 12345678-1234-1234-1234-123456789012

Name
Required: Yes
Type: string

Specifies the name of the trail or trail ARN. If Name is a trail name, the string must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

If Name is a trail ARN, it must be in the following format.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

S3BucketName
Type: string

Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket naming rules.

S3KeyPrefix
Type: string

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.

SnsTopicName
Type: string

Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

Result Syntax

[
    'CloudWatchLogsLogGroupArn' => '<string>',
    'CloudWatchLogsRoleArn' => '<string>',
    'IncludeGlobalServiceEvents' => true || false,
    'IsMultiRegionTrail' => true || false,
    'IsOrganizationTrail' => true || false,
    'KmsKeyId' => '<string>',
    'LogFileValidationEnabled' => true || false,
    'Name' => '<string>',
    'S3BucketName' => '<string>',
    'S3KeyPrefix' => '<string>',
    'SnsTopicARN' => '<string>',
    'SnsTopicName' => '<string>',
    'TrailARN' => '<string>',
]

Result Details

Members
CloudWatchLogsLogGroupArn
Type: string

Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs are delivered.

CloudWatchLogsRoleArn
Type: string

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

IncludeGlobalServiceEvents
Type: boolean

Specifies whether the trail is publishing events from global services such as IAM to the log files.

IsMultiRegionTrail
Type: boolean

Specifies whether the trail exists in one Region or in all Regions.

IsOrganizationTrail
Type: boolean

Specifies whether the trail is an organization trail.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

LogFileValidationEnabled
Type: boolean

Specifies whether log file integrity validation is enabled.

Name
Type: string

Specifies the name of the trail.

S3BucketName
Type: string

Specifies the name of the Amazon S3 bucket designated for publishing log files.

S3KeyPrefix
Type: string

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your IAM Log Files.

SnsTopicARN
Type: string

Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.

arn:aws:sns:us-east-2:123456789012:MyTopic

SnsTopicName
Type: string

This field is no longer in use. Use SnsTopicARN.

TrailARN
Type: string

Specifies the ARN of the trail that was updated. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Errors

S3BucketDoesNotExistException:

This exception is thrown when the specified S3 bucket does not exist.

InsufficientS3BucketPolicyException:

This exception is thrown when the policy on the S3 bucket is not sufficient.

InsufficientSnsTopicPolicyException:

This exception is thrown when the policy on the Amazon SNS topic is not sufficient.

InsufficientEncryptionPolicyException:

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

TrailNotFoundException:

This exception is thrown when the trail with the given name is not found.

InvalidS3BucketNameException:

This exception is thrown when the provided S3 bucket name is not valid.

InvalidS3PrefixException:

This exception is thrown when the provided S3 prefix is not valid.

InvalidSnsTopicNameException:

This exception is thrown when the provided SNS topic name is not valid.

InvalidKmsKeyIdException:

This exception is thrown when the KMS key ARN is not valid.

InvalidTrailNameException:

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

TrailNotProvidedException:

This exception is no longer in use.

InvalidEventSelectorsException:

This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250.

You can:

  • Specify a valid number of event selectors (1 to 5) for a trail.

  • Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.

  • Specify up to 500 values for all conditions in all advanced event selectors for a trail.

  • Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.

CloudTrailARNInvalidException:

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

ConflictException:

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

ThrottlingException:

This exception is thrown when the request rate exceeds the limit.

InvalidParameterCombinationException:

This exception is thrown when the combination of parameters provided is not valid.

InvalidHomeRegionException:

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

KmsKeyNotFoundException:

This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.

KmsKeyDisabledException:

This exception is no longer in use.

KmsException:

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

InvalidCloudWatchLogsLogGroupArnException:

This exception is thrown when the provided CloudWatch Logs log group is not valid.

InvalidCloudWatchLogsRoleArnException:

This exception is thrown when the provided role is not valid.

CloudWatchLogsDeliveryUnavailableException:

Cannot set a CloudWatch Logs delivery for this Region.

UnsupportedOperationException:

This exception is thrown when the requested operation is not supported.

OperationNotPermittedException:

This exception is thrown when the requested operation is not permitted.

CloudTrailAccessNotEnabledException:

This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.

InsufficientDependencyServiceAccessPermissionException:

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

OrganizationsNotInUseException:

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

NotOrganizationMasterAccountException:

This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

OrganizationNotInAllFeaturesModeException:

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

NoManagementAccountSLRExistsException:

This exception is thrown when the management account does not have a service-linked role.

CloudTrailInvalidClientTokenIdException:

This exception is thrown when a call results in the InvalidClientTokenId error code. This can occur when you are creating or updating a trail to send notifications to an Amazon SNS topic that is in a suspended Amazon Web Services account.

InvalidParameterException:

The request includes a parameter that is not valid.

Shapes

AccessDeniedException

Description

You do not have sufficient access to perform this action.

Members

AccountHasOngoingImportException

Description

This exception is thrown when you start a new import and a previous import is still in progress.

Members

AccountNotFoundException

Description

This exception is thrown when the specified account is not found or not part of an organization.

Members

AccountNotRegisteredException

Description

This exception is thrown when the specified account is not registered as the CloudTrail delegated administrator.

Members

AccountRegisteredException

Description

This exception is thrown when the account is already registered as the CloudTrail delegated administrator.

Members

AdvancedEventSelector

Description

Advanced event selectors let you create fine-grained selectors for CloudTrail management and data events. They help you control costs by logging only those events that are important to you. For more information about advanced event selectors, see Logging management events and Logging data events in the CloudTrail User Guide.

You cannot apply both event selectors and advanced event selectors to a trail.

Supported CloudTrail event record fields for management events

  • eventCategory (required)

  • eventSource

  • readOnly

Supported CloudTrail event record fields for data events

  • eventCategory (required)

  • resources.type (required)

  • readOnly

  • eventName

  • resources.ARN

For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the only supported field is eventCategory.

Members
FieldSelectors
Required: Yes
Type: Array of AdvancedFieldSelector structures

Contains all selector statements in an advanced event selector.

Name
Type: string

An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".

AdvancedFieldSelector

Description

A single selector statement in an advanced event selector.

Members
EndsWith
Type: Array of strings

An operator that includes events that match the last few characters of the event record field specified as the value of Field.

Equals
Type: Array of strings

An operator that includes events that match the exact value of the event record field specified as the value of Field. This is the only valid operator that you can use with the readOnly, eventCategory, and resources.type fields.

Field
Required: Yes
Type: string

A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported.

For CloudTrail management events, supported fields include readOnly, eventCategory, and eventSource.

For CloudTrail data events, supported fields include readOnly, eventCategory, eventName, resources.type, and resources.ARN.

For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the only supported field is eventCategory.

  • readOnly - Optional. Can be set to Equals a value of true or false. If you do not add this field, CloudTrail logs both read and write events. A value of true logs only read events. A value of false logs only write events.

  • eventSource - For filtering management events only. This can be set to NotEquals kms.amazonaws.com or NotEquals rdsdata.amazonaws.com.

  • eventName - Can use any operator. You can use it to filter in or filter out any data event logged to CloudTrail, such as PutBucket or GetSnapshotBlock. You can have multiple values for this field, separated by commas.

  • eventCategory - This is required and must be set to Equals.

    • For CloudTrail management events, the value must be Management.

    • For CloudTrail data events, the value must be Data.

    The following are used only for event data stores:

    • For CloudTrail Insights events, the value must be Insight.

    • For Config configuration items, the value must be ConfigurationItem.

    • For Audit Manager evidence, the value must be Evidence.

    • For non-Amazon Web Services events, the value must be ActivityAuditLog.

  • resources.type - This field is required for CloudTrail data events. resources.type can only use the Equals operator, and the value can be one of the following:

    • AWS::DynamoDB::Table

    • AWS::Lambda::Function

    • AWS::S3::Object

    • AWS::AppConfig::Configuration

    • AWS::B2BI::Transformer

    • AWS::Bedrock::AgentAlias

    • AWS::Bedrock::KnowledgeBase

    • AWS::Cassandra::Table

    • AWS::CloudFront::KeyValueStore

    • AWS::CloudTrail::Channel

    • AWS::CodeWhisperer::Customization

    • AWS::CodeWhisperer::Profile

    • AWS::Cognito::IdentityPool

    • AWS::DynamoDB::Stream

    • AWS::EC2::Snapshot

    • AWS::EMRWAL::Workspace

    • AWS::FinSpace::Environment

    • AWS::Glue::Table

    • AWS::GreengrassV2::ComponentVersion

    • AWS::GreengrassV2::Deployment

    • AWS::GuardDuty::Detector

    • AWS::IoT::Certificate

    • AWS::IoT::Thing

    • AWS::IoTSiteWise::Asset

    • AWS::IoTSiteWise::TimeSeries

    • AWS::IoTTwinMaker::Entity

    • AWS::IoTTwinMaker::Workspace

    • AWS::KendraRanking::ExecutionPlan

    • AWS::KinesisVideo::Stream

    • AWS::ManagedBlockchain::Network

    • AWS::ManagedBlockchain::Node

    • AWS::MedicalImaging::Datastore

    • AWS::NeptuneGraph::Graph

    • AWS::PCAConnectorAD::Connector

    • AWS::QApps:QApp

    • AWS::QBusiness::Application

    • AWS::QBusiness::DataSource

    • AWS::QBusiness::Index

    • AWS::QBusiness::WebExperience

    • AWS::RDS::DBCluster

    • AWS::S3::AccessPoint

    • AWS::S3ObjectLambda::AccessPoint

    • AWS::S3Outposts::Object

    • AWS::SageMaker::Endpoint

    • AWS::SageMaker::ExperimentTrialComponent

    • AWS::SageMaker::FeatureGroup

    • AWS::ServiceDiscovery::Namespace

    • AWS::ServiceDiscovery::Service

    • AWS::SCN::Instance

    • AWS::SNS::PlatformEndpoint

    • AWS::SNS::Topic

    • AWS::SQS::Queue

    • AWS::SSM::ManagedNode

    • AWS::SSMMessages::ControlChannel

    • AWS::SWF::Domain

    • AWS::ThinClient::Device

    • AWS::ThinClient::Environment

    • AWS::Timestream::Database

    • AWS::Timestream::Table

    • AWS::VerifiedPermissions::PolicyStore

    • AWS::XRay::Trace

    You can have only one resources.type field per selector. To log data events on more than one resource type, add another selector.

  • resources.ARN - You can use any operator with resources.ARN, but if you use Equals or NotEquals, the value must exactly match the ARN of a valid resource of the type you've specified in the template as the value of resources.type.

    You can't use the resources.ARN field to filter resource types that do not have ARNs.

    The resources.ARN field can be set one of the following.

    If resources.type equals AWS::S3::Object, the ARN must be in one of the following formats. To log all data events for all objects in a specific S3 bucket, use the StartsWith operator, and include only the bucket ARN as the matching value.

    The trailing slash is intentional; do not exclude it. Replace the text between less than and greater than symbols (<>) with resource-specific information.

    • arn:<partition>:s3:::<bucket_name>/

    • arn:<partition>:s3:::<bucket_name>/<object_path>/

    When resources.type equals AWS::DynamoDB::Table, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:dynamodb:<region>:<account_ID>:table/<table_name>

    When resources.type equals AWS::Lambda::Function, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:lambda:<region>:<account_ID>:function:<function_name>

    When resources.type equals AWS::AppConfig::Configuration, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:appconfig:<region>:<account_ID>:application/<application_ID>/environment/<environment_ID>/configuration/<configuration_profile_ID>

    When resources.type equals AWS::B2BI::Transformer, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:b2bi:<region>:<account_ID>:transformer/<transformer_ID>

    When resources.type equals AWS::Bedrock::AgentAlias, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:bedrock:<region>:<account_ID>:agent-alias/<agent_ID>/<alias_ID>

    When resources.type equals AWS::Bedrock::KnowledgeBase, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:bedrock:<region>:<account_ID>:knowledge-base/<knowledge_base_ID>

    When resources.type equals AWS::Cassandra::Table, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:cassandra:<region>:<account_ID>:/keyspace/<keyspace_name>/table/<table_name>

    When resources.type equals AWS::CloudFront::KeyValueStore, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:cloudfront:<region>:<account_ID>:key-value-store/<KVS_name>

    When resources.type equals AWS::CloudTrail::Channel, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:cloudtrail:<region>:<account_ID>:channel/<channel_UUID>

    When resources.type equals AWS::CodeWhisperer::Customization, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:codewhisperer:<region>:<account_ID>:customization/<customization_ID>

    When resources.type equals AWS::CodeWhisperer::Profile, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:codewhisperer:<region>:<account_ID>:profile/<profile_ID>

    When resources.type equals AWS::Cognito::IdentityPool, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:cognito-identity:<region>:<account_ID>:identitypool/<identity_pool_ID>

    When resources.type equals AWS::DynamoDB::Stream, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:dynamodb:<region>:<account_ID>:table/<table_name>/stream/<date_time>

    When resources.type equals AWS::EC2::Snapshot, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:ec2:<region>::snapshot/<snapshot_ID>

    When resources.type equals AWS::EMRWAL::Workspace, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:emrwal:<region>:<account_ID>:workspace/<workspace_name>

    When resources.type equals AWS::FinSpace::Environment, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:finspace:<region>:<account_ID>:environment/<environment_ID>

    When resources.type equals AWS::Glue::Table, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:glue:<region>:<account_ID>:table/<database_name>/<table_name>

    When resources.type equals AWS::GreengrassV2::ComponentVersion, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:greengrass:<region>:<account_ID>:components/<component_name>

    When resources.type equals AWS::GreengrassV2::Deployment, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:greengrass:<region>:<account_ID>:deployments/<deployment_ID

    When resources.type equals AWS::GuardDuty::Detector, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:guardduty:<region>:<account_ID>:detector/<detector_ID>

    When resources.type equals AWS::IoT::Certificate, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iot:<region>:<account_ID>:cert/<certificate_ID>

    When resources.type equals AWS::IoT::Thing, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iot:<region>:<account_ID>:thing/<thing_ID>

    When resources.type equals AWS::IoTSiteWise::Asset, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iotsitewise:<region>:<account_ID>:asset/<asset_ID>

    When resources.type equals AWS::IoTSiteWise::TimeSeries, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iotsitewise:<region>:<account_ID>:timeseries/<timeseries_ID>

    When resources.type equals AWS::IoTTwinMaker::Entity, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iottwinmaker:<region>:<account_ID>:workspace/<workspace_ID>/entity/<entity_ID>

    When resources.type equals AWS::IoTTwinMaker::Workspace, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:iottwinmaker:<region>:<account_ID>:workspace/<workspace_ID>

    When resources.type equals AWS::KendraRanking::ExecutionPlan, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:kendra-ranking:<region>:<account_ID>:rescore-execution-plan/<rescore_execution_plan_ID>

    When resources.type equals AWS::KinesisVideo::Stream, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:kinesisvideo:<region>:<account_ID>:stream/<stream_name>/<creation_time>

    When resources.type equals AWS::ManagedBlockchain::Network, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:managedblockchain:::networks/<network_name>

    When resources.type equals AWS::ManagedBlockchain::Node, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:managedblockchain:<region>:<account_ID>:nodes/<node_ID>

    When resources.type equals AWS::MedicalImaging::Datastore, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:medical-imaging:<region>:<account_ID>:datastore/<data_store_ID>

    When resources.type equals AWS::NeptuneGraph::Graph, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:neptune-graph:<region>:<account_ID>:graph/<graph_ID>

    When resources.type equals AWS::PCAConnectorAD::Connector, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:pca-connector-ad:<region>:<account_ID>:connector/<connector_ID>

    When resources.type equals AWS::QApps:QApp, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:qapps:<region>:<account_ID>:application/<application_UUID>/qapp/<qapp_UUID>

    When resources.type equals AWS::QBusiness::Application, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:qbusiness:<region>:<account_ID>:application/<application_ID>

    When resources.type equals AWS::QBusiness::DataSource, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:qbusiness:<region>:<account_ID>:application/<application_ID>/index/<index_ID>/data-source/<datasource_ID>

    When resources.type equals AWS::QBusiness::Index, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:qbusiness:<region>:<account_ID>:application/<application_ID>/index/<index_ID>

    When resources.type equals AWS::QBusiness::WebExperience, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:qbusiness:<region>:<account_ID>:application/<application_ID>/web-experience/<web_experience_ID>

    When resources.type equals AWS::RDS::DBCluster, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:rds:<region>:<account_ID>:cluster/<cluster_name>

    When resources.type equals AWS::S3::AccessPoint, and the operator is set to Equals or NotEquals, the ARN must be in one of the following formats. To log events on all objects in an S3 access point, we recommend that you use only the access point ARN, don’t include the object path, and use the StartsWith or NotStartsWith operators.

    • arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>

    • arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>/object/<object_path>

    When resources.type equals AWS::S3ObjectLambda::AccessPoint, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:s3-object-lambda:<region>:<account_ID>:accesspoint/<access_point_name>

    When resources.type equals AWS::S3Outposts::Object, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:s3-outposts:<region>:<account_ID>:<object_path>

    When resources.type equals AWS::SageMaker::Endpoint, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sagemaker:<region>:<account_ID>:endpoint/<endpoint_name>

    When resources.type equals AWS::SageMaker::ExperimentTrialComponent, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sagemaker:<region>:<account_ID>:experiment-trial-component/<experiment_trial_component_name>

    When resources.type equals AWS::SageMaker::FeatureGroup, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sagemaker:<region>:<account_ID>:feature-group/<feature_group_name>

    When resources.type equals AWS::SCN::Instance, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:scn:<region>:<account_ID>:instance/<instance_ID>

    When resources.type equals AWS::ServiceDiscovery::Namespace, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:servicediscovery:<region>:<account_ID>:namespace/<namespace_ID>

    When resources.type equals AWS::ServiceDiscovery::Service, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:servicediscovery:<region>:<account_ID>:service/<service_ID>

    When resources.type equals AWS::SNS::PlatformEndpoint, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sns:<region>:<account_ID>:endpoint/<endpoint_type>/<endpoint_name>/<endpoint_ID>

    When resources.type equals AWS::SNS::Topic, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sns:<region>:<account_ID>:<topic_name>

    When resources.type equals AWS::SQS::Queue, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:sqs:<region>:<account_ID>:<queue_name>

    When resources.type equals AWS::SSM::ManagedNode, and the operator is set to Equals or NotEquals, the ARN must be in one of the following formats:

    • arn:<partition>:ssm:<region>:<account_ID>:managed-instance/<instance_ID>

    • arn:<partition>:ec2:<region>:<account_ID>:instance/<instance_ID>

    When resources.type equals AWS::SSMMessages::ControlChannel, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:ssmmessages:<region>:<account_ID>:control-channel/<channel_ID>

    When resources.type equals AWS::SWF::Domain, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:swf:<region>:<account_ID>:domain/<domain_name>

    When resources.type equals AWS::ThinClient::Device, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:thinclient:<region>:<account_ID>:device/<device_ID>

    When resources.type equals AWS::ThinClient::Environment, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:thinclient:<region>:<account_ID>:environment/<environment_ID>

    When resources.type equals AWS::Timestream::Database, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:timestream:<region>:<account_ID>:database/<database_name>

    When resources.type equals AWS::Timestream::Table, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:timestream:<region>:<account_ID>:database/<database_name>/table/<table_name>

    When resources.type equals AWS::VerifiedPermissions::PolicyStore, and the operator is set to Equals or NotEquals, the ARN must be in the following format:

    • arn:<partition>:verifiedpermissions:<region>:<account_ID>:policy-store/<policy_store_UUID>

NotEndsWith
Type: Array of strings

An operator that excludes events that match the last few characters of the event record field specified as the value of Field.

NotEquals
Type: Array of strings

An operator that excludes events that match the exact value of the event record field specified as the value of Field.

NotStartsWith
Type: Array of strings

An operator that excludes events that match the first few characters of the event record field specified as the value of Field.

StartsWith
Type: Array of strings

An operator that includes events that match the first few characters of the event record field specified as the value of Field.

CannotDelegateManagementAccountException

Description

This exception is thrown when the management account of an organization is registered as the CloudTrail delegated administrator.

Members

Channel

Description

Contains information about a returned CloudTrail channel.

Members
ChannelArn
Type: string

The Amazon Resource Name (ARN) of a channel.

Name
Type: string

The name of the CloudTrail channel. For service-linked channels, the name is aws-service-channel/service-name/custom-suffix where service-name represents the name of the Amazon Web Services service that created the channel and custom-suffix represents the suffix created by the Amazon Web Services service.

ChannelARNInvalidException

Description

This exception is thrown when the specified value of ChannelARN is not valid.

Members

ChannelAlreadyExistsException

Description

This exception is thrown when the provided channel already exists.

Members

ChannelExistsForEDSException

Description

This exception is thrown when the specified event data store cannot yet be deleted because it is in use by a channel.

Members

ChannelMaxLimitExceededException

Description

This exception is thrown when the maximum number of channels limit is exceeded.

Members

ChannelNotFoundException

Description

This exception is thrown when CloudTrail cannot find the specified channel.

Members

CloudTrailARNInvalidException

Description

This exception is thrown when an operation is called with an ARN that is not valid.

The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

Members

CloudTrailInvalidClientTokenIdException

Description

This exception is thrown when a call results in the InvalidClientTokenId error code. This can occur when you are creating or updating a trail to send notifications to an Amazon SNS topic that is in a suspended Amazon Web Services account.

Members

CloudWatchLogsDeliveryUnavailableException

Description

Cannot set a CloudWatch Logs delivery for this Region.

Members

ConcurrentModificationException

Description

You are trying to update a resource when another request is in progress. Allow sufficient wait time for the previous request to complete, then retry your request.

Members

ConflictException

Description

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

Members

DataResource

Description

Data events provide information about the resource operations performed on or within a resource itself. These are also known as data plane operations. You can specify up to 250 data resources for a trail.

Configure the DataResource to specify the resource type and resource ARNs for which you want to log data events.

You can specify the following resource types in your event selectors for your trail:

  • AWS::DynamoDB::Table

  • AWS::Lambda::Function

  • AWS::S3::Object

The total number of allowed data resources is 250. This number can be distributed between 1 and 5 event selectors, but the total cannot exceed 250 across all selectors for the trail.

If you are using advanced event selectors, the maximum total number of values for all conditions, across all advanced event selectors for the trail, is 500.

The following example demonstrates how logging works when you configure logging of all data events for an S3 bucket named bucket-1. In this example, the CloudTrail user specified an empty prefix, and the option to log both Read and Write data events.

  1. A user uploads an image file to bucket-1.

  2. The PutObject API operation is an Amazon S3 object-level API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified an S3 bucket with an empty prefix, events that occur on any object in that bucket are logged. The trail processes and logs the event.

  3. A user uploads an object to an Amazon S3 bucket named arn:aws:s3:::bucket-2.

  4. The PutObject API operation occurred for an object in an S3 bucket that the CloudTrail user didn't specify for the trail. The trail doesn’t log the event.

The following example demonstrates how logging works when you configure logging of Lambda data events for a Lambda function named MyLambdaFunction, but not for all Lambda functions.

  1. A user runs a script that includes a call to the MyLambdaFunction function and the MyOtherLambdaFunction function.

  2. The Invoke API operation on MyLambdaFunction is an Lambda API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified logging data events for MyLambdaFunction, any invocations of that function are logged. The trail processes and logs the event.

  3. The Invoke API operation on MyOtherLambdaFunction is an Lambda API. Because the CloudTrail user did not specify logging data events for all Lambda functions, the Invoke operation for MyOtherLambdaFunction does not match the function specified for the trail. The trail doesn’t log the event.

Members
Type
Type: string

The resource type in which you want to log data events. You can specify the following basic event selector resource types:

  • AWS::DynamoDB::Table

  • AWS::Lambda::Function

  • AWS::S3::Object

Additional resource types are available through advanced event selectors. For more information about these additional resource types, see AdvancedFieldSelector.

Values
Type: Array of strings

An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type.

  • To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as arn:aws:s3.

    This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account.

  • To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::bucket-1/. The trail logs data events for all objects in this S3 bucket.

  • To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::bucket-1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.

  • To log data events for all Lambda functions in your Amazon Web Services account, specify the prefix as arn:aws:lambda.

    This also enables logging of Invoke activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account.

  • To log data events for a specific Lambda function, specify the function ARN.

    Lambda function ARNs are exact. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.

  • To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as arn:aws:dynamodb.

DelegatedAdminAccountLimitExceededException

Description

This exception is thrown when the maximum number of CloudTrail delegated administrators is reached.

Members

Destination

Description

Contains information about the destination receiving events.

Members
Location
Required: Yes
Type: string

For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service.

Type
Required: Yes
Type: string

The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is EVENT_DATA_STORE. For service-linked channels, the value is AWS_SERVICE.

Event

Description

Contains information about an event that was returned by a lookup request. The result includes a representation of a CloudTrail event.

Members
AccessKeyId
Type: string

The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.

CloudTrailEvent
Type: string

A JSON string that contains a representation of the event returned.

EventId
Type: string

The CloudTrail ID of the event returned.

EventName
Type: string

The name of the event returned.

EventSource
Type: string

The Amazon Web Services service to which the request was made.

EventTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date and time of the event returned.

ReadOnly
Type: string

Information about whether the event is a write event or a read event.

Resources
Type: Array of Resource structures

A list of resources referenced by the event returned.

Username
Type: string

A user name or role name of the requester that called the API in the event returned.

EventDataStore

Description

A storage lake of event data against which you can run complex SQL-based queries. An event data store can include events that you have logged on your account. To select events for an event data store, use advanced event selectors.

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that were used to select events for the data store.

CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the event data store's creation.

EventDataStoreArn
Type: string

The ARN of the event data store.

MultiRegionEnabled
Type: boolean

Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.

Name
Type: string

The name of the event data store.

OrganizationEnabled
Type: boolean

Indicates that an event data store is collecting logged events for an organization.

RetentionPeriod
Type: int

The retention period, in days.

Status
Type: string

The status of an event data store.

TerminationProtectionEnabled
Type: boolean

Indicates whether the event data store is protected from termination.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp showing when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.

EventDataStoreARNInvalidException

Description

The specified event data store ARN is not valid or does not map to an event data store in your account.

Members

EventDataStoreAlreadyExistsException

Description

An event data store with that name already exists.

Members

EventDataStoreFederationEnabledException

Description

You cannot delete the event data store because Lake query federation is enabled. To delete the event data store, run the DisableFederation operation to disable Lake query federation on the event data store.

Members

EventDataStoreHasOngoingImportException

Description

This exception is thrown when you try to update or delete an event data store that currently has an import in progress.

Members

EventDataStoreMaxLimitExceededException

Description

Your account has used the maximum number of event data stores.

Members

EventDataStoreNotFoundException

Description

The specified event data store was not found.

Members

EventDataStoreTerminationProtectedException

Description

The event data store cannot be deleted because termination protection is enabled for it.

Members

EventSelector

Description

Use event selectors to further specify the management and data event settings for your trail. By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.

You can configure up to five event selectors for a trail.

You cannot apply both event selectors and advanced event selectors to a trail.

Members
DataResources
Type: Array of DataResource structures

CloudTrail supports data event logging for Amazon S3 objects, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events.

For more information, see Data Events and Limits in CloudTrail in the CloudTrail User Guide.

ExcludeManagementEventSources
Type: Array of strings

An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing kms.amazonaws.com or rdsdata.amazonaws.com. By default, ExcludeManagementEventSources is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source.

IncludeManagementEvents
Type: boolean

Specify if you want your event selector to include management events for your trail.

For more information, see Management Events in the CloudTrail User Guide.

By default, the value is true.

The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing.

ReadWriteType
Type: string

Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 GetConsoleOutput is a read-only API operation and RunInstances is a write-only API operation.

By default, the value is All.

ImportFailureListItem

Description

Provides information about an import failure.

Members
ErrorMessage
Type: string

Provides the reason the import failed.

ErrorType
Type: string

The type of import error.

LastUpdatedTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

When the import was last updated.

Location
Type: string

The location of the failure in the S3 bucket.

Status
Type: string

The status of the import.

ImportNotFoundException

Description

The specified import was not found.

Members

ImportSource

Description

The import source.

Members
S3
Required: Yes
Type: S3ImportSource structure

The source S3 bucket.

ImportStatistics

Description

Provides statistics for the specified ImportID. CloudTrail does not update import statistics in real-time. Returned values for parameters such as EventsCompleted may be lower than the actual value, because CloudTrail updates statistics incrementally over the course of the import.

Members
EventsCompleted
Type: long (int|float)

The number of trail events imported into the event data store.

FailedEntries
Type: long (int|float)

The number of failed entries.

FilesCompleted
Type: long (int|float)

The number of log files that completed import.

PrefixesCompleted
Type: long (int|float)

The number of S3 prefixes that completed import.

PrefixesFound
Type: long (int|float)

The number of S3 prefixes found for the import.

ImportsListItem

Description

Contains information about an import that was returned by a lookup request.

Members
CreatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's creation.

Destinations
Type: Array of strings

The ARN of the destination event data store.

ImportId
Type: string

The ID of the import.

ImportStatus
Type: string

The status of the import.

UpdatedTimestamp
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp of the import's last update.

InactiveEventDataStoreException

Description

The event data store is inactive.

Members

InactiveQueryException

Description

The specified query cannot be canceled because it is in the FINISHED, FAILED, TIMED_OUT, or CANCELLED state.

Members

IngestionStatus

Description

A table showing information about the most recent successful and failed attempts to ingest events.

Members
LatestIngestionAttemptEventID
Type: string

The event ID of the most recent attempt to ingest events.

LatestIngestionAttemptTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The time stamp of the most recent attempt to ingest events on the channel.

LatestIngestionErrorCode
Type: string

The error code for the most recent failure to ingest events.

LatestIngestionSuccessEventID
Type: string

The event ID of the most recent successful ingestion of events.

LatestIngestionSuccessTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The time stamp of the most recent successful ingestion of events for the channel.

InsightNotEnabledException

Description

If you run GetInsightSelectors on a trail or event data store that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException.

Members

InsightSelector

Description

A JSON string that contains a list of Insights types that are logged on a trail or event data store.

Members
InsightType
Type: string

The type of Insights events to log on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types.

The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.

The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.

InsufficientDependencyServiceAccessPermissionException

Description

This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.

Members

InsufficientEncryptionPolicyException

Description

This exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

Members

InsufficientS3BucketPolicyException

Description

This exception is thrown when the policy on the S3 bucket is not sufficient.

Members

InsufficientSnsTopicPolicyException

Description

This exception is thrown when the policy on the Amazon SNS topic is not sufficient.

Members

InvalidCloudWatchLogsLogGroupArnException

Description

This exception is thrown when the provided CloudWatch Logs log group is not valid.

Members

InvalidCloudWatchLogsRoleArnException

Description

This exception is thrown when the provided role is not valid.

Members

InvalidDateRangeException

Description

A date range for the query was specified that is not valid. Be sure that the start time is chronologically before the end time. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.

Members

InvalidEventCategoryException

Description

Occurs if an event category that is not valid is specified as a value of EventCategory.

Members

InvalidEventDataStoreCategoryException

Description

This exception is thrown when event categories of specified event data stores are not valid.

Members

InvalidEventDataStoreStatusException

Description

The event data store is not in a status that supports the operation.

Members

InvalidEventSelectorsException

Description

This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250.

You can:

  • Specify a valid number of event selectors (1 to 5) for a trail.

  • Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.

  • Specify up to 500 values for all conditions in all advanced event selectors for a trail.

  • Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.

Members

InvalidHomeRegionException

Description

This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.

Members

InvalidImportSourceException

Description

This exception is thrown when the provided source S3 bucket is not valid for import.

Members

InvalidInsightSelectorsException

Description

For PutInsightSelectors, this exception is thrown when the formatting or syntax of the InsightSelectors JSON statement is not valid, or the specified InsightType in the InsightSelectors statement is not valid. Valid values for InsightType are ApiCallRateInsight and ApiErrorRateInsight. To enable Insights on an event data store, the destination event data store specified by the InsightsDestination parameter must log Insights events and the source event data store specified by the EventDataStore parameter must log management events.

For UpdateEventDataStore, this exception is thrown if Insights are enabled on the event data store and the updated advanced event selectors are not compatible with the configured InsightSelectors. If the InsightSelectors includes an InsightType of ApiCallRateInsight, the source event data store must log write management events. If the InsightSelectors includes an InsightType of ApiErrorRateInsight, the source event data store must log management events.

Members

InvalidKmsKeyIdException

Description

This exception is thrown when the KMS key ARN is not valid.

Members

InvalidLookupAttributesException

Description

Occurs when a lookup attribute is specified that is not valid.

Members

InvalidMaxResultsException

Description

This exception is thrown if the limit specified is not valid.

Members

InvalidNextTokenException

Description

A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.

Members

InvalidParameterCombinationException

Description

This exception is thrown when the combination of parameters provided is not valid.

Members

InvalidParameterException

Description

The request includes a parameter that is not valid.

Members

InvalidQueryStatementException

Description

The query that was submitted has validation errors, or uses incorrect syntax or unsupported keywords. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.

Members

InvalidQueryStatusException

Description

The query status is not valid for the operation.

Members

InvalidS3BucketNameException

Description

This exception is thrown when the provided S3 bucket name is not valid.

Members

InvalidS3PrefixException

Description

This exception is thrown when the provided S3 prefix is not valid.

Members

InvalidSnsTopicNameException

Description

This exception is thrown when the provided SNS topic name is not valid.

Members

InvalidSourceException

Description

This exception is thrown when the specified value of Source is not valid.

Members

InvalidTagParameterException

Description

This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

Members

InvalidTimeRangeException

Description

Occurs if the timestamp values are not valid. Either the start time occurs after the end time, or the time range is outside the range of possible values.

Members

InvalidTokenException

Description

Reserved for future use.

Members

InvalidTrailNameException

Description

This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

  • Start with a letter or number, and end with a letter or number

  • Be between 3 and 128 characters

  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

  • Not be in IP address format (for example, 192.168.5.4)

Members

KmsException

Description

This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.

Members

KmsKeyDisabledException

Description

This exception is no longer in use.

Members

KmsKeyNotFoundException

Description

This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.

Members

LookupAttribute

Description

Specifies an attribute and value that filter the events returned.

Members
AttributeKey
Required: Yes
Type: string

Specifies an attribute on which to filter the events returned.

AttributeValue
Required: Yes
Type: string

Specifies a value for the specified AttributeKey.

The maximum length for the AttributeValue is 2000 characters. The following characters ('_', ' ', ',', '\\n') count as two characters towards the 2000 character limit.

MaxConcurrentQueriesException

Description

You are already running the maximum number of concurrent queries. The maximum number of concurrent queries is 10. Wait a minute for some queries to finish, and then run the query again.

Members

MaximumNumberOfTrailsExceededException

Description

This exception is thrown when the maximum number of trails is reached.

Members

NoManagementAccountSLRExistsException

Description

This exception is thrown when the management account does not have a service-linked role.

Members

NotOrganizationManagementAccountException

Description

This exception is thrown when the account making the request is not the organization's management account.

Members

OperationNotPermittedException

Description

This exception is thrown when the requested operation is not permitted.

Members

OrganizationNotInAllFeaturesModeException

Description

This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.

Members

OrganizationsNotInUseException

Description

This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.

Members

PartitionKey

Description

Contains information about a partition key for an event data store.

Members
Name
Required: Yes
Type: string

The name of the partition key.

Type
Required: Yes
Type: string

The data type of the partition key. For example, bigint or string.

PublicKey

Description

Contains information about a returned public key.

Members
Fingerprint
Type: string

The fingerprint of the public key.

ValidityEndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The ending time of validity of the public key.

ValidityStartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The starting time of validity of the public key.

Value
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The DER encoded public key value in PKCS#1 format.

Query

Description

A SQL string of criteria about events that you want to collect in an event data store.

Members
CreationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The creation time of a query.

QueryId
Type: string

The ID of a query.

QueryStatus
Type: string

The status of the query. This can be QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

QueryIdNotFoundException

Description

The query ID does not exist or does not map to a query.

Members

QueryStatistics

Description

Metadata about a query, such as the number of results.

Members
BytesScanned
Type: long (int|float)

The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running.

ResultsCount
Type: int

The number of results returned.

TotalResultsCount
Type: int

The total number of results returned by a query.

QueryStatisticsForDescribeQuery

Description

Gets metadata about a query, including the number of events that were matched, the total number of events scanned, the query run time in milliseconds, and the query's creation time.

Members
BytesScanned
Type: long (int|float)

The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running.

CreationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The creation time of the query.

EventsMatched
Type: long (int|float)

The number of events that matched a query.

EventsScanned
Type: long (int|float)

The number of events that the query scanned in the event data store.

ExecutionTimeInMillis
Type: int

The query's run time, in milliseconds.

Resource

Description

Specifies the type and name of a resource referenced by an event.

Members
ResourceName
Type: string

The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto-scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance.

ResourceType
Type: string

The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: Instance for EC2, Trail for CloudTrail, DBInstance for Amazon RDS, and AccessKey for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events.

ResourceARNNotValidException

Description

This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid. The following is the valid format for a resource ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/MyChannel.

Members

ResourceNotFoundException

Description

This exception is thrown when the specified resource is not found.

Members

ResourcePolicyNotFoundException

Description

This exception is thrown when the specified resource policy is not found.

Members

ResourcePolicyNotValidException

Description

This exception is thrown when the resouce-based policy has syntax errors, or contains a principal that is not valid.

The following are requirements for the resource policy:

  • Contains only one action: cloudtrail-data:PutAuditEvents

  • Contains at least one statement. The policy can have a maximum of 20 statements.

  • Each statement contains at least one principal. A statement can have a maximum of 50 principals.

Members

ResourceTag

Description

A resource tag.

Members
ResourceId
Type: string

Specifies the ARN of the resource.

TagsList
Type: Array of Tag structures

A list of tags.

ResourceTypeNotSupportedException

Description

This exception is thrown when the specified resource type is not supported by CloudTrail.

Members

S3BucketDoesNotExistException

Description

This exception is thrown when the specified S3 bucket does not exist.

Members

S3ImportSource

Description

The settings for the source S3 bucket.

Members
S3BucketAccessRoleArn
Required: Yes
Type: string

The IAM ARN role used to access the source S3 bucket.

S3BucketRegion
Required: Yes
Type: string

The Region associated with the source S3 bucket.

S3LocationUri
Required: Yes
Type: string

The URI for the source S3 bucket.

SourceConfig

Description

Contains configuration information about the channel.

Members
AdvancedEventSelectors
Type: Array of AdvancedEventSelector structures

The advanced event selectors that are configured for the channel.

ApplyToAllRegions
Type: boolean

Specifies whether the channel applies to a single Region or to all Regions.

Tag

Description

A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, or channel.

Members
Key
Required: Yes
Type: string

The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.

Value
Type: string

The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

TagsLimitExceededException

Description

The number of tags per trail, event data store, or channel has exceeded the permitted amount. Currently, the limit is 50.

Members

ThrottlingException

Description

This exception is thrown when the request rate exceeds the limit.

Members

Trail

Description

The settings for a trail.

Members
CloudWatchLogsLogGroupArn
Type: string

Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered.

CloudWatchLogsRoleArn
Type: string

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

HasCustomEventSelectors
Type: boolean

Specifies if the trail has custom event selectors.

HasInsightSelectors
Type: boolean

Specifies whether a trail has insight types specified in an InsightSelector list.

HomeRegion
Type: string

The Region in which the trail was created.

IncludeGlobalServiceEvents
Type: boolean

Set to True to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, False.

IsMultiRegionTrail
Type: boolean

Specifies whether the trail exists only in one Region or exists in all Regions.

IsOrganizationTrail
Type: boolean

Specifies whether the trail is an organization trail.

KmsKeyId
Type: string

Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.

arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

LogFileValidationEnabled
Type: boolean

Specifies whether log file validation is enabled.

Name
Type: string

Name of the trail set by calling CreateTrail. The maximum length is 128 characters.

S3BucketName
Type: string

Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket naming rules.

S3KeyPrefix
Type: string

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.

SnsTopicARN
Type: string

Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.

arn:aws:sns:us-east-2:123456789012:MyTopic

SnsTopicName
Type: string

This field is no longer in use. Use SnsTopicARN.

TrailARN
Type: string

Specifies the ARN of the trail. The following is the format of a trail ARN.

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

TrailAlreadyExistsException

Description

This exception is thrown when the specified trail already exists.

Members

TrailInfo

Description

Information about a CloudTrail trail, including the trail's name, home Region, and Amazon Resource Name (ARN).

Members
HomeRegion
Type: string

The Amazon Web Services Region in which a trail was created.

Name
Type: string

The name of a trail.

TrailARN
Type: string

The ARN of a trail.

TrailNotFoundException

Description

This exception is thrown when the trail with the given name is not found.

Members

TrailNotProvidedException

Description

This exception is no longer in use.

Members

UnsupportedOperationException

Description

This exception is thrown when the requested operation is not supported.

Members