Icon

AWS CloudTrail (version v1.*.*)

add_tags

Adds one or more tags to a trail, up to a limit of 50. Tags must be unique per trail. Overwrites an existing tag's value when a new value is specified for an existing tag key. 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 that applies to all regions only from the region in which the trail was created (that is, from its home region).

Parameters

$body

Specifies the tags to add to a trail.

Type: object

{
"ResourceId" : "Specifies the ARN of the trail to which one or more tags will be added. The format of a trail ARN is: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail ",
"TagsList" : [ {
"Value" : "The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.",
"Key" : "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."
} ]
}

create_trail

Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket. A maximum of five trails can exist in a region, irrespective of the region in which they were created.

Parameters

$body

Specifies the settings for each trail.

Type: object

{
"CloudWatchLogsLogGroupArn" : "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. Not required unless you specify CloudWatchLogsRoleArn.",
"IncludeGlobalServiceEvents" : "Specifies whether the trail is publishing events from global services such as IAM to the log files.",
"SnsTopicName" : "Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.",
"KmsKeyId" : "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. \nExamples: \n alias/MyAliasName \n arn:aws:kms:us-east-2:123456789012:alias/MyAliasName \n arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012 \n 12345678-1234-1234-1234-123456789012 ",
"CloudWatchLogsRoleArn" : "Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.",
"S3KeyPrefix" : "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.",
"IsMultiRegionTrail" : "Specifies whether the trail is created in the current region or in all regions. The default is false.",
"S3BucketName" : "Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.",
"EnableLogFileValidation" : "Specifies whether log file integrity validation is enabled. The default is false. \nWhen you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail will 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.",
"Name" : "Specifies the name of the trail. The name must meet the following requirements: \n Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) \n Start with a letter or number, and end with a letter or number \n Be between 3 and 128 characters \n Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid. \n Not be in IP address format (for example, 192.168.5.4) ",
"IsOrganizationTrail" : "Specifies whether the trail is created for all accounts in an organization in AWS Organizations, or only for the current AWS account. The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the master account for an organization in AWS Organizations."
}

delete_trail

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.

Parameters

$body

The request that specifies the name of a trail to delete.

Type: object

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

describe_trails

Retrieves settings for the trail associated with the current region for your account.

Parameters

$body

Returns information about the trail.

Type: object

{
"trailNameList" : [ "string" ],
"includeShadowTrails" : "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."
}

get_event_selectors

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 Amazon S3 objects or AWS Lambda functions that you are logging for data events.
For more information, see Logging Data and Management Events for Trails in the AWS CloudTrail User Guide.

Parameters

$body

Type: object

{
"TrailName" : "Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements: \n Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) \n Start with a letter or number, and end with a letter or number \n Be between 3 and 128 characters \n Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid. \n Not be in IP address format (for example, 192.168.5.4) \nIf you specify a trail ARN, it must be in the format: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail "
}

get_trail_status

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.

Parameters

$body

The name of a trail about which you want the current status.

Type: object

{
"Name" : "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 format of a trail ARN is: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail "
}

list_public_keys

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/public key pairs per region. Each digest file is signed with a private key unique to its region. Therefore, when you validate a digest file from a particular region, you must look in the same region for its corresponding public key.

Parameters

$body

Requests the public keys for a specified time range.

Type: object

{
"EndTime" : "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.",
"StartTime" : "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."
}

list_tags

Lists the tags for the trail in the current region.

Parameters

$body

Specifies a list of trail tags to return.

Type: object

{
"ResourceIdList" : [ "string" ]
}

lookup_events

Looks up management events captured by CloudTrail. Events for a region can be looked up in that region during the last 90 days. Lookup supports the following attributes:
AWS access key
Event ID
Event name
Event source
Read only
Resource name
Resource type
User name
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 one per second per account. If this limit is exceeded, a throttling error occurs.
Events that occurred during the selected time range will not be available for lookup if CloudTrail logging was not enabled when the events occurred.

Parameters

$body

Contains a request for LookupEvents.

Type: object

