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 AWS API call, 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 AWS API call 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(name=None, s3_bucket_name=None, s3_key_prefix=None, sns_topic_name=None, include_global_service_events=None, 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.

Support for passing Trail as a parameter ends as early as February 25, 2014. The request and response examples in this topic show the use of parameters as well as a Trail object. Until Trail is removed, you can use either Trail or the parameter list.

Parameters:
  • name (string) – Specifies the name of the trail.
  • s3_bucket_name (string) – Specifies the name of the Amazon S3 bucket designated for publishing log files.
  • s3_key_prefix (string) – Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.
  • sns_topic_name (string) – Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
  • include_global_service_events (boolean) – Specifies whether the trail is publishing events from global services such as IAM to the log files.
  • trail (dict) – Support for passing a Trail object in the CreateTrail or UpdateTrail actions will end as early as February 15, 2014. Instead of the Trail object and its members, use the parameters listed for these actions.
delete_trail(name)

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.

Parameters:trail_name_list (list) – The list of trails.
get_trail_status(name)

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.

The CloudTrail API is currently undergoing revision. This action currently returns both new fields and fields slated for removal from the API. The following lists indicate the plans for each field:

List of Members Planned for Ongoing Support

  • IsLogging
  • LatestDeliveryTime
  • LatestNotificationTime
  • StartLoggingTime
  • StopLoggingTime
  • LatestNotificationError
  • LatestDeliveryError

List of Members Scheduled for Removal

  • LatestDeliveryAttemptTime: Use LatestDeliveryTime instead.
  • LatestNotificationAttemptTime: Use LatestNotificationTime instead.
  • LatestDeliveryAttemptSucceeded: No replacement. See the note following this list.
  • LatestNotificationAttemptSucceeded: No replacement. See the note following this list.
  • TimeLoggingStarted: Use StartLoggingTime instead.
  • TimeLoggingStopped: Use StopLoggingtime instead.

No replacements have been created for LatestDeliveryAttemptSucceeded and LatestNotificationAttemptSucceeded . Use LatestDeliveryError and LatestNotificationError to evaluate success or failure of log delivery or notification. Empty values returned for these fields indicate success. An error in LatestDeliveryError generally indicates either a missing bucket or insufficient permissions to write to the bucket. Similarly, an error in LatestNotificationError indicates either a missing topic or insufficient permissions.

Parameters:name (string) – The name of the trail for which you are requesting the current status.
make_request(action, body)
start_logging(name)

Starts the recording of AWS API calls and log file delivery for a trail.

Parameters:name (string) – The name of the trail for which CloudTrail logs AWS API calls.
stop_logging(name)

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.

Parameters:name (string) – Communicates to CloudTrail the name of the trail for which to stop logging AWS API calls.
update_trail(name=None, s3_bucket_name=None, s3_key_prefix=None, sns_topic_name=None, include_global_service_events=None, 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. 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.

Support for passing Trail as a parameter ends as early as February 25, 2014. The request and response examples in this topic show the use of parameters as well as a Trail object. Until Trail is removed, you can use either Trail or the parameter list.

Parameters:
  • name (string) – Specifies the name of the trail.
  • s3_bucket_name (string) – Specifies the name of the Amazon S3 bucket designated for publishing log files.
  • s3_key_prefix (string) – Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.
  • sns_topic_name (string) – Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
  • include_global_service_events (boolean) – Specifies whether the trail is publishing events from global services such as IAM to the log files.
  • trail (dict) – Support for passing a Trail object in the CreateTrail or UpdateTrail actions will end as early as February 15, 2014. Instead of the Trail object and its members, use the parameters listed for these actions.

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.

Table Of Contents

Previous topic

Cloudsearch

Next topic

CloudWatch Reference

This Page

PDF Version