Cluster

class aws_cdk.aws_redshift_alpha.Cluster(scope, id, *, master_user, vpc, classic_resizing=None, cluster_name=None, cluster_type=None, default_database_name=None, default_role=None, elastic_ip=None, encrypted=None, encryption_key=None, enhanced_vpc_routing=None, logging_properties=None, multi_az=None, node_type=None, number_of_nodes=None, parameter_group=None, port=None, preferred_maintenance_window=None, publicly_accessible=None, reboot_for_parameter_changes=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
import aws_cdk as cdk
# vpc: ec2.Vpc


cluster = Cluster(self, "Cluster",
    master_user=Login(
        master_username="admin",
        master_password=cdk.SecretValue.unsafe_plain_text("tooshort")
    ),
    vpc=vpc
)

cluster.add_to_parameter_group("enable_user_activity_logging", "true")
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.

  • classic_resizing (Optional[bool]) – (experimental) If this flag is set, the cluster resizing type will be set to classic. When resizing a cluster, classic resizing will always provision a new cluster and transfer the data there. Classic resize takes more time to complete, but it can be useful in cases where the change in node count or the node type to migrate to doesn’t fall within the bounds for elastic resize. Default: - Elastic resize type

  • 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: ClusterType.MULTI_NODE

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

  • default_role (Optional[IRole]) – (experimental) A single AWS Identity and Access Management (IAM) role to be used as the default role for the cluster. The default role must be included in the roles list. Default: - No default role is specified for the cluster.

  • elastic_ip (Optional[str]) – (experimental) The Elastic IP (EIP) address for the cluster. Default: - No Elastic IP

  • 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

  • enhanced_vpc_routing (Optional[bool]) – (experimental) If this flag is set, Amazon Redshift forces all COPY and UNLOAD traffic between your cluster and your data repositories through your virtual private cloud (VPC). Default: - false

  • logging_properties (Union[LoggingProperties, Dict[str, Any], None]) – (experimental) Bucket details for log files to be sent to, including prefix. Default: - No logging bucket is used

  • multi_az (Optional[bool]) – (experimental) Indicating whether Amazon Redshift should deploy the cluster in two Availability Zones. Default: - false

  • node_type (Optional[NodeType]) – (experimental) The node type to be provisioned for the cluster. Default: 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

  • reboot_for_parameter_changes (Optional[bool]) – (experimental) If this flag is set, the cluster will be rebooted when changes to the cluster’s parameter group that require a restart to apply. 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. The maximum number of roles to attach to a cluster is subject to a quota. 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_default_iam_role(default_iam_role)

(experimental) Adds default IAM role to cluster.

The default IAM role must be already associated to the cluster to be added as the default role.

Parameters:

default_iam_role (IRole) – the IAM role to be set as the default role.

Stability:

experimental

Return type:

None

add_iam_role(role)

(experimental) Adds a role to the cluster.

Parameters:

role (IRole) – the role to add.

Stability:

experimental

Return type:

None

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

add_to_parameter_group(name, value)

(experimental) Adds a parameter to the Clusters’ parameter group.

Parameters:
  • name (str) – the parameter name.

  • value (str) – the parameter name.

Stability:

experimental

Return type:

None

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

enable_reboot_for_parameter_changes()

(experimental) Enables automatic cluster rebooting when changes to the cluster’s parameter group require a restart to apply.

Stability:

experimental

Return type:

None

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 tree node.

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)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool