Amazon QLDB

2020/05/18 - Amazon QLDB - 4 new api methods

Changes  Amazon QLDB now supports Amazon Kinesis data streams. You can now emit QLDB journal data, via the new QLDB Streams feature, directly to Amazon Kinesis supporting event processing and analytics among related use cases.

StreamJournalToKinesis (new) Link ¶

Creates a stream for a given Amazon QLDB ledger that delivers the journal data to a specified Amazon Kinesis Data Streams resource. The stream captures every document revision that is committed to your journal and sends it to the Kinesis data stream.

See also: AWS API Documentation

Request Syntax

client.stream_journal_to_kinesis(
    LedgerName='string',
    RoleArn='string',
    Tags={
        'string': 'string'
    },
    InclusiveStartTime=datetime(2015, 1, 1),
    ExclusiveEndTime=datetime(2015, 1, 1),
    KinesisConfiguration={
        'StreamArn': 'string',
        'AggregationEnabled': True|False
    },
    StreamName='string'
)
type LedgerName

string

param LedgerName

[REQUIRED]

The name of the ledger.

type RoleArn

string

param RoleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write data records to a Kinesis Data Streams resource.

type Tags

dict

param Tags

The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. Tag values are case sensitive and can be null.

  • (string) --

    • (string) --

type InclusiveStartTime

datetime

param InclusiveStartTime

[REQUIRED]

The inclusive start date and time from which to start streaming journal data. This parameter must be in ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z

The InclusiveStartTime cannot be in the future and must be before ExclusiveEndTime .

If you provide an InclusiveStartTime that is before the ledger's CreationDateTime , QLDB effectively defaults it to the ledger's CreationDateTime .

type ExclusiveEndTime

datetime

param ExclusiveEndTime

The exclusive date and time that specifies when the stream ends. If you keep this parameter blank, the stream runs indefinitely until you cancel it.

The ExclusiveEndTime must be in ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z

type KinesisConfiguration

dict

param KinesisConfiguration

[REQUIRED]

The configuration settings of the Kinesis Data Streams destination for your stream request.

  • StreamArn (string) -- [REQUIRED]

    The Amazon Resource Name (ARN) of the Kinesis data stream resource.

  • AggregationEnabled (boolean) --

    Enables QLDB to publish multiple stream records in a single Kinesis Data Streams record. To learn more, see KPL Key Concepts in the Amazon Kinesis Data Streams Developer Guide .

type StreamName

string

param StreamName

[REQUIRED]

The name that you want to assign to the QLDB journal stream. User-defined names can help identify and indicate the purpose of a stream.

Your stream name must be unique among other active streams for a given ledger. If you try to create a stream with the same name and configuration of an active, existing stream for the same ledger, QLDB simply returns the existing stream. Stream names have the same naming constraints as ledger names, as defined in Quotas in Amazon QLDB in the Amazon QLDB Developer Guide .

rtype

dict

returns

Response Syntax

{
    'StreamId': 'string'
}

Response Structure

  • (dict) --

    • StreamId (string) --

      The unique ID that QLDB assigns to each QLDB journal stream.

DescribeJournalKinesisStream (new) Link ¶

Returns detailed information about a given Amazon QLDB journal stream. The output includes the Amazon Resource Name (ARN), stream name, current status, creation time, and the parameters of your original stream creation request.

See also: AWS API Documentation

Request Syntax

client.describe_journal_kinesis_stream(
    LedgerName='string',
    StreamId='string'
)
type LedgerName

string

param LedgerName

[REQUIRED]

The name of the ledger.

type StreamId

string

param StreamId

[REQUIRED]

The unique ID that QLDB assigns to each QLDB journal stream.

rtype

dict

returns

Response Syntax

{
    'Stream': {
        'LedgerName': 'string',
        'CreationTime': datetime(2015, 1, 1),
        'InclusiveStartTime': datetime(2015, 1, 1),
        'ExclusiveEndTime': datetime(2015, 1, 1),
        'RoleArn': 'string',
        'StreamId': 'string',
        'Arn': 'string',
        'Status': 'ACTIVE'|'COMPLETED'|'CANCELED'|'FAILED'|'IMPAIRED',
        'KinesisConfiguration': {
            'StreamArn': 'string',
            'AggregationEnabled': True|False
        },
        'ErrorCause': 'KINESIS_STREAM_NOT_FOUND'|'IAM_PERMISSION_REVOKED',
        'StreamName': 'string'
    }
}

Response Structure

  • (dict) --

    • Stream (dict) --

      Information about the QLDB journal stream returned by a DescribeJournalS3Export request.

      • LedgerName (string) --

        The name of the ledger.

      • CreationTime (datetime) --

        The date and time, in epoch time format, when the QLDB journal stream was created. (Epoch time format is the number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)

      • InclusiveStartTime (datetime) --

        The inclusive start date and time from which to start streaming journal data.

      • ExclusiveEndTime (datetime) --

        The exclusive date and time that specifies when the stream ends. If this parameter is blank, the stream runs indefinitely until you cancel it.

      • RoleArn (string) --

        The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write data records to a Kinesis Data Streams resource.

      • StreamId (string) --

        The unique ID that QLDB assigns to each QLDB journal stream.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the QLDB journal stream.

      • Status (string) --

        The current state of the QLDB journal stream.

      • KinesisConfiguration (dict) --

        The configuration settings of the Amazon Kinesis Data Streams destination for your QLDB journal stream.

        • StreamArn (string) --

          The Amazon Resource Name (ARN) of the Kinesis data stream resource.

        • AggregationEnabled (boolean) --

          Enables QLDB to publish multiple stream records in a single Kinesis Data Streams record. To learn more, see KPL Key Concepts in the Amazon Kinesis Data Streams Developer Guide .

      • ErrorCause (string) --

        The error message that describes the reason that a stream has a status of IMPAIRED or FAILED . This is not applicable to streams that have other status values.

      • StreamName (string) --

        The user-defined name of the QLDB journal stream.

