AWS CloudTrail

2014/10/16 - AWS CloudTrail - 7 new api methods

DeleteTrail (new) Link ¶

Deletes a trail.

Request Syntax

client.delete_trail(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of a trail to be deleted.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

StopLogging (new) Link ¶

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.

Request Syntax

client.stop_logging(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

Communicates to CloudTrail the name of the trail for which to stop logging AWS API calls.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

CreateTrail (new) Link ¶

From the command line, use create-subscription .

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

Request Syntax

client.create_trail(
    Name='string',
    S3BucketName='string',
    S3KeyPrefix='string',
    SnsTopicName='string',
    IncludeGlobalServiceEvents=True|False
)
type Name

string

param Name

[REQUIRED]

Specifies the name of the trail.

type S3BucketName

string

param S3BucketName

[REQUIRED]

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

type S3KeyPrefix

string

param S3KeyPrefix

Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

type SnsTopicName

string

param SnsTopicName

Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

type IncludeGlobalServiceEvents

boolean

param IncludeGlobalServiceEvents

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

rtype

dict

returns

Response Syntax

{
    'Name': 'string',
    'S3BucketName': 'string',
    'S3KeyPrefix': 'string',
    'SnsTopicName': 'string',
    'IncludeGlobalServiceEvents': True|False
}

Response Structure

  • (dict) -- Returns the objects or data listed below if successful. Otherwise, returns an error.

    • Name (string) --

      Specifies the name of the trail.

    • S3BucketName (string) --

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

    • S3KeyPrefix (string) --

      Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

    • SnsTopicName (string) --

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

    • IncludeGlobalServiceEvents (boolean) --

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

GetTrailStatus (new) Link ¶

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.

Request Syntax

client.get_trail_status(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of the trail for which you are requesting the current status.

rtype

dict

returns

Response Syntax

{
    'IsLogging': True|False,
    'LatestDeliveryError': 'string',
    'LatestNotificationError': 'string',
    'LatestDeliveryTime': datetime(2015, 1, 1),
    'LatestNotificationTime': datetime(2015, 1, 1),
    'StartLoggingTime': datetime(2015, 1, 1),
    'StopLoggingTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

    • IsLogging (boolean) --

      Whether the CloudTrail is currently logging AWS API calls.

    • LatestDeliveryError (string) --

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

    • LatestNotificationError (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.

    • LatestDeliveryTime (datetime) --

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

    • LatestNotificationTime (datetime) --

      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 (datetime) --

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

    • StopLoggingTime (datetime) --

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

DescribeTrails (new) Link ¶

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

Request Syntax

client.describe_trails(
    trailNameList=[
        'string',
    ]
)
type trailNameList

list

param trailNameList

The trail returned.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'trailList': [
        {
            'Name': 'string',
            'S3BucketName': 'string',
            'S3KeyPrefix': 'string',
            'SnsTopicName': 'string',
            'IncludeGlobalServiceEvents': True|False
        },
    ]
}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

    • trailList (list) --

      The list of trails.

      • (dict) --

        The settings for a trail.

        • Name (string) --

          Name of the trail set by calling CreateTrail.

        • S3BucketName (string) --

          Name of the Amazon S3 bucket into which CloudTrail delivers your trail files.

        • S3KeyPrefix (string) --

          Value of the Amazon S3 prefix.

        • SnsTopicName (string) --

          Name of the existing Amazon SNS topic that CloudTrail uses to notify the account owner when new CloudTrail log files have been delivered.

        • IncludeGlobalServiceEvents (boolean) --

          Set to True to include AWS API calls from AWS global services such as IAM. Otherwise, False .

UpdateTrail (new) Link ¶

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.

Request Syntax

client.update_trail(
    Name='string',
    S3BucketName='string',
    S3KeyPrefix='string',
    SnsTopicName='string',
    IncludeGlobalServiceEvents=True|False
)
type Name

string

param Name

[REQUIRED]

Specifies the name of the trail.

type S3BucketName

string

param S3BucketName

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

type S3KeyPrefix

string

param S3KeyPrefix

Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

type SnsTopicName

string

param SnsTopicName

Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

type IncludeGlobalServiceEvents

boolean

param IncludeGlobalServiceEvents

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

rtype

dict

returns

Response Syntax

{
    'Name': 'string',
    'S3BucketName': 'string',
    'S3KeyPrefix': 'string',
    'SnsTopicName': 'string',
    'IncludeGlobalServiceEvents': True|False
}

Response Structure

  • (dict) -- Returns the objects or data listed below if successful. Otherwise, returns an error.

    • Name (string) --

      Specifies the name of the trail.

    • S3BucketName (string) --

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

    • S3KeyPrefix (string) --

      Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

    • SnsTopicName (string) --

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

    • IncludeGlobalServiceEvents (boolean) --

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

StartLogging (new) Link ¶

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

Request Syntax

client.start_logging(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of the trail for which CloudTrail logs AWS API calls.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.