Skip to content
v2.274.0

RedshiftQueryProps Struct ​

Configuration properties of an Amazon Redshift Query event.

Example ​

ts
import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'

declare const workgroup: redshiftserverless.CfnWorkgroup;

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});

const dlq = new sqs.Queue(this, 'DeadLetterQueue');

rule.addTarget(new targets.RedshiftQuery(workgroup.attrWorkgroupWorkgroupArn, {
  database: 'dev',
  deadLetterQueue: dlq,
  sql: ['SELECT * FROM foo','SELECT * FROM baz'],
}));

Properties ​

databasestringdatabasestrdatabaseStringDatabasestringDatabase*stringrequired#
The Amazon Redshift database to run the query against.
dbUseroptionalstringdb_useroptionalstrdbUseroptionalStringDbUseroptionalstringDbUseroptional*string#
The Amazon Redshift database user to run the query as.

Default: No Database user is specified

This is required when authenticating via temporary credentials.

deadLetterQueueoptionalIQueuedead_letter_queueoptionalIQueuedeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueue#
The queue to be used as dead letter queue.

Default: No dead letter queue is specified

inputoptionalRuleTargetInputinputoptionalRuleTargetInputinputoptionalRuleTargetInputInputoptionalRuleTargetInputInputoptionalRuleTargetInput#
The input to the state machine execution.

Default: the entire EventBridge event

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
The IAM role to be used to execute the SQL statement.

Default: a new role will be created.

secretoptionalISecretsecretoptionalISecretsecretoptionalISecretSecretoptionalISecretSecretoptionalISecret#
The secret containing the password for the database user.

Default: No secret is specified

This is required when authenticating via Secrets Manager. If the full secret ARN is not specified, this will instead use the secret name.

sendEventBridgeEventoptionalbooleansend_event_bridge_eventoptionalboolsendEventBridgeEventoptionalBooleanSendEventBridgeEventoptionalboolSendEventBridgeEventoptional*bool= false#
Should an event be sent back to Event Bridge when the SQL statement is executed.
sqlstring[]sqltyping.List[str]sqlList<String>Sqlstring[]Sql*[]*stringrequired#
The SQL queries to be executed.

Default: No SQL query is specified

notes

Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed.

  • When multiple sql queries are included, this will use the batchExecuteStatement API. Therefore, if any statement fails, the entire transaction is rolled back.
  • If a single SQL statement is to be executed, this will use the executeStatement API.
statementNameoptionalstringstatement_nameoptionalstrstatementNameoptionalStringStatementNameoptionalstringStatementNameoptional*string#
The name of the SQL statement.

Default: No statement name is specified

You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a QS2- prefix to the statement name.