CloudTrail — boto v2.16.0

### Navigation

- index
- modules |
- next |
- previous |
- boto v2.16.0 »

# CloudTrail

## boto.cloudtrail

`boto.cloudtrail.` `connect_to_region`(region_name, **kw_params)

`boto.cloudtrail.` `regions`()

  Get all available regions for the AWS Cloudtrail service.

  Return type: | list
  Returns: | A list of `boto.regioninfo.RegionInfo`

## boto.cloudtrail.layer1

class `boto.cloudtrail.layer1.` `CloudTrailConnection`(**kwargs)

  AWS Cloud Trail This is the CloudTrail API Reference. It provides descriptions of actions, data types, common parameters, and common errors for CloudTrail.

  CloudTrail is a web service that records AWS API calls for your AWS account and delivers log files to an Amazon S3 bucket. The recorded information includes the identity of the user, the start time of the event, the source IP address, the request parameters, and the response elements returned by the service.

  As an alternative to using the API, you can use one of the AWS SDKs, which consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to AWSCloudTrail. For example, the SDKs take care of cryptographically signing requests, managing errors, and retrying requests automatically. For information about the AWS SDKs, including how to download and install them, see the `Tools for Amazon Web Services page`_.

  See the CloudTrail User Guide for information about the data that is included with each event listed in the log files.

  `APIVersion` = '2013-11-01'
  `DefaultRegionEndpoint` = 'cloudtrail.us-east-1.amazonaws.com'
  `DefaultRegionName` = 'us-east-1'
  `ResponseError`

    alias of `JSONResponseError`

  `ServiceName` = 'CloudTrail'
  `TargetPrefix` = 'com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101'
  `create_trail`(trail=None)

    From the command line, use create-subscription.

    Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket. The request includes a Trail structure that specifies the following:

    - Trail name.
    - The name of the Amazon S3 bucket to which CloudTrail delivers your log files.
    - The name of the Amazon S3 key prefix that precedes each log file.
    - The name of the Amazon SNS topic that notifies you that a new file is available in your bucket.
    - Whether the log file should include events from global services. Currently, the only events included in CloudTrail log files are from IAM and AWS STS.

    Returns the appropriate HTTP status code if successful. If not, it returns either one of the CommonErrors or a FrontEndException with one of the following error codes:

    MaximumNumberOfTrailsExceeded

    An attempt was made to create more trails than allowed. You can only create one trail for each account in each region.

    TrailAlreadyExists

    At attempt was made to create a trail with a name that already exists.

    S3BucketDoesNotExist

    Specified Amazon S3 bucket does not exist.

    InsufficientS3BucketPolicy

    Policy on Amazon S3 bucket does not permit CloudTrail to write to your bucket. See the AWS AWS CloudTrail User Guide for the required bucket policy.

    InsufficientSnsTopicPolicy

    The policy on Amazon SNS topic does not permit CloudTrail to write to it. Can also occur when an Amazon SNS topic does not exist.

    Parameters: | trail (dict) – Contains the Trail structure that specifies the settings for each trail.

  `delete_trail`(name=None)

    Deletes a trail.

    Parameters: | name (string) – The name of a trail to be deleted.

  `describe_trails`(trail_name_list=None)

    Retrieves the settings for some or all trails associated with an account. Returns a list of Trail structures in JSON format.

    Parameters: | trail_name_list (list) – The list of Trail object names.

  `get_trail_status`(name=None)

    Returns GetTrailStatusResult, which contains a JSON-formatted list of information about the trail specified in the request. JSON fields include information such as delivery errors, Amazon SNS and Amazon S3 errors, and times that logging started and stopped for each trail.

    Parameters: | name (string) – The name of the trail for which you are requesting the current status.

  `make_request`(action, body)
  `start_logging`(name=None)

    Starts the processing of recording user activity events and log file delivery for a trail.

    Parameters: | name (string) – The name of the Trail for which CloudTrail logs events.

  `stop_logging`(name=None)

    Suspends the recording of user activity events 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 logging activity.

    Parameters: | name (string) – Communicates to CloudTrail the name of the Trail for which to stop logging events.

  `update_trail`(trail=None)

    From the command line, use update-subscription.

    Updates the settings that specify delivery of log files. Changes to a trail do not require stopping the CloudTrail service. You can use this action to designate an existing bucket for log delivery, or to create a new bucket and prefix. If the existing bucket has previously been a target for CloudTrail log files, an IAM policy exists for the bucket. If you create a new bucket using UpdateTrail, you need to apply the policy to the bucket using one of the means provided by the Amazon S3 service.

    The request includes a Trail structure that specifies the following:

    - Trail name.
    - The name of the Amazon S3 bucket to which CloudTrail delivers your log files.
    - The name of the Amazon S3 key prefix that precedes each log file.
    - The name of the Amazon SNS topic that notifies you that a new file is available in your bucket.
    - Whether the log file should include events from global services, such as IAM or AWS STS.

    CreateTrail returns the appropriate HTTP status code if successful. If not, it returns either one of the common errors or one of the exceptions listed at the end of this page.

    Parameters: | trail (dict) – Represents the Trail structure that contains the CloudTrail setting for an account.

## boto.cloudtrail.exceptions

Exceptions that are specific to the cloudtrail module.

exception `boto.cloudtrail.exceptions.` `InsufficientS3BucketPolicyException`(status, reason, body=None, *args)

  Raised when the S3 bucket does not allow Cloudtrail to write files into the prefix.

exception `boto.cloudtrail.exceptions.` `InsufficientSnsTopicPolicyException`(status, reason, body=None, *args)

  Raised when the SNS topic does not allow Cloudtrail to post messages.

exception `boto.cloudtrail.exceptions.` `InternalErrorException`(status, reason, body=None, *args)

  Raised when there was an internal Cloudtrail error.

exception `boto.cloudtrail.exceptions.` `InvalidS3BucketNameException`(status, reason, body=None, *args)

  Raised when an invalid S3 bucket name is passed to Cloudtrail.

exception `boto.cloudtrail.exceptions.` `InvalidS3PrefixException`(status, reason, body=None, *args)

  Raised when an invalid key prefix is given.

exception `boto.cloudtrail.exceptions.` `InvalidSnsTopicNameException`(status, reason, body=None, *args)

  Raised when an invalid SNS topic name is passed to Cloudtrail.

exception `boto.cloudtrail.exceptions.` `InvalidTrailNameException`(status, reason, body=None, *args)

  Raised when the trail name is invalid.

exception `boto.cloudtrail.exceptions.` `MaximumNumberOfTrailsExceededException`(status, reason, body=None, *args)

  Raised when no more trails can be created.

exception `boto.cloudtrail.exceptions.` `S3BucketDoesNotExistException`(status, reason, body=None, *args)

  Raised when the given S3 bucket does not exist.

exception `boto.cloudtrail.exceptions.` `TrailAlreadyExistsException`(status, reason, body=None, *args)

  Raised when the given trail name already exists.

exception `boto.cloudtrail.exceptions.` `TrailNotFoundException`(status, reason, body=None, *args)

  Raised when the given trail name is not found.

exception `boto.cloudtrail.exceptions.` `TrailNotProvidedException`(status, reason, body=None, *args)

  Raised when no trail name was provided.

### Navigation

- index
- modules |
- next |
- previous |
- boto v2.16.0 »