Class: AWS.CloudTrail
- Inherits:
-
AWS.Service
- Object
- AWS.Service
- AWS.CloudTrail
- 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 Amazon Web Services API calls for your Amazon Web Services account and delivers log files to an Amazon S3 bucket. The recorded information includes the identity of the user, the start time of the Amazon Web Services API call, the source IP address, the request parameters, and the response elements returned by the service.
See the CloudTrail User Guide for information about the data that is included with each Amazon Web Services 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 collapse
-
new AWS.CloudTrail(options = {}) ⇒ Object
constructor
Constructs a service object.
Property Summary collapse
-
endpoint ⇒ AWS.Endpoint
readwrite
An Endpoint object representing the endpoint URL for service requests.
Properties inherited from AWS.Service
Method Summary collapse
-
addTags(params = {}, callback) ⇒ AWS.Request
Adds one or more tags to a trail, up to a limit of 50.
-
createTrail(params = {}, callback) ⇒ AWS.Request
Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.
-
deleteTrail(params = {}, callback) ⇒ AWS.Request
Deletes a trail.
-
describeTrails(params = {}, callback) ⇒ AWS.Request
Retrieves settings for one or more trails associated with the current region for your account.
.
-
getEventSelectors(params = {}, callback) ⇒ AWS.Request
Describes the settings for the event selectors that you configured for your trail.
-
getInsightSelectors(params = {}, callback) ⇒ AWS.Request
Describes the settings for the Insights event selectors that you configured for your trail.
-
getTrail(params = {}, callback) ⇒ AWS.Request
Returns settings information for a specified trail.
.
-
getTrailStatus(params = {}, callback) ⇒ AWS.Request
Returns a JSON-formatted list of information about the specified trail.
-
listPublicKeys(params = {}, callback) ⇒ AWS.Request
Returns all public keys whose private keys were used to sign the digest files within the specified time range.
-
listTags(params = {}, callback) ⇒ AWS.Request
Lists the tags for the trail in the current region.
.
-
listTrails(params = {}, callback) ⇒ AWS.Request
Lists trails that are in the current account.
.
-
lookupEvents(params = {}, callback) ⇒ AWS.Request
Looks up management events or CloudTrail Insights events that are captured by CloudTrail.
-
putEventSelectors(params = {}, callback) ⇒ AWS.Request
Configures an event selector or advanced event selectors for your trail.
-
putInsightSelectors(params = {}, callback) ⇒ AWS.Request
Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail.
-
removeTags(params = {}, callback) ⇒ AWS.Request
Removes the specified tags from a trail.
.
-
startLogging(params = {}, callback) ⇒ AWS.Request
Starts the recording of Amazon Web Services API calls and log file delivery for a trail.
-
stopLogging(params = {}, callback) ⇒ AWS.Request
Suspends the recording of Amazon Web Services API calls and log file delivery for the specified trail.
-
updateTrail(params = {}, callback) ⇒ AWS.Request
Updates trail settings that control what events you are logging, and how to handle log files.
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|AWS.Endpoint)
—
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'
or an Endpoint object. -
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.
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
-
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 totrue
. -
s3UsEast1RegionalEndpoint
('legacy'|'regional')
—
when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to
legacy
-
s3UseArnRegion
(Boolean)
—
whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets 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 error and returns the amount of time to delay in
milliseconds. If the result is a non-zero negative value, no further
retry attempts will be made. The
base
option will be ignored if this option is supplied. The function is only called for retryable errors.
-
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|undefined)
—
whether to call operations with endpoints given by service dynamically. Setting this
-
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
. -
stsRegionalEndpoints
('legacy'|'regional')
—
whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.
Property Details
Method Details
addTags(params = {}, callback) ⇒ AWS.Request
Adds one or more tags to a trail, up to a limit of 50. Overwrites an existing tag's value when a new value is specified for an existing tag key. Tag key names must be unique for a trail; you cannot have two keys with the same name but different values. 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 Amazon Web Services Regions only from the Region in which the trail was created (also known as 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 tags, up to a limit of 50
Key
— required — (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.
-
(AWS.Response)
—
Returns:
createTrail(params = {}, callback) ⇒ AWS.Request
Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.
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',
TagsList: [
{
Key: 'STRING_VALUE', /* required */
Value: 'STRING_VALUE'
},
/* more items */
]
};
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
andmy--namespace
are not valid. -
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, which creates a trail only in the region where you are signed in. As a best practice, consider creating trails that log events in all regions.
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 does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on 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.
CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.
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 Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations.
TagsList
— (Array<map>
)A list of tags.
Key
— required — (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. Thedata
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 no longer in use. 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 following format.
arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
IsOrganizationTrail
— (Boolean
)Specifies whether the trail is an organization trail.
-
(AWS.Response)
—
Returns:
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 following is the format of a trail ARN.
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.
-
(AWS.Response)
—
Returns:
describeTrails(params = {}, callback) ⇒ AWS.Request
Retrieves settings for one or more trails 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. Thedata
object has the following properties:trailList
— (Array<map>
)The list of trail objects. Trail objects with string values are only returned if values for the objects exist in a trail's configuration. For example,
SNSTopicName
andSNSTopicARN
are only returned in results if a trail is configured to send SNS notifications. Similarly,KMSKeyId
only appears in results if a trail's log files are encrypted with KMS customer managed keys.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 no longer in use. Use SnsTopicARN.
SnsTopicARN
— (String
)Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.
arn:aws:sns:us-east-2:123456789012:MyTopic
IncludeGlobalServiceEvents
— (Boolean
)Set to True to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, False.
IsMultiRegionTrail
— (Boolean
)Specifies whether the trail exists only in 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 following is the format of a trail ARN.
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 following format.
arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
HasCustomEventSelectors
— (Boolean
)Specifies if the trail has custom event selectors.
HasInsightSelectors
— (Boolean
)Specifies whether a trail has insight types specified in an
InsightSelector
list.IsOrganizationTrail
— (Boolean
)Specifies whether the trail is an organization trail.
-
(AWS.Response)
—
Returns:
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 resources on which you are logging data events.
For more information, see Logging Data and Management Events for Trails in the 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
andmy--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. Thedata
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 andRunInstances
is a write-only API operation.By default, the value is
Possible values include:All
."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 CloudTrail User Guide.
By default, the value is
true
.The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same region. For more information about CloudTrail pricing, see CloudTrail Pricing.
DataResources
— (Array<map>
)CloudTrail supports data event logging for Amazon S3 objects, Lambda functions, and Amazon DynamoDB tables with basic event selectors. 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 CloudTrail in the CloudTrail User Guide.
Type
— (String
)The resource type in which you want to log data events. You can specify
AWS::S3::Object
,AWS::Lambda::Function
, orAWS::DynamoDB::Table
resources.The
AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, andAWS::EC2::Snapshot
resource types are not valid in basic event selectors. To log data events on these resource types, use advanced event selectors.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 Amazon Web Services account, specify the prefix as
arn:aws:s3:::
.Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. -
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 Lambda functions in your Amazon Web Services account, specify the prefix as
arn:aws:lambda
.Note: This also enables logging ofInvoke
activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. -
To log data events for a specific Lambda function, specify the function ARN.
Note: Lambda function ARNs are exact. 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. -
To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as
arn:aws:dynamodb
.
-
ExcludeManagementEventSources
— (Array<String>
)An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing
kms.amazonaws.com
orrdsdata.amazonaws.com
. By default,ExcludeManagementEventSources
is empty, and KMS and Amazon RDS Data API events are logged to your trail.
AdvancedEventSelectors
— (Array<map>
)The advanced event selectors that are configured for the trail.
Name
— (String
)An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".
FieldSelectors
— required — (Array<map>
)Contains all selector statements in an advanced event selector.
Field
— required — (String
)A field in an event record on which to filter events to be logged. Supported fields include
readOnly
,eventCategory
,eventSource
(for management events),eventName
,resources.type
, andresources.ARN
.-
readOnly
- Optional. Can be set toEquals
a value oftrue
orfalse
. A value offalse
logs bothread
andwrite
events. -
eventSource
- For filtering management events only. This can be set only toNotEquals
kms.amazonaws.com
. -
eventName
- Can use any operator. You can use it to filter in or filter out any data event logged to CloudTrail, such asPutBucket
orGetSnapshotBlock
. You can have multiple values for this field, separated by commas. -
eventCategory
- This is required. It must be set toEquals
, and the value must beManagement
orData
. -
resources.type
- This field is required.resources.type
can only use theEquals
operator, and the value can be one of the following:AWS::S3::Object
,AWS::S3::AccessPoint
,AWS::Lambda::Function
,AWS::DynamoDB::Table
,AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, orAWS::EC2::Snapshot
. You can have only oneresources.type
field per selector. To log data events on more than one resource type, add another selector. -
resources.ARN
- You can use any operator with resources.ARN, but if you useEquals
orNotEquals
, the value must exactly match the ARN of a valid resource of the type you've specified in the template as the value of resources.type. For example, if resources.type equalsAWS::S3::Object
, the ARN must be in one of the following formats. To log all data events for all objects in a specific S3 bucket, use theStartsWith
operator, and include only the bucket ARN as the matching value.The trailing slash is intentional; do not exclude it. Replace the text between less than and greater than symbols (<>) with resource-specific information.
-
arn:<partition>:s3:::<bucket_name>/
-
arn:<partition>:s3:::<bucket_name>/<object_path>/
When
resources.type
equalsAWS::S3::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in one of the following formats. To log events on all objects in an S3 access point, we recommend that you use only the access point ARN, don’t include the object path, and use theStartsWith
orNotStartsWith
operators.-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>
-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>/object/<object_path>
When resources.type equals
AWS::Lambda::Function
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:lambda:<region>:<account_ID>:function:<function_name>
When resources.type equals
AWS::DynamoDB::Table
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:dynamodb:<region>:<account_ID>:table:<table_name>
When
resources.type
equalsAWS::S3Outposts::Object
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-outposts:<region>:<account_ID>:<object_path>
When
resources.type
equalsAWS::ManagedBlockchain::Node
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:managedblockchain:<region>:<account_ID>:nodes/<node_ID>
When
resources.type
equalsAWS::S3ObjectLambda::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-object-lambda:<region>:<account_ID>:accesspoint/<access_point_name>
When
resources.type
equalsAWS::EC2::Snapshot
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:ec2:<region>::snapshot/<snapshot_ID>
-
-
Equals
— (Array<String>
)An operator that includes events that match the exact value of the event record field specified as the value of
Field
. This is the only valid operator that you can use with thereadOnly
,eventCategory
, andresources.type
fields.StartsWith
— (Array<String>
)An operator that includes events that match the first few characters of the event record field specified as the value of
Field
.EndsWith
— (Array<String>
)An operator that includes events that match the last few characters of the event record field specified as the value of
Field
.NotEquals
— (Array<String>
)An operator that excludes events that match the exact value of the event record field specified as the value of
Field
.NotStartsWith
— (Array<String>
)An operator that excludes events that match the first few characters of the event record field specified as the value of
Field
.NotEndsWith
— (Array<String>
)An operator that excludes events that match the last few characters of the event record field specified as the value of
Field
.
-
(AWS.Response)
—
Returns:
getInsightSelectors(params = {}, callback) ⇒ AWS.Request
Describes the settings for the Insights event selectors that you configured for your trail. GetInsightSelectors
shows if CloudTrail Insights event logging is enabled on the trail, and if it is, which insight types are enabled. If you run GetInsightSelectors
on a trail that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException
For more information, see Logging CloudTrail Insights Events for Trails in the CloudTrail User Guide.
Service Reference:
Examples:
Calling the getInsightSelectors operation
var params = {
TrailName: 'STRING_VALUE' /* required */
};
cloudtrail.getInsightSelectors(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
andmy--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. Thedata
object has the following properties:TrailARN
— (String
)The Amazon Resource Name (ARN) of a trail for which you want to get Insights selectors.
InsightSelectors
— (Array<map>
)A JSON string that contains the insight types you want to log on a trail. In this release, only
ApiCallRateInsight
is supported as an insight type.InsightType
— (String
)The type of Insights events to log on a trail. The valid Insights type in this release is
Possible values include:ApiCallRateInsight
."ApiCallRateInsight"
-
(AWS.Response)
—
Returns:
getTrail(params = {}, callback) ⇒ AWS.Request
Returns settings information for a specified trail.
Service Reference:
Examples:
Calling the getTrail operation
var params = {
Name: 'STRING_VALUE' /* required */
};
cloudtrail.getTrail(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
)The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information.
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. Thedata
object has the following properties:Trail
— (map
)The settings for a trail.
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 no longer in use. Use SnsTopicARN.
SnsTopicARN
— (String
)Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.
arn:aws:sns:us-east-2:123456789012:MyTopic
IncludeGlobalServiceEvents
— (Boolean
)Set to True to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, False.
IsMultiRegionTrail
— (Boolean
)Specifies whether the trail exists only in 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 following is the format of a trail ARN.
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 following format.
arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
HasCustomEventSelectors
— (Boolean
)Specifies if the trail has custom event selectors.
HasInsightSelectors
— (Boolean
)Specifies whether a trail has insight types specified in an
InsightSelector
list.IsOrganizationTrail
— (Boolean
)Specifies whether the trail is an organization trail.
-
(AWS.Response)
—
Returns:
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 following is the format of a trail ARN.
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. Thedata
object has the following properties:IsLogging
— (Boolean
)Whether the CloudTrail trail is currently logging Amazon Web Services 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 Error Responses in the Amazon S3 API Reference.
Note: This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, create a new bucket, and then callUpdateTrail
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 Amazon Web Services account.
StopLoggingTime
— (Date
)Specifies the most recent date and time when CloudTrail stopped recording API calls for an Amazon Web Services 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 Error Responses in the Amazon S3 API Reference.
Note: This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, create a new bucket, and then callUpdateTrail
to specify the new bucket; or fix the existing objects so that CloudTrail can again write to the bucket.LatestDeliveryAttemptTime
— (String
)This field is no longer in use.
LatestNotificationAttemptTime
— (String
)This field is no longer in use.
LatestNotificationAttemptSucceeded
— (String
)This field is no longer in use.
LatestDeliveryAttemptSucceeded
— (String
)This field is no longer in use.
TimeLoggingStarted
— (String
)This field is no longer in use.
TimeLoggingStopped
— (String
)This field is no longer in use.
-
(AWS.Response)
—
Returns:
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.
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. Thedata
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.
-
(AWS.Response)
—
Returns:
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 following is the format of a trail ARN.
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. Thedata
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.
Key
— required — (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.
-
(AWS.Response)
—
Returns:
listTrails(params = {}, callback) ⇒ AWS.Request
Lists trails that are in the current account.
Service Reference:
Examples:
Calling the listTrails operation
var params = {
NextToken: 'STRING_VALUE'
};
cloudtrail.listTrails(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: {})
—
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. Thedata
object has the following properties:Trails
— (Array<map>
)Returns the name, ARN, and home region of trails in the current account.
TrailARN
— (String
)The ARN of a trail.
Name
— (String
)The name of a trail.
HomeRegion
— (String
)The Amazon Web Services Region in which a trail was created.
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.
-
(AWS.Response)
—
Returns:
lookupEvents(params = {}, callback) ⇒ AWS.Request
Looks up management events or CloudTrail Insights events that are captured by CloudTrail. You can look up events that occurred in a region within the last 90 days. Lookup supports the following attributes for management events:
-
Amazon Web Services access key
-
Event ID
-
Event name
-
Event source
-
Read only
-
Resource name
-
Resource type
-
User name
Lookup supports the following attributes for Insights events:
-
Event ID
-
Event name
-
Event source
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 two per second, per account, per region. If this limit is exceeded, a throttling error occurs.
Service Reference:
Examples:
Calling the lookupEvents operation
var params = {
EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
EventCategory: insight,
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.
AttributeKey
— required — (String
)Specifies an attribute on which to filter the events returned.
Possible values include:"EventId"
"EventName"
"ReadOnly"
"Username"
"ResourceType"
"ResourceName"
"EventSource"
"AccessKeyId"
AttributeValue
— required — (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.
EventCategory
— (String
)Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify
Possible values include:insight
as the value ofEventCategory
, no Insights events are returned."insight"
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. Thedata
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 Amazon Web Services 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 Amazon Web Services service to which the request was made.
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 Amazon RDS, and AccessKey for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events.
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.
-
(AWS.Response)
—
Returns:
putEventSelectors(params = {}, callback) ⇒ AWS.Request
Configures an event selector or advanced event selectors for your trail. Use event selectors or advanced event selectors to specify management and data event settings for your trail. By default, trails created without specific event selectors are 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 or advanced 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
-
You create an event selector for a trail and specify that you want write-only events.
-
The EC2
GetConsoleOutput
andRunInstances
API operations occur in your account. -
CloudTrail evaluates whether the events match your event selectors.
-
The
RunInstances
is a write-only event and it matches your event selector. The trail logs the event. -
The
GetConsoleOutput
is a read-only event that 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
exception 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 Quotas in CloudTrail in the CloudTrail User Guide.
You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors
or EventSelectors
, but not both. If you apply AdvancedEventSelectors
to a trail, any existing EventSelectors
are overwritten. For more information about advanced event selectors, see Logging data events for trails in the CloudTrail User Guide.
Service Reference:
Examples:
Calling the putEventSelectors operation
var params = {
TrailName: 'STRING_VALUE', /* required */
AdvancedEventSelectors: [
{
FieldSelectors: [ /* required */
{
Field: 'STRING_VALUE', /* required */
EndsWith: [
'STRING_VALUE',
/* more items */
],
Equals: [
'STRING_VALUE',
/* more items */
],
NotEndsWith: [
'STRING_VALUE',
/* more items */
],
NotEquals: [
'STRING_VALUE',
/* more items */
],
NotStartsWith: [
'STRING_VALUE',
/* more items */
],
StartsWith: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
],
Name: 'STRING_VALUE'
},
/* more items */
],
EventSelectors: [
{
DataResources: [
{
Type: 'STRING_VALUE',
Values: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
],
ExcludeManagementEventSources: [
'STRING_VALUE',
/* more items */
],
IncludeManagementEvents: true || false,
ReadWriteType: ReadOnly | WriteOnly | All
},
/* more items */
]
};
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
andmy--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 following 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. You can use either
EventSelectors
orAdvancedEventSelectors
in aPutEventSelectors
request, but not both. If you applyEventSelectors
to a trail, any existingAdvancedEventSelectors
are overwritten.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 andRunInstances
is a write-only API operation.By default, the value is
Possible values include:All
."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 CloudTrail User Guide.
By default, the value is
true
.The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same region. For more information about CloudTrail pricing, see CloudTrail Pricing.
DataResources
— (Array<map>
)CloudTrail supports data event logging for Amazon S3 objects, Lambda functions, and Amazon DynamoDB tables with basic event selectors. 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 CloudTrail in the CloudTrail User Guide.
Type
— (String
)The resource type in which you want to log data events. You can specify
AWS::S3::Object
,AWS::Lambda::Function
, orAWS::DynamoDB::Table
resources.The
AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, andAWS::EC2::Snapshot
resource types are not valid in basic event selectors. To log data events on these resource types, use advanced event selectors.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 Amazon Web Services account, specify the prefix as
arn:aws:s3:::
.Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. -
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 Lambda functions in your Amazon Web Services account, specify the prefix as
arn:aws:lambda
.Note: This also enables logging ofInvoke
activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. -
To log data events for a specific Lambda function, specify the function ARN.
Note: Lambda function ARNs are exact. 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. -
To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as
arn:aws:dynamodb
.
-
ExcludeManagementEventSources
— (Array<String>
)An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing
kms.amazonaws.com
orrdsdata.amazonaws.com
. By default,ExcludeManagementEventSources
is empty, and KMS and Amazon RDS Data API events are logged to your trail.
AdvancedEventSelectors
— (Array<map>
)Specifies the settings for advanced event selectors. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either
AdvancedEventSelectors
orEventSelectors
, but not both. If you applyAdvancedEventSelectors
to a trail, any existingEventSelectors
are overwritten. For more information about advanced event selectors, see Logging data events for trails in the CloudTrail User Guide.Name
— (String
)An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".
FieldSelectors
— required — (Array<map>
)Contains all selector statements in an advanced event selector.
Field
— required — (String
)A field in an event record on which to filter events to be logged. Supported fields include
readOnly
,eventCategory
,eventSource
(for management events),eventName
,resources.type
, andresources.ARN
.-
readOnly
- Optional. Can be set toEquals
a value oftrue
orfalse
. A value offalse
logs bothread
andwrite
events. -
eventSource
- For filtering management events only. This can be set only toNotEquals
kms.amazonaws.com
. -
eventName
- Can use any operator. You can use it to filter in or filter out any data event logged to CloudTrail, such asPutBucket
orGetSnapshotBlock
. You can have multiple values for this field, separated by commas. -
eventCategory
- This is required. It must be set toEquals
, and the value must beManagement
orData
. -
resources.type
- This field is required.resources.type
can only use theEquals
operator, and the value can be one of the following:AWS::S3::Object
,AWS::S3::AccessPoint
,AWS::Lambda::Function
,AWS::DynamoDB::Table
,AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, orAWS::EC2::Snapshot
. You can have only oneresources.type
field per selector. To log data events on more than one resource type, add another selector. -
resources.ARN
- You can use any operator with resources.ARN, but if you useEquals
orNotEquals
, the value must exactly match the ARN of a valid resource of the type you've specified in the template as the value of resources.type. For example, if resources.type equalsAWS::S3::Object
, the ARN must be in one of the following formats. To log all data events for all objects in a specific S3 bucket, use theStartsWith
operator, and include only the bucket ARN as the matching value.The trailing slash is intentional; do not exclude it. Replace the text between less than and greater than symbols (<>) with resource-specific information.
-
arn:<partition>:s3:::<bucket_name>/
-
arn:<partition>:s3:::<bucket_name>/<object_path>/
When
resources.type
equalsAWS::S3::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in one of the following formats. To log events on all objects in an S3 access point, we recommend that you use only the access point ARN, don’t include the object path, and use theStartsWith
orNotStartsWith
operators.-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>
-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>/object/<object_path>
When resources.type equals
AWS::Lambda::Function
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:lambda:<region>:<account_ID>:function:<function_name>
When resources.type equals
AWS::DynamoDB::Table
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:dynamodb:<region>:<account_ID>:table:<table_name>
When
resources.type
equalsAWS::S3Outposts::Object
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-outposts:<region>:<account_ID>:<object_path>
When
resources.type
equalsAWS::ManagedBlockchain::Node
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:managedblockchain:<region>:<account_ID>:nodes/<node_ID>
When
resources.type
equalsAWS::S3ObjectLambda::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-object-lambda:<region>:<account_ID>:accesspoint/<access_point_name>
When
resources.type
equalsAWS::EC2::Snapshot
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:ec2:<region>::snapshot/<snapshot_ID>
-
-
Equals
— (Array<String>
)An operator that includes events that match the exact value of the event record field specified as the value of
Field
. This is the only valid operator that you can use with thereadOnly
,eventCategory
, andresources.type
fields.StartsWith
— (Array<String>
)An operator that includes events that match the first few characters of the event record field specified as the value of
Field
.EndsWith
— (Array<String>
)An operator that includes events that match the last few characters of the event record field specified as the value of
Field
.NotEquals
— (Array<String>
)An operator that excludes events that match the exact value of the event record field specified as the value of
Field
.NotStartsWith
— (Array<String>
)An operator that excludes events that match the first few characters of the event record field specified as the value of
Field
.NotEndsWith
— (Array<String>
)An operator that excludes events that match the last few characters of the event record field specified as the value of
Field
.
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. Thedata
object has the following properties:TrailARN
— (String
)Specifies the ARN of the trail that was updated with event selectors. The following is the format of a trail ARN.
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 andRunInstances
is a write-only API operation.By default, the value is
Possible values include:All
."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 CloudTrail User Guide.
By default, the value is
true
.The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same region. For more information about CloudTrail pricing, see CloudTrail Pricing.
DataResources
— (Array<map>
)CloudTrail supports data event logging for Amazon S3 objects, Lambda functions, and Amazon DynamoDB tables with basic event selectors. 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 CloudTrail in the CloudTrail User Guide.
Type
— (String
)The resource type in which you want to log data events. You can specify
AWS::S3::Object
,AWS::Lambda::Function
, orAWS::DynamoDB::Table
resources.The
AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, andAWS::EC2::Snapshot
resource types are not valid in basic event selectors. To log data events on these resource types, use advanced event selectors.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 Amazon Web Services account, specify the prefix as
arn:aws:s3:::
.Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. -
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 Lambda functions in your Amazon Web Services account, specify the prefix as
arn:aws:lambda
.Note: This also enables logging ofInvoke
activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. -
To log data events for a specific Lambda function, specify the function ARN.
Note: Lambda function ARNs are exact. 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. -
To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as
arn:aws:dynamodb
.
-
ExcludeManagementEventSources
— (Array<String>
)An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing
kms.amazonaws.com
orrdsdata.amazonaws.com
. By default,ExcludeManagementEventSources
is empty, and KMS and Amazon RDS Data API events are logged to your trail.
AdvancedEventSelectors
— (Array<map>
)Specifies the advanced event selectors configured for your trail.
Name
— (String
)An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".
FieldSelectors
— required — (Array<map>
)Contains all selector statements in an advanced event selector.
Field
— required — (String
)A field in an event record on which to filter events to be logged. Supported fields include
readOnly
,eventCategory
,eventSource
(for management events),eventName
,resources.type
, andresources.ARN
.-
readOnly
- Optional. Can be set toEquals
a value oftrue
orfalse
. A value offalse
logs bothread
andwrite
events. -
eventSource
- For filtering management events only. This can be set only toNotEquals
kms.amazonaws.com
. -
eventName
- Can use any operator. You can use it to filter in or filter out any data event logged to CloudTrail, such asPutBucket
orGetSnapshotBlock
. You can have multiple values for this field, separated by commas. -
eventCategory
- This is required. It must be set toEquals
, and the value must beManagement
orData
. -
resources.type
- This field is required.resources.type
can only use theEquals
operator, and the value can be one of the following:AWS::S3::Object
,AWS::S3::AccessPoint
,AWS::Lambda::Function
,AWS::DynamoDB::Table
,AWS::S3Outposts::Object
,AWS::ManagedBlockchain::Node
,AWS::S3ObjectLambda::AccessPoint
, orAWS::EC2::Snapshot
. You can have only oneresources.type
field per selector. To log data events on more than one resource type, add another selector. -
resources.ARN
- You can use any operator with resources.ARN, but if you useEquals
orNotEquals
, the value must exactly match the ARN of a valid resource of the type you've specified in the template as the value of resources.type. For example, if resources.type equalsAWS::S3::Object
, the ARN must be in one of the following formats. To log all data events for all objects in a specific S3 bucket, use theStartsWith
operator, and include only the bucket ARN as the matching value.The trailing slash is intentional; do not exclude it. Replace the text between less than and greater than symbols (<>) with resource-specific information.
-
arn:<partition>:s3:::<bucket_name>/
-
arn:<partition>:s3:::<bucket_name>/<object_path>/
When
resources.type
equalsAWS::S3::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in one of the following formats. To log events on all objects in an S3 access point, we recommend that you use only the access point ARN, don’t include the object path, and use theStartsWith
orNotStartsWith
operators.-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>
-
arn:<partition>:s3:<region>:<account_ID>:accesspoint/<access_point_name>/object/<object_path>
When resources.type equals
AWS::Lambda::Function
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:lambda:<region>:<account_ID>:function:<function_name>
When resources.type equals
AWS::DynamoDB::Table
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:dynamodb:<region>:<account_ID>:table:<table_name>
When
resources.type
equalsAWS::S3Outposts::Object
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-outposts:<region>:<account_ID>:<object_path>
When
resources.type
equalsAWS::ManagedBlockchain::Node
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:managedblockchain:<region>:<account_ID>:nodes/<node_ID>
When
resources.type
equalsAWS::S3ObjectLambda::AccessPoint
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:s3-object-lambda:<region>:<account_ID>:accesspoint/<access_point_name>
When
resources.type
equalsAWS::EC2::Snapshot
, and the operator is set toEquals
orNotEquals
, the ARN must be in the following format:-
arn:<partition>:ec2:<region>::snapshot/<snapshot_ID>
-
-
Equals
— (Array<String>
)An operator that includes events that match the exact value of the event record field specified as the value of
Field
. This is the only valid operator that you can use with thereadOnly
,eventCategory
, andresources.type
fields.StartsWith
— (Array<String>
)An operator that includes events that match the first few characters of the event record field specified as the value of
Field
.EndsWith
— (Array<String>
)An operator that includes events that match the last few characters of the event record field specified as the value of
Field
.NotEquals
— (Array<String>
)An operator that excludes events that match the exact value of the event record field specified as the value of
Field
.NotStartsWith
— (Array<String>
)An operator that excludes events that match the first few characters of the event record field specified as the value of
Field
.NotEndsWith
— (Array<String>
)An operator that excludes events that match the last few characters of the event record field specified as the value of
Field
.
-
(AWS.Response)
—
Returns:
putInsightSelectors(params = {}, callback) ⇒ AWS.Request
Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail. You also use PutInsightSelectors
to turn off Insights event logging, by passing an empty list of insight types. The valid Insights event type in this release is ApiCallRateInsight
.
Service Reference:
Examples:
Calling the putInsightSelectors operation
var params = {
InsightSelectors: [ /* required */
{
InsightType: ApiCallRateInsight
},
/* more items */
],
TrailName: 'STRING_VALUE' /* required */
};
cloudtrail.putInsightSelectors(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
)The name of the CloudTrail trail for which you want to change or add Insights selectors.
InsightSelectors
— (Array<map>
)A JSON string that contains the Insights types that you want to log on a trail. The valid Insights type in this release is
ApiCallRateInsight
.InsightType
— (String
)The type of Insights events to log on a trail. The valid Insights type in this release is
Possible values include:ApiCallRateInsight
."ApiCallRateInsight"
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. Thedata
object has the following properties:TrailARN
— (String
)The Amazon Resource Name (ARN) of a trail for which you want to change or add Insights selectors.
InsightSelectors
— (Array<map>
)A JSON string that contains the Insights event types that you want to log on a trail. The valid Insights type in this release is
ApiCallRateInsight
.InsightType
— (String
)The type of Insights events to log on a trail. The valid Insights type in this release is
Possible values include:ApiCallRateInsight
."ApiCallRateInsight"
-
(AWS.Response)
—
Returns:
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.
Key
— required — (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.
-
(AWS.Response)
—
Returns:
startLogging(params = {}, callback) ⇒ AWS.Request
Starts the recording of Amazon Web Services 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 Amazon Web Services API calls. The following is the format of a trail ARN.
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.
-
(AWS.Response)
—
Returns:
stopLogging(params = {}, callback) ⇒ AWS.Request
Suspends the recording of Amazon Web Services 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 Amazon Web Services API calls. The following is the format of a trail ARN.
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.
-
(AWS.Response)
—
Returns:
updateTrail(params = {}, callback) ⇒ AWS.Request
Updates trail settings that control what events you are logging, and how to handle 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
andmy--namespace
are not valid. -
Not be in IP address format (for example, 192.168.5.4)
If
Name
is a trail ARN, it must be in the following 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. As a best practice, consider using trails that log events in all regions.
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 does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on 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 are 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.
CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.
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 Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations. If the trail is not an organization trail and this is set to
true
, the trail will be created in all Amazon Web Services accounts that belong to the organization. If the trail is an organization trail and this is set tofalse
, the trail will remain in the current Amazon Web Services 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. Thedata
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 IAM Log Files.
SnsTopicName
— (String
)This field is no longer in use. Use UpdateTrailResponse$SnsTopicARN.
SnsTopicARN
— (String
)Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.
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 following is the format of a trail ARN.
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 are 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 following format.
arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
IsOrganizationTrail
— (Boolean
)Specifies whether the trail is an organization trail.
-
(AWS.Response)
—
Returns: