Menu
AWS CloudTrail
API Reference (API Version 2013-11-01)

LookupEvents

Looks up API activity events captured by CloudTrail that create, update, or delete resources in your account. Events for a region can be looked up for the times in which you had CloudTrail turned on in that region during the last seven days. Lookup supports the following attributes:

  • Event ID

  • Event name

  • Event source

  • Resource name

  • Resource type

  • User name

All attributes are optional. The default number of results returned is 10, with a maximum of 50 possible. The response includes a token that you can use to get the next page of results.

Important

The rate of lookup requests is limited to one per second per account. If this limit is exceeded, a throttling error occurs.

Important

Events that occurred during the selected time range will not be available for lookup if CloudTrail logging was not enabled when the events occurred.

Request Syntax

Copy
{ "EndTime": number, "LookupAttributes": [ { "AttributeKey": "string", "AttributeValue": "string" } ], "MaxResults": number, "NextToken": "string", "StartTime": number }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

EndTime

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.

Type: Timestamp

Required: No

LookupAttributes

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

Type: Array of LookupAttribute objects

Required: No

MaxResults

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

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 50.

Required: No

NextToken

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.

Type: String

Required: No

StartTime

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.

Type: Timestamp

Required: No

Response Syntax

Copy
{ "Events": [ { "CloudTrailEvent": "string", "EventId": "string", "EventName": "string", "EventSource": "string", "EventTime": number, "Resources": [ { "ResourceName": "string", "ResourceType": "string" } ], "Username": "string" } ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Events

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.

Type: Array of Event objects

NextToken

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.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidLookupAttributesException

Occurs when an invalid lookup attribute is specified.

HTTP Status Code: 400

InvalidMaxResultsException

This exception is thrown if the limit specified is invalid.

HTTP Status Code: 400

InvalidNextTokenException

Invalid token or token that was previously used in a request with different parameters. This exception is thrown if the token is invalid.

HTTP Status Code: 400

InvalidTimeRangeException

Occurs if the timestamp values are invalid. Either the start time occurs after the end time or the time range is outside the range of possible values.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: