Automating Amazon QLDB with CloudWatch Events - Amazon Quantum Ledger Database (Amazon QLDB)

Automating Amazon QLDB with CloudWatch Events

Amazon CloudWatch Events enables you to automate your AWS services and respond automatically to system events such as application availability issues or resource changes. Events from AWS services are delivered to CloudWatch Events in near-real time. You can write simple rules to indicate which events are of interest to you, and what automated actions to take when an event matches a rule. The actions that can be automatically triggered include the following:

  • Invoking an AWS Lambda function

  • Invoking Amazon EC2 Run Command

  • Relaying the event to Amazon Kinesis Data Streams

  • Activating an AWS Step Functions state machine

  • Notifying an Amazon SNS topic or an Amazon SQS queue

Amazon QLDB reports an event to CloudWatch Events whenever the state of a ledger resource in your AWS account changes. Events are currently emitted on a guaranteed, at-least-once basis for QLDB ledger resources only.

The following is an example of an event that QLDB reported, in which a ledger's state changed to DELETING.

{ "version" : "0", "id" : "2f6557eb-e361-54ef-0f9f-99dd9f171c62", "detail-type" : "QLDB Ledger State Change", "source" : "aws.qldb", "account" : "123456789012", "time" : "2019-07-24T21:59:17Z", "region" : "us-east-1", "resources" : ["arn:aws:qldb:us-east-1:123456789012:ledger/exampleLedger"], "detail" : { "ledgerName" : "exampleLedger", "state" : "DELETING" } }

Some examples of using CloudWatch Events with QLDB can include but aren't limited to the following:

  • Activating a Lambda function whenever a new ledger is initially created in CREATING state and eventually becomes ACTIVE.

  • Notifying an Amazon SNS topic when the state of your ledger changes to DELETING and then to DELETED.

For more information, see the Amazon CloudWatch Events User Guide.