ListJournalKinesisStreamsForLedger (new) Link ¶

Returns an array of all Amazon QLDB journal stream descriptors for a given ledger. The output of each stream descriptor includes the same details that are returned by DescribeJournalKinesisStream .

This action returns a maximum of MaxResults items. It is paginated so that you can retrieve all the items by calling ListJournalKinesisStreamsForLedger multiple times.

See also: AWS API Documentation

Request Syntax

client.list_journal_kinesis_streams_for_ledger(
    LedgerName='string',
    MaxResults=123,
    NextToken='string'
)
type LedgerName

string

param LedgerName

[REQUIRED]

The name of the ledger.

type MaxResults

integer

param MaxResults

The maximum number of results to return in a single ListJournalKinesisStreamsForLedger request. (The actual number of results returned might be fewer.)

type NextToken

string

param NextToken

A pagination token, indicating that you want to retrieve the next page of results. If you received a value for NextToken in the response from a previous ListJournalKinesisStreamsForLedger call, you should use that value as input here.

rtype

dict

returns

Response Syntax

{
    'Streams': [
        {
            'LedgerName': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'InclusiveStartTime': datetime(2015, 1, 1),
            'ExclusiveEndTime': datetime(2015, 1, 1),
            'RoleArn': 'string',
            'StreamId': 'string',
            'Arn': 'string',
            'Status': 'ACTIVE'|'COMPLETED'|'CANCELED'|'FAILED'|'IMPAIRED',
            'KinesisConfiguration': {
                'StreamArn': 'string',
                'AggregationEnabled': True|False
            },
            'ErrorCause': 'KINESIS_STREAM_NOT_FOUND'|'IAM_PERMISSION_REVOKED',
            'StreamName': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Streams (list) --

      The array of QLDB journal stream descriptors that are associated with the given ledger.

      • (dict) --

        The information about an Amazon QLDB journal stream, including the Amazon Resource Name (ARN), stream name, creation time, current status, and the parameters of your original stream creation request.

        • LedgerName (string) --

          The name of the ledger.

        • CreationTime (datetime) --

          The date and time, in epoch time format, when the QLDB journal stream was created. (Epoch time format is the number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)

        • InclusiveStartTime (datetime) --

          The inclusive start date and time from which to start streaming journal data.

        • ExclusiveEndTime (datetime) --

          The exclusive date and time that specifies when the stream ends. If this parameter is blank, the stream runs indefinitely until you cancel it.

        • RoleArn (string) --

          The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write data records to a Kinesis Data Streams resource.

        • StreamId (string) --

          The unique ID that QLDB assigns to each QLDB journal stream.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the QLDB journal stream.

        • Status (string) --

          The current state of the QLDB journal stream.

        • KinesisConfiguration (dict) --

          The configuration settings of the Amazon Kinesis Data Streams destination for your QLDB journal stream.

          • StreamArn (string) --

            The Amazon Resource Name (ARN) of the Kinesis data stream resource.

          • AggregationEnabled (boolean) --

            Enables QLDB to publish multiple stream records in a single Kinesis Data Streams record. To learn more, see KPL Key Concepts in the Amazon Kinesis Data Streams Developer Guide .

        • ErrorCause (string) --

          The error message that describes the reason that a stream has a status of IMPAIRED or FAILED . This is not applicable to streams that have other status values.

        • StreamName (string) --

          The user-defined name of the QLDB journal stream.

    • NextToken (string) --

      • If NextToken is empty, the last page of results has been processed and there are no more results to be retrieved.

      • If NextToken is not empty, more results are available. To retrieve the next page of results, use the value of NextToken in a subsequent ListJournalKinesisStreamsForLedger call.

CancelJournalKinesisStream (new) Link ¶

Ends a given Amazon QLDB journal stream. Before a stream can be canceled, its current status must be ACTIVE .

You can't restart a stream after you cancel it. Canceled QLDB stream resources are subject to a 7-day retention period, so they are automatically deleted after this limit expires.

See also: AWS API Documentation

Request Syntax

client.cancel_journal_kinesis_stream(
    LedgerName='string',
    StreamId='string'
)
type LedgerName

string

param LedgerName

[REQUIRED]

The name of the ledger.

type StreamId

string

param StreamId

[REQUIRED]

The unique ID that QLDB assigns to each QLDB journal stream.

rtype

dict

returns

Response Syntax

{
    'StreamId': 'string'
}

Response Structure

  • (dict) --

    • StreamId (string) --

      The unique ID that QLDB assigns to each QLDB journal stream.