Skip to content

CloudTrailClient.create_trail

rboto-cloudtrail==0.4.0 · Service index · Types

Model summary (excerpt): Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Install and imports

python -m pip install "rboto[cloudtrail]==0.4.0"
from rboto import CloudTrailClient
from collections.abc import Sequence
from rboto_cloudtrail.types import (
    CreateTrailOutput,
    Tag,
)

Signature

async def create_trail(
    *,
    name: str,
    s3_bucket_name: str,
    s3_key_prefix: str | None = None,
    sns_topic_name: str | None = None,
    include_global_service_events: bool | None = None,
    is_multi_region_trail: bool | None = None,
    enable_log_file_validation: bool | None = None,
    cloud_watch_logs_log_group_arn: str | None = None,
    cloud_watch_logs_role_arn: str | None = None,
    kms_key_id: str | None = None,
    is_organization_trail: bool | None = None,
    tags_list: Sequence[Tag] | None = None,
    recursive_logging: bool | None = None,
) -> CreateTrailOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
name Yes 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...
s3_bucket_name Yes 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 .
s3_key_prefix No 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.
sns_topic_name No Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.
include_global_service_events No Specifies whether the trail is publishing events from global services such as IAM to the log files. Setting this value to true only delivers global service events to the trail if the trail is multi-Region or if the trail's home Region is the partition leader Region (for example, us-east-1).
is_multi_region_trail No 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.
enable_log_file_validation No 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...
cloud_watch_logs_log_group_arn No 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 .
cloud_watch_logs_role_arn No 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.
kms_key_id No Specifies the KMS key ID to use to encrypt the logs and digest files 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...
is_organization_trail No 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.
tags_list No
recursive_logging No Specifies whether recursive logging is enabled for the trail. If you set RecursiveLogging to false , CloudTrail suppresses events generated by CloudTrail when it delivers log files to your trail's destinations, including Amazon S3 and CloudWatch Logs. The default value is true .

Output

CreateTrailOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
name str | None Always present —
s3_bucket_name str | None Always present —
s3_key_prefix str | None Always present —
sns_topic_name str | None Always present —
sns_topic_arn str | None Always present —
include_global_service_events bool | None Always present —
is_multi_region_trail bool | None Always present —
trail_arn str | None Always present —
log_file_validation_enabled bool | None Always present —
cloud_watch_logs_log_group_arn str | None Always present —
cloud_watch_logs_role_arn str | None Always present —
kms_key_id str | None Always present —
is_organization_trail bool | None Always present —
recursive_logging bool | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

CreateTrailOutput, Tag

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudtrail.exceptions:

CloudTrailAccessNotEnabledError, CloudTrailInvalidClientTokenIdError, CloudWatchLogsDeliveryUnavailableError, ConflictError, InsufficientDependencyServiceAccessPermissionError, InsufficientEncryptionPolicyError, InsufficientS3BucketPolicyError, InsufficientSnsTopicPolicyError, InvalidCloudWatchLogsLogGroupArnError, InvalidCloudWatchLogsRoleArnError, InvalidKmsKeyIdError, InvalidParameterCombinationError, InvalidParameterError, InvalidS3BucketNameError, InvalidS3PrefixError, InvalidSnsTopicNameError, InvalidTagParameterError, InvalidTrailNameError, KmsError, KmsKeyDisabledError, KmsKeyNotFoundError, MaximumNumberOfTrailsExceededError, NoManagementAccountSLRExistsError, NotOrganizationMasterAccountError, OperationNotPermittedError, OrganizationNotInAllFeaturesModeError, OrganizationsNotInUseError, S3BucketDoesNotExistError, TagsLimitExceededError, ThrottlingError, TrailAlreadyExistsError, TrailNotProvidedError, UnsupportedOperationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model