Class: AWS.CloudTrail

Inherits:
AWS.Service show all
Identifier:
cloudtrail
API Version:
2013-11-01
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

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.

Note: As an alternative to 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 AWS CloudTrail User Guide for information about the data that is included with each AWS API call listed in the log files.

Sending a Request Using CloudTrail

var cloudtrail = new AWS.CloudTrail();
cloudtrail.addTags(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CloudTrail object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var cloudtrail = new AWS.CloudTrail({apiVersion: '2013-11-01'});

You can also set the API version globally in AWS.config.apiVersions using the cloudtrail service identifier:

AWS.config.apiVersions = {
  cloudtrail: '2013-11-01',
  // other service API versions
};

var cloudtrail = new AWS.CloudTrail();

Version:

  • 2013-11-01

Constructor Summary

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.CloudTrail(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a CloudTrail object

var cloudtrail = new AWS.CloudTrail({apiVersion: '2013-11-01'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.CloudTrail.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.CloudTrail.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.CloudTrail.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

addTags(params = {}, callback) ⇒ AWS.Request

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).

Service Reference:

Examples:

Calling the addTags operation

var params = {
  ResourceId: 'STRING_VALUE', /* required */
  TagsList: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
cloudtrail.addTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceId — (String)

      Specifies the ARN of the trail to which one or more tags will be added. The format of a trail ARN is:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    • TagsList — (Array<map>)

      Contains a list of CloudTrail tags, up to a limit of 50

      • Keyrequired — (String)

        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.

      • Value — (String)

        The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createTrail(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the createTrail operation

var params = {
  Name: 'STRING_VALUE', /* required */
  S3BucketName: 'STRING_VALUE', /* required */
  CloudWatchLogsLogGroupArn: 'STRING_VALUE',
  CloudWatchLogsRoleArn: 'STRING_VALUE',
  EnableLogFileValidation: true || false,
  IncludeGlobalServiceEvents: true || false,
  IsMultiRegionTrail: true || false,
  IsOrganizationTrail: true || false,
  KmsKeyId: 'STRING_VALUE',
  S3KeyPrefix: 'STRING_VALUE',
  SnsTopicName: 'STRING_VALUE'
};
cloudtrail.createTrail(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      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 invalid.

      • Not be in IP address format (for example, 192.168.5.4)

    • S3BucketName — (String)

      Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.

    • S3KeyPrefix — (String)

      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.

    • SnsTopicName — (String)

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

    • IncludeGlobalServiceEvents — (Boolean)

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

    • IsMultiRegionTrail — (Boolean)

      Specifies whether the trail is created in the current region or in all regions. The default is false.

    • EnableLogFileValidation — (Boolean)

      Specifies whether log file integrity validation is enabled. The default is false.

      Note: When 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.
    • CloudWatchLogsLogGroupArn — (String)

      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.

    • CloudWatchLogsRoleArn — (String)

      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

    • KmsKeyId — (String)

      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.

      Examples:

      • alias/MyAliasName

      • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

      • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

      • 12345678-1234-1234-1234-123456789012

    • IsOrganizationTrail — (Boolean)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.

      • SnsTopicName — (String)

        This field is deprecated. Use SnsTopicARN.

      • SnsTopicARN — (String)

        Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:

        arn:aws:sns:us-east-2:123456789012:MyTopic

      • IncludeGlobalServiceEvents — (Boolean)

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

      • IsMultiRegionTrail — (Boolean)

        Specifies whether the trail exists in one region or in all regions.

      • TrailARN — (String)

        Specifies the ARN of the trail that was created. The format of a trail ARN is:

        arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

      • LogFileValidationEnabled — (Boolean)

        Specifies whether log file integrity validation is enabled.

      • CloudWatchLogsLogGroupArn — (String)

        Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.

      • CloudWatchLogsRoleArn — (String)

        Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

      • KmsKeyId — (String)

        Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:

        arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

      • IsOrganizationTrail — (Boolean)

        Specifies whether the trail is an organization trail.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteTrail(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the deleteTrail operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
cloudtrail.deleteTrail(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTrails(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the describeTrails operation

var params = {
  includeShadowTrails: true || false,
  trailNameList: [
    'STRING_VALUE',
    /* more items */
  ]
};
cloudtrail.describeTrails(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • trailNameList — (Array<String>)

      Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

      If an empty list is specified, information for the trail in the current region is returned.

      • If an empty list is specified and IncludeShadowTrails is false, then information for all trails in the current region is returned.

      • If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current region and any associated shadow trails in other regions is returned.

      Note: If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current region. To return information about a trail in another region, you must specify its trail ARN.
    • includeShadowTrails — (Boolean)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • trailList — (Array<map>)

        The list of trail objects.

        • Name — (String)

          Name of the trail set by calling CreateTrail. The maximum length is 128 characters.

        • S3BucketName — (String)

          Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket Naming Requirements.

        • S3KeyPrefix — (String)

          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.

        • SnsTopicName — (String)

          This field is deprecated. Use SnsTopicARN.

        • SnsTopicARN — (String)

          Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:

          arn:aws:sns:us-east-2:123456789012:MyTopic

        • IncludeGlobalServiceEvents — (Boolean)

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

        • IsMultiRegionTrail — (Boolean)

          Specifies whether the trail belongs only to one region or exists in all regions.

        • HomeRegion — (String)

          The region in which the trail was created.

        • TrailARN — (String)

          Specifies the ARN of the trail. The format of a trail ARN is:

          arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

        • LogFileValidationEnabled — (Boolean)

          Specifies whether log file validation is enabled.

        • CloudWatchLogsLogGroupArn — (String)

          Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered.

        • CloudWatchLogsRoleArn — (String)

          Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

        • KmsKeyId — (String)

          Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:

          arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

        • HasCustomEventSelectors — (Boolean)

          Specifies if the trail has custom event selectors.

        • IsOrganizationTrail — (Boolean)

          Specifies whether the trail is an organization trail.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getEventSelectors(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getEventSelectors operation

var params = {
  TrailName: 'STRING_VALUE' /* required */
};
cloudtrail.getEventSelectors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TrailName — (String)

      Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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 address format (for example, 192.168.5.4)

      If you specify a trail ARN, it must be in the format:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TrailARN — (String)

        The specified trail ARN that has the event selectors.

      • EventSelectors — (Array<map>)

        The event selectors that are configured for the trail.

        • ReadWriteType — (String)

          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.

          By default, the value is All.

          Possible values include:
          • "ReadOnly"
          • "WriteOnly"
          • "All"
        • IncludeManagementEvents — (Boolean)

          Specify if you want your event selector to include management events for your trail.

          For more information, see Management Events in the AWS CloudTrail User Guide.

          By default, the value is true.

        • DataResources — (Array<map>)

          CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events.

          For more information, see Data Events and Limits in AWS CloudTrail in the AWS CloudTrail User Guide.

          • Type — (String)

            The resource type in which you want to log data events. You can specify AWS::S3::Object or AWS::Lambda::Function resources.

          • Values — (Array<String>)

            An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified objects.

            • To log data events for all objects in all S3 buckets in your AWS account, specify the prefix as arn:aws:s3:::.

              Note: This will also enable logging of data event activity performed by any user or role in your AWS account, even if that activity is performed on a bucket that belongs to another AWS account.
            • To log data events for all objects in all S3 buckets that include my-bucket in their names, specify the prefix as aws:s3:::my-bucket. The trail logs data events for all objects in all buckets whose name contains a match for my-bucket.

            • To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::bucket-1/. The trail logs data events for all objects in this S3 bucket.

            • To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::bucket-1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.

            • To log data events for all functions in your AWS account, specify the prefix as arn:aws:lambda.

              Note: This will also enable logging of Invoke activity performed by any user or role in your AWS account, even if that activity is performed on a function that belongs to another AWS account.
            • To log data eents for a specific Lambda function, specify the function ARN.

              Note: Lambda function ARNs are exact. Unlike S3, you cannot use matching. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getTrailStatus(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getTrailStatus operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
cloudtrail.getTrailStatus(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      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:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

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

        Note: This error occurs only when there is a problem with the destination S3 bucket and will not occur for timeouts. To resolve the issue, create a new bucket and call UpdateTrail to specify the new bucket, or fix the existing objects so that CloudTrail can again write to the bucket.
      • 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 — (Date)

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

      • LatestNotificationTime — (Date)

        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 — (Date)

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

      • StopLoggingTime — (Date)

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

      • LatestCloudWatchLogsDeliveryError — (String)

        Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs.

      • LatestCloudWatchLogsDeliveryTime — (Date)

        Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs.

      • LatestDigestDeliveryTime — (Date)

        Specifies the date and time that CloudTrail last delivered a digest file to an account's Amazon S3 bucket.

      • LatestDigestDeliveryError — (String)

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

        Note: This error occurs only when there is a problem with the destination S3 bucket and will not occur for timeouts. To resolve the issue, create a new bucket and call UpdateTrail to specify the new bucket, or fix the existing objects so that CloudTrail can again write to the bucket.
      • LatestDeliveryAttemptTime — (String)

        This field is deprecated.

      • LatestNotificationAttemptTime — (String)

        This field is deprecated.

      • LatestNotificationAttemptSucceeded — (String)

        This field is deprecated.

      • LatestDeliveryAttemptSucceeded — (String)

        This field is deprecated.

      • TimeLoggingStarted — (String)

        This field is deprecated.

      • TimeLoggingStopped — (String)

        This field is deprecated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listPublicKeys(params = {}, callback) ⇒ AWS.Request

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.

Note: 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.

Service Reference:

Examples:

Calling the listPublicKeys operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  NextToken: 'STRING_VALUE',
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789
};
cloudtrail.listPublicKeys(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • StartTime — (Date)

      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.

    • EndTime — (Date)

      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.

    • NextToken — (String)

      Reserved for future use.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • PublicKeyList — (Array<map>)

        Contains an array of PublicKey objects.

        Note: The returned public keys may have validity time ranges that overlap.
        • Value — (Buffer, Typed Array, Blob, String)

          The DER encoded public key value in PKCS#1 format.

        • ValidityStartTime — (Date)

          The starting time of validity of the public key.

        • ValidityEndTime — (Date)

          The ending time of validity of the public key.

        • Fingerprint — (String)

          The fingerprint of the public key.

      • NextToken — (String)

        Reserved for future use.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTags(params = {}, callback) ⇒ AWS.Request

Lists the tags for the trail in the current region.

Service Reference:

Examples:

Calling the listTags operation

var params = {
  ResourceIdList: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  NextToken: 'STRING_VALUE'
};
cloudtrail.listTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceIdList — (Array<String>)

      Specifies a list of trail ARNs whose tags will be listed. The list has a limit of 20 ARNs. The format of a trail ARN is:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    • NextToken — (String)

      Reserved for future use.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceTagList — (Array<map>)

        A list of resource tags.

        • ResourceId — (String)

          Specifies the ARN of the resource.

        • TagsList — (Array<map>)

          A list of tags.

          • Keyrequired — (String)

            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.

          • Value — (String)

            The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

      • NextToken — (String)

        Reserved for future use.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

lookupEvents(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the lookupEvents operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  LookupAttributes: [
    {
      AttributeKey: EventId | EventName | ReadOnly | Username | ResourceType | ResourceName | EventSource | AccessKeyId, /* required */
      AttributeValue: 'STRING_VALUE' /* required */
    },
    /* more items */
  ],
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789
};
cloudtrail.lookupEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LookupAttributes — (Array<map>)

      Contains a list of lookup attributes. Currently the list can contain only one item.

      • AttributeKeyrequired — (String)

        Specifies an attribute on which to filter the events returned.

        Possible values include:
        • "EventId"
        • "EventName"
        • "ReadOnly"
        • "Username"
        • "ResourceType"
        • "ResourceName"
        • "EventSource"
        • "AccessKeyId"
      • AttributeValuerequired — (String)

        Specifies a value for the specified AttributeKey.

    • StartTime — (Date)

      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.

    • EndTime — (Date)

      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.

    • MaxResults — (Integer)

      The number of events to return. Possible values are 1 through 50. The default is 50.

    • NextToken — (String)

      The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Events — (Array<map>)

        A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.

        • EventId — (String)

          The CloudTrail ID of the event returned.

        • EventName — (String)

          The name of the event returned.

        • ReadOnly — (String)

          Information about whether the event is a write event or a read event.

        • AccessKeyId — (String)

          The AWS access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.

        • EventTime — (Date)

          The date and time of the event returned.

        • EventSource — (String)

          The AWS service that the request was made to.

        • Username — (String)

          A user name or role name of the requester that called the API in the event returned.

        • Resources — (Array<map>)

          A list of resources referenced by the event returned.

          • ResourceType — (String)

            The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: Instance for EC2, Trail for CloudTrail, DBInstance for RDS, and AccessKey for IAM. For a list of resource types supported for event lookup, see Resource Types Supported for Event Lookup.

          • ResourceName — (String)

            The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto-scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance.

        • CloudTrailEvent — (String)

          A JSON string that contains a representation of the event returned.

      • NextToken — (String)

        The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putEventSelectors(params = {}, callback) ⇒ AWS.Request

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

  1. You create an event selector for a trail and specify that you want write-only events.

  2. The EC2 GetConsoleOutput and RunInstances API operations occur in your account.

  3. CloudTrail evaluates whether the events match your event selectors.

  4. The RunInstances is a write-only event and it matches your event selector. The trail logs the event.

  5. 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.

Service Reference:

Examples:

Calling the putEventSelectors operation

var params = {
  EventSelectors: [ /* required */
    {
      DataResources: [
        {
          Type: 'STRING_VALUE',
          Values: [
            'STRING_VALUE',
            /* more items */
          ]
        },
        /* more items */
      ],
      IncludeManagementEvents: true || false,
      ReadWriteType: ReadOnly | WriteOnly | All
    },
    /* more items */
  ],
  TrailName: 'STRING_VALUE' /* required */
};
cloudtrail.putEventSelectors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TrailName — (String)

      Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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 invalid.

      • Not be in IP address format (for example, 192.168.5.4)

      If you specify a trail ARN, it must be in the format:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    • EventSelectors — (Array<map>)

      Specifies the settings for your event selectors. You can configure up to five event selectors for a trail.

      • ReadWriteType — (String)

        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.

        By default, the value is All.

        Possible values include:
        • "ReadOnly"
        • "WriteOnly"
        • "All"
      • IncludeManagementEvents — (Boolean)

        Specify if you want your event selector to include management events for your trail.

        For more information, see Management Events in the AWS CloudTrail User Guide.

        By default, the value is true.

      • DataResources — (Array<map>)

        CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events.

        For more information, see Data Events and Limits in AWS CloudTrail in the AWS CloudTrail User Guide.

        • Type — (String)

          The resource type in which you want to log data events. You can specify AWS::S3::Object or AWS::Lambda::Function resources.

        • Values — (Array<String>)

          An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified objects.

          • To log data events for all objects in all S3 buckets in your AWS account, specify the prefix as arn:aws:s3:::.

            Note: This will also enable logging of data event activity performed by any user or role in your AWS account, even if that activity is performed on a bucket that belongs to another AWS account.
          • To log data events for all objects in all S3 buckets that include my-bucket in their names, specify the prefix as aws:s3:::my-bucket. The trail logs data events for all objects in all buckets whose name contains a match for my-bucket.

          • To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::bucket-1/. The trail logs data events for all objects in this S3 bucket.

          • To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::bucket-1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.

          • To log data events for all functions in your AWS account, specify the prefix as arn:aws:lambda.

            Note: This will also enable logging of Invoke activity performed by any user or role in your AWS account, even if that activity is performed on a function that belongs to another AWS account.
          • To log data eents for a specific Lambda function, specify the function ARN.

            Note: Lambda function ARNs are exact. Unlike S3, you cannot use matching. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TrailARN — (String)

        Specifies the ARN of the trail that was updated with event selectors. The format of a trail ARN is:

        arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

      • EventSelectors — (Array<map>)

        Specifies the event selectors configured for your trail.

        • ReadWriteType — (String)

          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.

          By default, the value is All.

          Possible values include:
          • "ReadOnly"
          • "WriteOnly"
          • "All"
        • IncludeManagementEvents — (Boolean)

          Specify if you want your event selector to include management events for your trail.

          For more information, see Management Events in the AWS CloudTrail User Guide.

          By default, the value is true.

        • DataResources — (Array<map>)

          CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events.

          For more information, see Data Events and Limits in AWS CloudTrail in the AWS CloudTrail User Guide.

          • Type — (String)

            The resource type in which you want to log data events. You can specify AWS::S3::Object or AWS::Lambda::Function resources.

          • Values — (Array<String>)

            An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified objects.

            • To log data events for all objects in all S3 buckets in your AWS account, specify the prefix as arn:aws:s3:::.

              Note: This will also enable logging of data event activity performed by any user or role in your AWS account, even if that activity is performed on a bucket that belongs to another AWS account.
            • To log data events for all objects in all S3 buckets that include my-bucket in their names, specify the prefix as aws:s3:::my-bucket. The trail logs data events for all objects in all buckets whose name contains a match for my-bucket.

            • To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::bucket-1/. The trail logs data events for all objects in this S3 bucket.

            • To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::bucket-1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.

            • To log data events for all functions in your AWS account, specify the prefix as arn:aws:lambda.

              Note: This will also enable logging of Invoke activity performed by any user or role in your AWS account, even if that activity is performed on a function that belongs to another AWS account.
            • To log data eents for a specific Lambda function, specify the function ARN.

              Note: Lambda function ARNs are exact. Unlike S3, you cannot use matching. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

removeTags(params = {}, callback) ⇒ AWS.Request

Removes the specified tags from a trail.

Service Reference:

Examples:

Calling the removeTags operation

var params = {
  ResourceId: 'STRING_VALUE', /* required */
  TagsList: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
cloudtrail.removeTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceId — (String)

      Specifies the ARN of the trail from which tags should be removed. The format of a trail ARN is:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    • TagsList — (Array<map>)

      Specifies a list of tags to be removed.

      • Keyrequired — (String)

        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.

      • Value — (String)

        The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startLogging(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the startLogging operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
cloudtrail.startLogging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs AWS API calls. The format of a trail ARN is:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

stopLogging(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the stopLogging operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
cloudtrail.stopLogging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      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:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateTrail(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the updateTrail operation

var params = {
  Name: 'STRING_VALUE', /* required */
  CloudWatchLogsLogGroupArn: 'STRING_VALUE',
  CloudWatchLogsRoleArn: 'STRING_VALUE',
  EnableLogFileValidation: true || false,
  IncludeGlobalServiceEvents: true || false,
  IsMultiRegionTrail: true || false,
  IsOrganizationTrail: true || false,
  KmsKeyId: 'STRING_VALUE',
  S3BucketName: 'STRING_VALUE',
  S3KeyPrefix: 'STRING_VALUE',
  SnsTopicName: 'STRING_VALUE'
};
cloudtrail.updateTrail(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      Specifies the name of the trail or trail ARN. If Name is a trail name, the string 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 invalid.

      • Not be in IP address format (for example, 192.168.5.4)

      If Name is a trail ARN, it must be in the format:

      arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    • S3BucketName — (String)

      Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.

    • S3KeyPrefix — (String)

      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.

    • SnsTopicName — (String)

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.

    • IncludeGlobalServiceEvents — (Boolean)

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

    • IsMultiRegionTrail — (Boolean)

      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.

    • EnableLogFileValidation — (Boolean)

      Specifies whether log file validation is enabled. The default is false.

      Note: When 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.
    • CloudWatchLogsLogGroupArn — (String)

      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.

    • CloudWatchLogsRoleArn — (String)

      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

    • KmsKeyId — (String)

      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.

      Examples:

      • alias/MyAliasName

      • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName

      • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

      • 12345678-1234-1234-1234-123456789012

    • IsOrganizationTrail — (Boolean)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.

      • SnsTopicName — (String)

        This field is deprecated. Use SnsTopicARN.

      • SnsTopicARN — (String)

        Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:

        arn:aws:sns:us-east-2:123456789012:MyTopic

      • IncludeGlobalServiceEvents — (Boolean)

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

      • IsMultiRegionTrail — (Boolean)

        Specifies whether the trail exists in one region or in all regions.

      • TrailARN — (String)

        Specifies the ARN of the trail that was updated. The format of a trail ARN is:

        arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

      • LogFileValidationEnabled — (Boolean)

        Specifies whether log file integrity validation is enabled.

      • CloudWatchLogsLogGroupArn — (String)

        Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.

      • CloudWatchLogsRoleArn — (String)

        Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

      • KmsKeyId — (String)

        Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:

        arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012

      • IsOrganizationTrail — (Boolean)

        Specifies whether the trail is an organization trail.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.