Cluster

class aws_cdk.aws_redshift.Cluster(scope, id, *, master_user, vpc, cluster_name=None, cluster_type=None, default_database_name=None, encrypted=None, encryption_key=None, logging_bucket=None, logging_key_prefix=None, node_type=None, number_of_nodes=None, parameter_group=None, port=None, preferred_maintenance_window=None, publicly_accessible=None, removal_policy=None, roles=None, security_groups=None, subnet_group=None, vpc_subnets=None)

Bases: Resource

(experimental) Create a Redshift cluster a given number of nodes.

Stability:

experimental

Resource:

AWS::Redshift::Cluster

ExampleMetadata:

infused

Example:

import aws_cdk.aws_ec2 as ec2


vpc = ec2.Vpc(self, "Vpc")
cluster = Cluster(self, "Redshift",
    master_user=Login(
        master_username="admin"
    ),
    vpc=vpc
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • master_user (Union[Login, Dict[str, Any]]) – (experimental) Username and password for the administrative user.

  • vpc (IVpc) – (experimental) The VPC to place the cluster in.

  • cluster_name (Optional[str]) – (experimental) An optional identifier for the cluster. Default: - A name is automatically generated.

  • cluster_type (Optional[ClusterType]) – (experimental) Settings for the individual instances that are launched. Default: {@link ClusterType.MULTI_NODE}

  • default_database_name (Optional[str]) – (experimental) Name of a database which is automatically created inside the cluster. Default: - default_db

  • encrypted (Optional[bool]) – (experimental) Whether to enable encryption of data at rest in the cluster. Default: true

  • encryption_key (Optional[IKey]) – (experimental) The KMS key to use for encryption of data at rest. Default: - AWS-managed key, if encryption at rest is enabled

  • logging_bucket (Optional[IBucket]) – (experimental) Bucket to send logs to. Logging information includes queries and connection attempts, for the specified Amazon Redshift cluster. Default: - No Logs

  • logging_key_prefix (Optional[str]) – (experimental) Prefix used for logging. Default: - no prefix

  • node_type (Optional[NodeType]) – (experimental) The node type to be provisioned for the cluster. Default: {@link NodeType.DC2_LARGE}

  • number_of_nodes (Union[int, float, None]) – (experimental) Number of compute nodes in the cluster. Only specify this property for multi-node clusters. Value must be at least 2 and no more than 100. Default: - 2 if clusterType is ClusterType.MULTI_NODE, undefined otherwise

  • parameter_group (Optional[IClusterParameterGroup]) – (experimental) Additional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html. Default: - No parameter group.

  • port (Union[int, float, None]) – (experimental) What port to listen on. Default: - The default for the engine is used.

  • preferred_maintenance_window (Optional[str]) – (experimental) A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). Example: ‘Sun:23:45-Mon:00:15’ Default: - 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week.

  • publicly_accessible (Optional[bool]) – (experimental) Whether to make cluster publicly accessible. Default: false

  • removal_policy (Optional[RemovalPolicy]) – (experimental) The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. Default: RemovalPolicy.RETAIN

  • roles (Optional[Sequence[IRole]]) – (experimental) A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services. Specify a maximum of 10 roles. Default: - No role is attached to the cluster.

  • security_groups (Optional[Sequence[ISecurityGroup]]) – (experimental) Security group. Default: - a new security group is created.

  • subnet_group (Optional[IClusterSubnetGroup]) – (experimental) A cluster subnet group to use with this cluster. Default: - a new subnet group will be created.

  • vpc_subnets (Union[SubnetSelection, Dict[str, Any], None]) – (experimental) Where to place the instances within the VPC. Default: - private subnets

Stability:

experimental

Methods

add_rotation_multi_user(id, *, secret, automatically_after=None)

(experimental) Adds the multi user rotation to this cluster.

Parameters:
  • id (str) –

  • secret (ISecret) – (experimental) The secret to rotate. It must be a JSON string with the following format:: { “engine”: <required: database engine>, “host”: <required: instance host name>, “username”: <required: username>, “password”: <required: password>, “dbname”: <optional: database name>, “port”: <optional: if not specified, default port will be used>, “masterarn”: <required: the arn of the master secret which will be used to create users/change passwords> }

  • automatically_after (Optional[Duration]) – (experimental) Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. Default: Duration.days(30)

Stability:

experimental

Return type:

SecretRotation

add_rotation_single_user(automatically_after=None)

(experimental) Adds the single user rotation of the master password to this cluster.

Parameters:

automatically_after (Optional[Duration]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.

Stability:

experimental

Return type:

SecretRotation

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

as_secret_attachment_target()

(experimental) Renders the secret attachment target specifications.

Stability:

experimental

Return type:

SecretAttachmentTargetProps

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

cluster_endpoint

(experimental) The endpoint to use for read/write operations.

Stability:

experimental

cluster_name

(experimental) Identifier of the cluster.

Stability:

experimental

connections

(experimental) Access to the network connections.

Stability:

experimental

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

node

The construct tree node associated with this construct.

secret

(experimental) The secret attached to this cluster.

Stability:

experimental

stack

The stack in which this resource is defined.

Static Methods

classmethod from_cluster_attributes(scope, id, *, cluster_endpoint_address, cluster_endpoint_port, cluster_name, security_groups=None)

(experimental) Import an existing DatabaseCluster from properties.

Parameters:
  • scope (Construct) –

  • id (str) –

  • cluster_endpoint_address (str) – (experimental) Cluster endpoint address.

  • cluster_endpoint_port (Union[int, float]) – (experimental) Cluster endpoint port.

  • cluster_name (str) – (experimental) Identifier for the cluster.

  • security_groups (Optional[Sequence[ISecurityGroup]]) – (experimental) The security groups of the redshift cluster. Default: no security groups will be attached to the import

Stability:

experimental

Return type:

ICluster

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool