Skip to content
v2.277.0

Experimental

@aws-cdk/aws-redshift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ClusterLogging Class ​

The logging configuration for a Redshift cluster.

Example ​

ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { ClusterLogging } from '@aws-cdk/aws-redshift-alpha';

declare const vpc: ec2.IVpc;
declare const bucket: s3.IBucket;

const cluster = new Cluster(this, 'Redshift', {
  masterUser: {
    masterUsername: 'admin',
  },
  vpc,
  logging: ClusterLogging.s3({
    bucket,
    keyPrefix: 'redshift-logs/',
  }),
});
python
from aws_cdk.aws_redshift_alpha import Login
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_s3 as s3
from aws_cdk.aws_redshift_alpha import ClusterLogging

# vpc: ec2.IVpc
# bucket: s3.IBucket


cluster = Cluster(self, "Redshift",
    master_user=Login(
        master_username="admin"
    ),
    vpc=vpc,
    logging=ClusterLogging.s3(
        bucket=bucket,
        key_prefix="redshift-logs/"
    )
)
java
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.s3.*;
import software.amazon.awscdk.services.redshift.alpha.ClusterLogging;

IVpc vpc;
IBucket bucket;


Cluster cluster = Cluster.Builder.create(this, "Redshift")
        .masterUser(Login.builder()
                .masterUsername("admin")
                .build())
        .vpc(vpc)
        .logging(ClusterLogging.s3(S3LoggingOptions.builder()
                .bucket(bucket)
                .keyPrefix("redshift-logs/")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.S3;
using Amazon.CDK.AWS.Redshift.Alpha;

IVpc vpc;
IBucket bucket;


var cluster = new Cluster(this, "Redshift", new ClusterProps {
    MasterUser = new Login {
        MasterUsername = "admin"
    },
    Vpc = vpc,
    Logging = ClusterLogging.S3(new S3LoggingOptions {
        Bucket = bucket,
        KeyPrefix = "redshift-logs/"
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
import ec2 "github.com/aws/aws-cdk-go/awscdk"
import s3 "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

var vpc IVpc
var bucket IBucket


cluster := awscdkredshiftalpha.NewCluster(this, jsii.String("Redshift"), &ClusterProps{
	MasterUser: &Login{
		MasterUsername: jsii.String("admin"),
	},
	Vpc: Vpc,
	Logging: awscdkredshiftalpha.ClusterLogging_S3(&S3LoggingOptions{
		Bucket: *Bucket,
		KeyPrefix: jsii.String("redshift-logs/"),
	}),
})

Initializer ​

ts
new ClusterLogging()
python
ClusterLogging()
java
new ClusterLogging()
csharp
new ClusterLogging()
go
NewClusterLogging()

Methods ​

cloudWatch(options?: CloudWatchLoggingOptions): ClusterLogging // chainable@staticmethod def cloud_watch(options: typing.Optional[CloudWatchLoggingOptions] = None) -> ClusterLoggingpublic static ClusterLogging cloudWatch(CloudWatchLoggingOptions options)public static ClusterLogging CloudWatch(CloudWatchLoggingOptions? options = null)func CloudWatch(Options CloudWatchLoggingOptions) ClusterLogging static #
Send logs to CloudWatch.
s3(options: S3LoggingOptions): ClusterLogging // chainable@staticmethod def s3(options: S3LoggingOptions) -> ClusterLoggingpublic static ClusterLogging s3(S3LoggingOptions options)public static ClusterLogging S3(S3LoggingOptions options)func S3(Options S3LoggingOptions) ClusterLogging static #
Send logs to S3.