Amazon CloudWatch Events

2020/11/05 - Amazon CloudWatch Events - 9 new api methods

Changes  With this release, customers can now reprocess past events by storing the events published on event bus in an encrypted archive.

ListArchives (new) Link ¶

Lists your archives. You can either list all the archives or you can provide a prefix to match to the archive names. Filter parameters are exclusive.

See also: AWS API Documentation

Request Syntax

client.list_archives(
    NamePrefix='string',
    EventSourceArn='string',
    State='ENABLED'|'DISABLED'|'CREATING'|'UPDATING'|'CREATE_FAILED'|'UPDATE_FAILED',
    NextToken='string',
    Limit=123
)
type NamePrefix

string

param NamePrefix

A name prefix to filter the archives returned. Only archives with name that match the prefix are returned.

type EventSourceArn

string

param EventSourceArn

The ARN of the event source associated with the archive.

type State

string

param State

The state of the archive.

type NextToken

string

param NextToken

The token returned by a previous call to retrieve the next set of results.

type Limit

integer

param Limit

The maximum number of results to return.

rtype

dict

returns

Response Syntax

{
    'Archives': [
        {
            'ArchiveName': 'string',
            'EventSourceArn': 'string',
            'State': 'ENABLED'|'DISABLED'|'CREATING'|'UPDATING'|'CREATE_FAILED'|'UPDATE_FAILED',
            'StateReason': 'string',
            'RetentionDays': 123,
            'SizeBytes': 123,
            'EventCount': 123,
            'CreationTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Archives (list) --

      An array of Archive objects that include details about an archive.

      • (dict) --

        An Archive object that contains details about an archive.

        • ArchiveName (string) --

          The name of the archive.

        • EventSourceArn (string) --

          The ARN of the event bus associated with the archive. Only events from this event bus are sent to the archive.

        • State (string) --

          The current state of the archive.

        • StateReason (string) --

          A description for the reason that the archive is in the current state.

        • RetentionDays (integer) --

          The number of days to retain events in the archive before they are deleted.

        • SizeBytes (integer) --

          The size of the archive, in bytes.

        • EventCount (integer) --

          The number of events in the archive.

        • CreationTime (datetime) --

          The time stamp for the time that the archive was created.

    • NextToken (string) --

      The token returned by a previous call to retrieve the next set of results.

ListReplays (new) Link ¶

Lists your replays. You can either list all the replays or you can provide a prefix to match to the replay names. Filter parameters are exclusive.

See also: AWS API Documentation

Request Syntax

client.list_replays(
    NamePrefix='string',
    State='STARTING'|'RUNNING'|'CANCELLING'|'COMPLETED'|'CANCELLED'|'FAILED',
    EventSourceArn='string',
    NextToken='string',
    Limit=123
)
type NamePrefix

string

param NamePrefix

A name prefix to filter the archives returned. Only archives with name that match the prefix are returned.

type State

string

param State

The state of the replay.

type EventSourceArn

string

param EventSourceArn

The ARN of the event source associated with the replay.

type NextToken

string

param NextToken

The token returned by a previous call to retrieve the next set of results.

type Limit

integer

param Limit

The maximum number of replays to retrieve.

rtype

dict

returns

Response Syntax

{
    'Replays': [
        {
            'ReplayName': 'string',
            'EventSourceArn': 'string',
            'State': 'STARTING'|'RUNNING'|'CANCELLING'|'COMPLETED'|'CANCELLED'|'FAILED',
            'StateReason': 'string',
            'EventStartTime': datetime(2015, 1, 1),
            'EventEndTime': datetime(2015, 1, 1),
            'EventLastReplayedTime': datetime(2015, 1, 1),
            'ReplayStartTime': datetime(2015, 1, 1),
            'ReplayEndTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Replays (list) --

      An array of Replay objects that contain information about the replay.

      • (dict) --

        A Replay object that contains details about a replay.

        • ReplayName (string) --

          The name of the replay.

        • EventSourceArn (string) --

          The ARN of the archive to replay event from.

        • State (string) --

          The current state of the replay.

        • StateReason (string) --

          A description of why the replay is in the current state.

        • EventStartTime (datetime) --

          A time stamp for the time to start replaying events. This is determined by the time in the event as described in Time .

        • EventEndTime (datetime) --

          A time stamp for the time to start replaying events. Any event with a creation time prior to the EventEndTime specified is replayed.

        • EventLastReplayedTime (datetime) --

          A time stamp for the time that the last event was replayed.

        • ReplayStartTime (datetime) --

          A time stamp for the time that the replay started.

        • ReplayEndTime (datetime) --

          A time stamp for the time that the replay completed.

    • NextToken (string) --

      The token returned by a previous call to retrieve the next set of results.

DescribeArchive (new) Link ¶

Retrieves details about an archive.

See also: AWS API Documentation

Request Syntax

client.describe_archive(
    ArchiveName='string'
)
type ArchiveName

string

param ArchiveName

[REQUIRED]

The name of the archive to retrieve.

rtype

dict

returns

Response Syntax

{
    'ArchiveArn': 'string',
    'ArchiveName': 'string',
    'EventSourceArn': 'string',
    'Description': 'string',
    'EventPattern': 'string',
    'State': 'ENABLED'|'DISABLED'|'CREATING'|'UPDATING'|'CREATE_FAILED'|'UPDATE_FAILED',
    'StateReason': 'string',
    'RetentionDays': 123,
    'SizeBytes': 123,
    'EventCount': 123,
    'CreationTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ArchiveArn (string) --

      The ARN of the archive.

    • ArchiveName (string) --

      The name of the archive.

    • EventSourceArn (string) --

      The ARN of the event source associated with the archive.

    • Description (string) --

      The description of the archive.

    • EventPattern (string) --

      The event pattern used to filter events sent to the archive.

    • State (string) --

      The state of the archive.

    • StateReason (string) --

      The reason that the archive is in the state.

    • RetentionDays (integer) --

      The number of days to retain events for in the archive.

    • SizeBytes (integer) --

      The size of the archive in bytes.

    • EventCount (integer) --

      The number of events in the archive.

    • CreationTime (datetime) --

      The time at which the archive was created.

StartReplay (new) Link ¶

Starts the specified replay. Events are not necessarily replayed in the exact same order that they were added to the archive. A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If you specify an EventStartTime and an EventEndTime that covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the second minute are replayed. You can use DescribeReplay to determine the progress of a replay. The value returned for EventLastReplayedTime indicates the time within the specified time range associated with the last event replayed.

See also: AWS API Documentation

Request Syntax

client.start_replay(
    ReplayName='string',
    Description='string',
    EventSourceArn='string',
    EventStartTime=datetime(2015, 1, 1),
    EventEndTime=datetime(2015, 1, 1),
    Destination={
        'Arn': 'string',
        'FilterArns': [
            'string',
        ]
    }
)
type ReplayName

string

param ReplayName

[REQUIRED]

The name of the replay to start.

type Description

string

param Description

A description for the replay to start.

type EventSourceArn

string

param EventSourceArn

[REQUIRED]

The ARN of the archive to replay events from.

type EventStartTime

datetime

param EventStartTime

[REQUIRED]

A time stamp for the time to start replaying events. Only events that occurred between the EventStartTime and EventEndTime are replayed.

type EventEndTime

datetime

param EventEndTime

[REQUIRED]

A time stamp for the time to stop replaying events. Only events that occurred between the EventStartTime and EventEndTime are replayed.

type Destination

dict

param Destination

[REQUIRED]

A ReplayDestination object that includes details about the destination for the replay.

  • Arn (string) -- [REQUIRED]

    The ARN of the event bus to replay event to. You can replay events only to the event bus specified to create the archive.

  • FilterArns (list) --

    A list of ARNs for rules to replay events to.

    • (string) --

rtype

dict

returns

Response Syntax

{
    'ReplayArn': 'string',
    'State': 'STARTING'|'RUNNING'|'CANCELLING'|'COMPLETED'|'CANCELLED'|'FAILED',
    'StateReason': 'string',
    'ReplayStartTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ReplayArn (string) --

      The ARN of the replay.

    • State (string) --

      The state of the replay.

    • StateReason (string) --

      The reason that the replay is in the state.

    • ReplayStartTime (datetime) --

      The time at which the replay started.

CancelReplay (new) Link ¶

Cancels the specified replay.

See also: AWS API Documentation

Request Syntax

client.cancel_replay(
    ReplayName='string'
)
type ReplayName

string

param ReplayName

[REQUIRED]

The name of the replay to cancel.

rtype

dict

returns

Response Syntax

{
    'ReplayArn': 'string',
    'State': 'STARTING'|'RUNNING'|'CANCELLING'|'COMPLETED'|'CANCELLED'|'FAILED',
    'StateReason': 'string'
}

Response Structure

  • (dict) --

    • ReplayArn (string) --

      The ARN of the replay to cancel.

    • State (string) --

      The current state of the replay.

    • StateReason (string) --

      The reason that the replay is in the current state.

CreateArchive (new) Link ¶

Creates an archive of events with the specified settings. When you create an archive, incoming events might not immediately start being sent to the archive. Allow a short period of time for changes to take effect.

See also: AWS API Documentation

Request Syntax

client.create_archive(
    ArchiveName='string',
    EventSourceArn='string',
    Description='string',
    EventPattern='string',
    RetentionDays=123
)
type ArchiveName

string

param ArchiveName

[REQUIRED]

The name for the archive to create.

type EventSourceArn

string

param EventSourceArn

[REQUIRED]

The ARN of the event source associated with the archive.

type Description

string

param Description

A description for the archive.

type EventPattern

string

param EventPattern

An event pattern to use to filter events sent to the archive.

type RetentionDays

integer

param RetentionDays

The number of days to retain events for. Default value is 0. If set to 0, events are retained indefinitely

rtype

dict

returns

Response Syntax

{
    'ArchiveArn': 'string',
    'State': 'ENABLED'|'DISABLED'|'CREATING'|'UPDATING'|'CREATE_FAILED'|'UPDATE_FAILED',
    'StateReason': 'string',
    'CreationTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ArchiveArn (string) --

      The ARN of the archive that was created.

    • State (string) --

      The state of the archive that was created.

    • StateReason (string) --

      The reason that the archive is in the state.

    • CreationTime (datetime) --

      The time at which the archive was created.

DeleteArchive (new) Link ¶

Deletes the specified archive.

See also: AWS API Documentation

Request Syntax

client.delete_archive(
    ArchiveName='string'
)
type ArchiveName

string

param ArchiveName

[REQUIRED]

The name of the archive to delete.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DescribeReplay (new) Link ¶

Retrieves details about a replay. Use DescribeReplay to determine the progress of a running replay. A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If you use StartReplay and specify an EventStartTime and an EventEndTime that covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the second minute are replayed. You can use DescribeReplay to determine the progress of a replay. The value returned for EventLastReplayedTime indicates the time within the specified time range associated with the last event replayed.

See also: AWS API Documentation

Request Syntax

client.describe_replay(
    ReplayName='string'
)
type ReplayName

string

param ReplayName

[REQUIRED]

The name of the replay to retrieve.

rtype

dict

returns

Response Syntax

{
    'ReplayName': 'string',
    'ReplayArn': 'string',
    'Description': 'string',
    'State': 'STARTING'|'RUNNING'|'CANCELLING'|'COMPLETED'|'CANCELLED'|'FAILED',
    'StateReason': 'string',
    'EventSourceArn': 'string',
    'Destination': {
        'Arn': 'string',
        'FilterArns': [
            'string',
        ]
    },
    'EventStartTime': datetime(2015, 1, 1),
    'EventEndTime': datetime(2015, 1, 1),
    'EventLastReplayedTime': datetime(2015, 1, 1),
    'ReplayStartTime': datetime(2015, 1, 1),
    'ReplayEndTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ReplayName (string) --

      The name of the replay.

    • ReplayArn (string) --

      The ARN of the replay.

    • Description (string) --

      The description of the replay.

    • State (string) --

      The current state of the replay.

    • StateReason (string) --

      The reason that the replay is in the current state.

    • EventSourceArn (string) --

      The ARN of the archive events were replayed from.

    • Destination (dict) --

      A ReplayDestination object that contains details about the replay.

      • Arn (string) --

        The ARN of the event bus to replay event to. You can replay events only to the event bus specified to create the archive.

      • FilterArns (list) --

        A list of ARNs for rules to replay events to.

        • (string) --

    • EventStartTime (datetime) --

      The time stamp of the first event that was last replayed from the archive.

    • EventEndTime (datetime) --

      The time stamp for the last event that was replayed from the archive.

    • EventLastReplayedTime (datetime) --

      The time that the event was last replayed.

    • ReplayStartTime (datetime) --

      A time stamp for the time that the replay started.

    • ReplayEndTime (datetime) --

      A time stamp for the time that the replay stopped.

UpdateArchive (new) Link ¶

Updates the specified archive.

See also: AWS API Documentation

Request Syntax

client.update_archive(
    ArchiveName='string',
    Description='string',
    EventPattern='string',
    RetentionDays=123
)
type ArchiveName

string

param ArchiveName

[REQUIRED]

The name of the archive to update.

type Description

string

param Description

The description for the archive.

type EventPattern

string

param EventPattern

The event pattern to use to filter events sent to the archive.

type RetentionDays

integer

param RetentionDays

The number of days to retain events in the archive.

rtype

dict

returns

Response Syntax

{
    'ArchiveArn': 'string',
    'State': 'ENABLED'|'DISABLED'|'CREATING'|'UPDATING'|'CREATE_FAILED'|'UPDATE_FAILED',
    'StateReason': 'string',
    'CreationTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • ArchiveArn (string) --

      The ARN of the archive.

    • State (string) --

      The state of the archive.

    • StateReason (string) --

      The reason that the archive is in the current state.

    • CreationTime (datetime) --

      The time at which the archive was updated.