ClusterActivityStream

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][2] API with the ApplyImmediately parameter set to true. This is because the provider 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 aws.rds.ClusterInstance created. To avoid race conditions when all resources are being created together, add an explicit resource reference using the resource depends_on meta-argument.

Note: This resource is available in all regions except the following: cn-north-1, cn-northwest-1, us-gov-east-1, us-gov-west-1

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var defaultCluster = new Aws.Rds.Cluster("defaultCluster", new()
    {
        ClusterIdentifier = "aurora-cluster-demo",
        AvailabilityZones = new[]
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        DatabaseName = "mydb",
        MasterUsername = "foo",
        MasterPassword = "mustbeeightcharaters",
        Engine = "aurora-postgresql",
        EngineVersion = "13.4",
    });

    var defaultClusterInstance = new Aws.Rds.ClusterInstance("defaultClusterInstance", new()
    {
        Identifier = "aurora-instance-demo",
        ClusterIdentifier = defaultCluster.ClusterIdentifier,
        Engine = defaultCluster.Engine,
        InstanceClass = "db.r6g.large",
    });

    var defaultKey = new Aws.Kms.Key("defaultKey", new()
    {
        Description = "AWS KMS Key to encrypt Database Activity Stream",
    });

    var defaultClusterActivityStream = new Aws.Rds.ClusterActivityStream("defaultClusterActivityStream", new()
    {
        ResourceArn = defaultCluster.Arn,
        Mode = "async",
        KmsKeyId = defaultKey.KeyId,
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            defaultClusterInstance,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/kms"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/rds"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		defaultCluster, err := rds.NewCluster(ctx, "defaultCluster", &rds.ClusterArgs{
			ClusterIdentifier: pulumi.String("aurora-cluster-demo"),
			AvailabilityZones: pulumi.StringArray{
				pulumi.String("us-west-2a"),
				pulumi.String("us-west-2b"),
				pulumi.String("us-west-2c"),
			},
			DatabaseName:   pulumi.String("mydb"),
			MasterUsername: pulumi.String("foo"),
			MasterPassword: pulumi.String("mustbeeightcharaters"),
			Engine:         pulumi.String("aurora-postgresql"),
			EngineVersion:  pulumi.String("13.4"),
		})
		if err != nil {
			return err
		}
		defaultClusterInstance, err := rds.NewClusterInstance(ctx, "defaultClusterInstance", &rds.ClusterInstanceArgs{
			Identifier:        pulumi.String("aurora-instance-demo"),
			ClusterIdentifier: defaultCluster.ClusterIdentifier,
			Engine:            defaultCluster.Engine,
			InstanceClass:     pulumi.String("db.r6g.large"),
		})
		if err != nil {
			return err
		}
		defaultKey, err := kms.NewKey(ctx, "defaultKey", &kms.KeyArgs{
			Description: pulumi.String("AWS KMS Key to encrypt Database Activity Stream"),
		})
		if err != nil {
			return err
		}
		_, err = rds.NewClusterActivityStream(ctx, "defaultClusterActivityStream", &rds.ClusterActivityStreamArgs{
			ResourceArn: defaultCluster.Arn,
			Mode:        pulumi.String("async"),
			KmsKeyId:    defaultKey.KeyId,
		}, pulumi.DependsOn([]pulumi.Resource{
			defaultClusterInstance,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.rds.ClusterActivityStream;
import com.pulumi.aws.rds.ClusterActivityStreamArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()        
            .clusterIdentifier("aurora-cluster-demo")
            .availabilityZones(            
                "us-west-2a",
                "us-west-2b",
                "us-west-2c")
            .databaseName("mydb")
            .masterUsername("foo")
            .masterPassword("mustbeeightcharaters")
            .engine("aurora-postgresql")
            .engineVersion("13.4")
            .build());

        var defaultClusterInstance = new ClusterInstance("defaultClusterInstance", ClusterInstanceArgs.builder()        
            .identifier("aurora-instance-demo")
            .clusterIdentifier(defaultCluster.clusterIdentifier())
            .engine(defaultCluster.engine())
            .instanceClass("db.r6g.large")
            .build());

        var defaultKey = new Key("defaultKey", KeyArgs.builder()        
            .description("AWS KMS Key to encrypt Database Activity Stream")
            .build());

        var defaultClusterActivityStream = new ClusterActivityStream("defaultClusterActivityStream", ClusterActivityStreamArgs.builder()        
            .resourceArn(defaultCluster.arn())
            .mode("async")
            .kmsKeyId(defaultKey.keyId())
            .build(), CustomResourceOptions.builder()
                .dependsOn(defaultClusterInstance)
                .build());

    }
}
import pulumi
import pulumi_aws as aws

default_cluster = aws.rds.Cluster("defaultCluster",
    cluster_identifier="aurora-cluster-demo",
    availability_zones=[
        "us-west-2a",
        "us-west-2b",
        "us-west-2c",
    ],
    database_name="mydb",
    master_username="foo",
    master_password="mustbeeightcharaters",
    engine="aurora-postgresql",
    engine_version="13.4")
default_cluster_instance = aws.rds.ClusterInstance("defaultClusterInstance",
    identifier="aurora-instance-demo",
    cluster_identifier=default_cluster.cluster_identifier,
    engine=default_cluster.engine,
    instance_class="db.r6g.large")
default_key = aws.kms.Key("defaultKey", description="AWS KMS Key to encrypt Database Activity Stream")
default_cluster_activity_stream = aws.rds.ClusterActivityStream("defaultClusterActivityStream",
    resource_arn=default_cluster.arn,
    mode="async",
    kms_key_id=default_key.key_id,
    opts=pulumi.ResourceOptions(depends_on=[default_cluster_instance]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const defaultCluster = new aws.rds.Cluster("defaultCluster", {
    clusterIdentifier: "aurora-cluster-demo",
    availabilityZones: [
        "us-west-2a",
        "us-west-2b",
        "us-west-2c",
    ],
    databaseName: "mydb",
    masterUsername: "foo",
    masterPassword: "mustbeeightcharaters",
    engine: "aurora-postgresql",
    engineVersion: "13.4",
});
const defaultClusterInstance = new aws.rds.ClusterInstance("defaultClusterInstance", {
    identifier: "aurora-instance-demo",
    clusterIdentifier: defaultCluster.clusterIdentifier,
    engine: defaultCluster.engine,
    instanceClass: "db.r6g.large",
});
const defaultKey = new aws.kms.Key("defaultKey", {description: "AWS KMS Key to encrypt Database Activity Stream"});
const defaultClusterActivityStream = new aws.rds.ClusterActivityStream("defaultClusterActivityStream", {
    resourceArn: defaultCluster.arn,
    mode: "async",
    kmsKeyId: defaultKey.keyId,
}, {
    dependsOn: [defaultClusterInstance],
});
resources:
  defaultCluster:
    type: aws:rds:Cluster
    properties:
      clusterIdentifier: aurora-cluster-demo
      availabilityZones:
        - us-west-2a
        - us-west-2b
        - us-west-2c
      databaseName: mydb
      masterUsername: foo
      masterPassword: mustbeeightcharaters
      engine: aurora-postgresql
      engineVersion: '13.4'
  defaultClusterInstance:
    type: aws:rds:ClusterInstance
    properties:
      identifier: aurora-instance-demo
      clusterIdentifier: ${defaultCluster.clusterIdentifier}
      engine: ${defaultCluster.engine}
      instanceClass: db.r6g.large
  defaultKey:
    type: aws:kms:Key
    properties:
      description: AWS KMS Key to encrypt Database Activity Stream
  defaultClusterActivityStream:
    type: aws:rds:ClusterActivityStream
    properties:
      resourceArn: ${defaultCluster.arn}
      mode: async
      kmsKeyId: ${defaultKey.keyId}
    options:
      dependson:
        - ${defaultClusterInstance}

Create ClusterActivityStream Resource

new ClusterActivityStream(name: string, args: ClusterActivityStreamArgs, opts?: CustomResourceOptions);
@overload
def ClusterActivityStream(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          engine_native_audit_fields_included: Optional[bool] = None,
                          kms_key_id: Optional[str] = None,
                          mode: Optional[str] = None,
                          resource_arn: Optional[str] = None)
@overload
def ClusterActivityStream(resource_name: str,
                          args: ClusterActivityStreamArgs,
                          opts: Optional[ResourceOptions] = None)
func NewClusterActivityStream(ctx *Context, name string, args ClusterActivityStreamArgs, opts ...ResourceOption) (*ClusterActivityStream, error)
public ClusterActivityStream(string name, ClusterActivityStreamArgs args, CustomResourceOptions? opts = null)
public ClusterActivityStream(String name, ClusterActivityStreamArgs args)
public ClusterActivityStream(String name, ClusterActivityStreamArgs args, CustomResourceOptions options)
type: aws:rds:ClusterActivityStream
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ClusterActivityStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ClusterActivityStreamArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ClusterActivityStreamArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClusterActivityStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ClusterActivityStreamArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ClusterActivityStream Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ClusterActivityStream resource accepts the following input properties:

KmsKeyId string

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.

Mode string

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.

ResourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

EngineNativeAuditFieldsIncluded bool

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.

KmsKeyId string

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.

Mode string

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.

ResourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

EngineNativeAuditFieldsIncluded bool

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.

kmsKeyId String

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.

mode String

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.

resourceArn String

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded Boolean

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.

kmsKeyId string

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.

mode string

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.

resourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded boolean

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.

kms_key_id str

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.

mode str

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.

resource_arn str

The Amazon Resource Name (ARN) of the DB cluster.

engine_native_audit_fields_included bool

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.

kmsKeyId String

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.

mode String

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.

resourceArn String

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded Boolean

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.

Outputs

All input properties are implicitly available as output properties. Additionally, the ClusterActivityStream resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

KinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

Id string

The provider-assigned unique ID for this managed resource.

KinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

id String

The provider-assigned unique ID for this managed resource.

kinesisStreamName String

The name of the Amazon Kinesis data stream to be used for the database activity stream.

id string

The provider-assigned unique ID for this managed resource.

kinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

id str

The provider-assigned unique ID for this managed resource.

kinesis_stream_name str

The name of the Amazon Kinesis data stream to be used for the database activity stream.

id String

The provider-assigned unique ID for this managed resource.

kinesisStreamName String

The name of the Amazon Kinesis data stream to be used for the database activity stream.

Look up Existing ClusterActivityStream Resource

Get an existing ClusterActivityStream resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ClusterActivityStreamState, opts?: CustomResourceOptions): ClusterActivityStream
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        engine_native_audit_fields_included: Optional[bool] = None,
        kinesis_stream_name: Optional[str] = None,
        kms_key_id: Optional[str] = None,
        mode: Optional[str] = None,
        resource_arn: Optional[str] = None) -> ClusterActivityStream
func GetClusterActivityStream(ctx *Context, name string, id IDInput, state *ClusterActivityStreamState, opts ...ResourceOption) (*ClusterActivityStream, error)
public static ClusterActivityStream Get(string name, Input<string> id, ClusterActivityStreamState? state, CustomResourceOptions? opts = null)
public static ClusterActivityStream get(String name, Output<String> id, ClusterActivityStreamState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
EngineNativeAuditFieldsIncluded bool

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.

KinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

KmsKeyId string

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.

Mode string

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.

ResourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

EngineNativeAuditFieldsIncluded bool

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.

KinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

KmsKeyId string

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.

Mode string

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.

ResourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded Boolean

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.

kinesisStreamName String

The name of the Amazon Kinesis data stream to be used for the database activity stream.

kmsKeyId String

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.

mode String

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.

resourceArn String

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded boolean

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.

kinesisStreamName string

The name of the Amazon Kinesis data stream to be used for the database activity stream.

kmsKeyId string

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.

mode string

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.

resourceArn string

The Amazon Resource Name (ARN) of the DB cluster.

engine_native_audit_fields_included bool

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.

kinesis_stream_name str

The name of the Amazon Kinesis data stream to be used for the database activity stream.

kms_key_id str

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.

mode str

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.

resource_arn str

The Amazon Resource Name (ARN) of the DB cluster.

engineNativeAuditFieldsIncluded Boolean

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.

kinesisStreamName String

The name of the Amazon Kinesis data stream to be used for the database activity stream.

kmsKeyId String

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.

mode String

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.

resourceArn String

The Amazon Resource Name (ARN) of the DB cluster.

Import

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

 $ pulumi import aws:rds/clusterActivityStream:ClusterActivityStream default arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster-demo

[1]https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/DBActivityStreams.html [2]https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_StartActivityStream.html [3]https://docs.aws.amazon.com/cli/latest/reference/rds/start-activity-stream.html

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.