AWS CDK Redshift Alpha

2.250.0a0 · active · verified Fri Apr 17

The `aws-cdk-aws-redshift-alpha` library provides AWS Cloud Development Kit (CDK) constructs for defining AWS Redshift resources. As an 'alpha' module, it's under active development, offering early access to features not yet available in the stable `aws-cdk-lib`. The current version is `2.250.0a0`, aligning with the main CDK v2 release train, with frequent updates corresponding to new CDK core versions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart defines a basic AWS CDK stack that provisions an AWS Redshift cluster within a new VPC. It uses single-node, DC2.LARGE instance types for a low-cost, quick-to-provision example. After saving this code to a file (e.g., `app.py`), you can run `python app.py` to synthesize the CloudFormation template, and then `cdk deploy` to provision the resources in your AWS account.

from aws_cdk import (
    App, Stack,
    aws_ec2 as ec2,
    aws_redshift_alpha as redshift_alpha,
)
from constructs import Construct

class RedshiftAlphaQuickstartStack(Stack):
    def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        # Create a VPC for the Redshift cluster
        vpc = ec2.Vpc(self, "RedshiftQuickstartVPC", max_azs=1)

        # Create an AWS Redshift Cluster using the alpha construct
        cluster = redshift_alpha.Cluster(self, "MyRedshiftQuickstartCluster",
            vpc=vpc,
            cluster_type=redshift_alpha.ClusterType.SINGLE_NODE, # Use SINGLE_NODE for a quicker, cheaper example
            node_type=redshift_alpha.NodeType.DC2_LARGE, # Use a smaller node type for example
            master_user=redshift_alpha.Login("admin"),
            db_name="quickstartdb",
            publicly_accessible=False
        )

# Instantiate the CDK App and synthesize the stack
app = App()
RedshiftAlphaQuickstartStack(app, "RedshiftAlphaQuickstartStack")
app.synth()
print("CDK Redshift Alpha quickstart stack synthesized successfully.")
# To deploy this stack: cdk deploy RedshiftAlphaQuickstartStack

view raw JSON →