在 Amazon EventBridge 中监控 Amazon Redshift 数据 API 的事件 - Amazon Redshift

在 Amazon EventBridge 中监控 Amazon Redshift 数据 API 的事件

您可以在 EventBridge 中监控数据 API,这将从您自己的应用程序、软件即服务 (SaaS) 应用程序和 AWS 服务传输实时数据流。EventBridge 将该数据路由到诸如 AWS Lambda 和 Amazon SNS 之类的目标。这些事件与 CloudWatch Events 中出现的事件相同,可提供近乎实时的系统事件流,这些系统事件描述 AWS 资源的变化。事件将发送到包含 Amazon Redshift 数据库的账户。例如,如果您担任另一个账户中的角色,则事件将发送到该账户。有关更多信息,请参阅《Amazon EventBridge 用户指南》中的 Amazon EventBridge 事件

ExecuteStatementBatchExecuteStatement API 操作将 WithEvent 选项设置为 true 时,将发送数据 API 事件。事件的 state 字段包含以下值之一:

  • 中止 – 用户停止了查询运行。

  • FAILED – 查询运行失败。

  • FINISHED – 查询已完成运行。

事件会确保送达。有关更多信息,请参阅《Amazon EventBridge 用户指南》中的 Events from AWS services

数据 API 完成事件示例

以下示例在 ExecuteStatement API 操作完成时显示数据 API 的一个事件。在以下示例中,名为 test.testtable 的语句运行完成。

{ "version": "0", "id": "18e7079c-dd4b-dd64-caf9-e2a31640dab0", "detail-type": "Redshift Data Statement Status Change", "source": "aws.redshift-data", "account": "123456789012", "time": "2020-10-01T21:14:26Z", "region": "us-east-1", "resources": [ "arn:aws:redshift:us-east-1:123456789012:cluster:redshift-cluster-1" ], "detail": { "principal": "arn:aws:iam::123456789012:user/myuser", "statementName": "test.testtable", "statementId": "dd2e1ec9-2ee3-49a0-819f-905fa7d75a4a", "redshiftQueryId": -1, "state": "FINISHED", "rows": 1, "expireAt": 1601673265 } }