Skip to content

Resource: awsRdsClusterActivityStream

Manages RDS Aurora Cluster Database Activity Streams.

Database Activity Streams have some limits and requirements, refer to the Monitoring Amazon Aurora using Database Activity Streams documentation for detailed limitations and requirements.

\~> Note: This resource always calls the RDS startActivityStream API with the applyImmediately parameter set to true. This is because the Terraform needs the activity stream to be started in order for it to get the associated attributes.

\~> Note: This resource depends on having at least one awsRdsClusterInstance created. To avoid race conditions when all resources are being created together, add an explicit resource reference using the resource dependsOn meta-argument.

\~> Note: This resource is available in all regions except the following: cnNorth1, cnNorthwest1, usGovEast1, usGovWest1

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsKmsKeyDefault = new aws.kmsKey.KmsKey(this, "default", {
  description: "AWS KMS Key to encrypt Database Activity Stream",
});
const awsRdsClusterDefault = new aws.rdsCluster.RdsCluster(this, "default_1", {
  availabilityZones: ["us-west-2a", "us-west-2b", "us-west-2c"],
  clusterIdentifier: "aurora-cluster-demo",
  databaseName: "mydb",
  engine: "aurora-postgresql",
  engineVersion: "13.4",
  masterPassword: "mustbeeightcharaters",
  masterUsername: "foo",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRdsClusterDefault.overrideLogicalId("default");
const awsRdsClusterInstanceDefault =
  new aws.rdsClusterInstance.RdsClusterInstance(this, "default_2", {
    clusterIdentifier: awsRdsClusterDefault.clusterIdentifier,
    engine: awsRdsClusterDefault.engine,
    identifier: "aurora-instance-demo",
    instanceClass: "db.r6g.large",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRdsClusterInstanceDefault.overrideLogicalId("default");
const awsRdsClusterActivityStreamDefault =
  new aws.rdsClusterActivityStream.RdsClusterActivityStream(this, "default_3", {
    depends_on: [`\${${awsRdsClusterInstanceDefault.fqn}}`],
    kmsKeyId: awsKmsKeyDefault.keyId,
    mode: "async",
    resourceArn: awsRdsClusterDefault.arn,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRdsClusterActivityStreamDefault.overrideLogicalId("default");

Argument Reference

For more detailed documentation about each argument, refer to the AWS official documentation.

The following arguments are supported:

  • resourceArn - (Required, Forces new resources) The Amazon Resource Name (ARN) of the DB cluster.
  • mode - (Required, Forces new resources) Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: sync, async.
  • kmsKeyId - (Required, Forces new resources) The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
  • engineNativeAuditFieldsIncluded - (Optional, Forces new resources) Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults false.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The Amazon Resource Name (ARN) of the DB cluster.
  • kinesisStreamName - The name of the Amazon Kinesis data stream to be used for the database activity stream.

Import

RDS Aurora Cluster Database Activity Streams can be imported using the resourceArn, e.g.

$ terraform import aws_rds_cluster_activity_stream.default arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster-demo