{
"EndTime" : "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.",
"StartTime" : "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.",
"LookupAttributes" : [ {
"AttributeKey" : "Specifies an attribute on which to filter the events returned.",
"AttributeValue" : "Specifies a value for the specified AttributeKey."
} ]
}

put_event_selectors

Configures an event selector for your trail. 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 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
You create an event selector for a trail and specify that you want write-only events.
The EC2 GetConsoleOutput and RunInstances API operations occur in your account.
CloudTrail evaluates whether the events match your event selectors.
The RunInstances is a write-only event and it matches your event selector. The trail logs the event.
The GetConsoleOutput is a read-only event but it 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 is thrown.
You can configure up to five event selectors for each trail. For more information, see Logging Data and Management Events for Trails and Limits in AWS CloudTrail in the AWS CloudTrail User Guide.

Parameters

$body

Type: object

{
"EventSelectors" : [ {
"IncludeManagementEvents" : "Specify if you want your event selector to include management events for your trail. \n For more information, see Management Events in the AWS CloudTrail User Guide. \nBy default, the value is true.",
"ReadWriteType" : "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. \n By default, the value is All.",
"DataResources" : [ {
"Type" : "The resource type in which you want to log data events. You can specify AWS::S3::Object or AWS::Lambda::Function resources.",
"Values" : [ "string" ]
} ]
} ],
"TrailName" : "Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements: \n Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) \n Start with a letter or number, and end with a letter or number \n Be between 3 and 128 characters \n Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid. \n Not be in IP address format (for example, 192.168.5.4) \nIf you specify a trail ARN, it must be in the format: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail "
}

remove_tags

Removes the specified tags from a trail.

Parameters

$body

Specifies the tags to remove from a trail.

Type: object

{
"ResourceId" : "Specifies the ARN of the trail from which tags should be removed. The format of a trail ARN is: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail ",
"TagsList" : [ {
"Value" : "The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.",
"Key" : "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."
} ]
}

start_logging

Starts the recording of AWS 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.

Parameters

$body

The request to CloudTrail to start logging AWS API calls for an account.

Type: object

{
"Name" : "Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs AWS API calls. The format of a trail ARN is: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail "
}

stop_logging

Suspends the recording of AWS 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.

Parameters

$body

Passes the request to CloudTrail to stop logging AWS API calls for the specified account.

Type: object

{
"Name" : "Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging AWS API calls. The format of a trail ARN is: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail "
}

update_trail

Updates the settings that specify delivery of 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.

Parameters

$body

Specifies settings to update for the trail.

Type: object

{
"CloudWatchLogsLogGroupArn" : "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. Not required unless you specify CloudWatchLogsRoleArn.",
"IncludeGlobalServiceEvents" : "Specifies whether the trail is publishing events from global services such as IAM to the log files.",
"SnsTopicName" : "Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.",
"KmsKeyId" : "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. \nExamples: \n alias/MyAliasName \n arn:aws:kms:us-east-2:123456789012:alias/MyAliasName \n arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012 \n 12345678-1234-1234-1234-123456789012 ",
"CloudWatchLogsRoleArn" : "Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.",
"S3KeyPrefix" : "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.",
"IsMultiRegionTrail" : "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.",
"S3BucketName" : "Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.",
"EnableLogFileValidation" : "Specifies whether log file validation is enabled. The default is false. \nWhen you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail will 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.",
"Name" : "Specifies the name of the trail or trail ARN. If Name is a trail name, the string must meet the following requirements: \n Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-) \n Start with a letter or number, and end with a letter or number \n Be between 3 and 128 characters \n Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid. \n Not be in IP address format (for example, 192.168.5.4) \nIf Name is a trail ARN, it must be in the format: \n arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail ",
"IsOrganizationTrail" : "Specifies whether the trail is applied to all accounts in an organization in AWS Organizations, or only for the current AWS account. The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the master account for an organization in AWS Organizations. If the trail is not an organization trail and this is set to true, the trail will be created in all AWS 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 AWS account but be deleted from all member accounts in the organization."
}