@aws-cdk_aws-redshift-alpha.Cluster

class Cluster (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Redshift.Alpha.Cluster
Gogithub.com/aws/aws-cdk-go/awscdkredshiftalpha/v2#Cluster
Javasoftware.amazon.awscdk.services.redshift.alpha.Cluster
Pythonaws_cdk.aws_redshift_alpha.Cluster
TypeScript (source)@aws-cdk/aws-redshift-alpha ยป Cluster

Implements IConstruct, IDependable, IResource, ICluster, IConnectable, ISecretAttachmentTarget

Create a Redshift cluster a given number of nodes.

Example

import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as cdk from 'aws-cdk-lib';
declare const vpc: ec2.Vpc;

const cluster = new Cluster(this, 'Cluster', {
  masterUser: {
    masterUsername: 'admin',
    masterPassword: cdk.SecretValue.unsafePlainText('tooshort'),
  },
  vpc,
});

cluster.addToParameterGroup('enable_user_activity_logging', 'true');

Initializer

new Cluster(scope: Construct, id: string, props: ClusterProps)

Parameters

  • scope Construct
  • id string
  • props ClusterProps

Construct Props

NameTypeDescription
masterUser๐Ÿ”นLoginUsername and password for the administrative user.
vpc๐Ÿ”นIVpcThe VPC to place the cluster in.
classicResizing?๐Ÿ”นbooleanIf this flag is set, the cluster resizing type will be set to classic.
clusterName?๐Ÿ”นstringAn optional identifier for the cluster.
clusterType?๐Ÿ”นClusterTypeSettings for the individual instances that are launched.
defaultDatabaseName?๐Ÿ”นstringName of a database which is automatically created inside the cluster.
defaultRole?๐Ÿ”นIRoleA single AWS Identity and Access Management (IAM) role to be used as the default role for the cluster.
elasticIp?๐Ÿ”นstringThe Elastic IP (EIP) address for the cluster.
encrypted?๐Ÿ”นbooleanWhether to enable encryption of data at rest in the cluster.
encryptionKey?๐Ÿ”นIKeyThe KMS key to use for encryption of data at rest.
enhancedVpcRouting?๐Ÿ”นbooleanIf 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).
loggingProperties?๐Ÿ”นLoggingPropertiesBucket details for log files to be sent to, including prefix.
nodeType?๐Ÿ”นNodeTypeThe node type to be provisioned for the cluster.
numberOfNodes?๐Ÿ”นnumberNumber of compute nodes in the cluster. Only specify this property for multi-node clusters.
parameterGroup?๐Ÿ”นIClusterParameterGroupAdditional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html.
port?๐Ÿ”นnumberWhat port to listen on.
preferredMaintenanceWindow?๐Ÿ”นstringA preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).
publiclyAccessible?๐Ÿ”นbooleanWhether to make cluster publicly accessible.
rebootForParameterChanges?๐Ÿ”นbooleanIf this flag is set, the cluster will be rebooted when changes to the cluster's parameter group that require a restart to apply.
removalPolicy?๐Ÿ”นRemovalPolicyThe removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.
roles?๐Ÿ”นIRole[]A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services.
securityGroups?๐Ÿ”นISecurityGroup[]Security group.
subnetGroup?๐Ÿ”นIClusterSubnetGroupA cluster subnet group to use with this cluster.
vpcSubnets?๐Ÿ”นSubnetSelectionWhere to place the instances within the VPC.

masterUser๐Ÿ”น

Type: Login

Username and password for the administrative user.


vpc๐Ÿ”น

Type: IVpc

The VPC to place the cluster in.


classicResizing?๐Ÿ”น

Type: boolean (optional, default: Elastic resize type)

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.

See also: https://docs.aws.amazon.com/redshift/latest/mgmt/managing-cluster-operations.html#elastic-resize


clusterName?๐Ÿ”น

Type: string (optional, default: A name is automatically generated.)

An optional identifier for the cluster.


clusterType?๐Ÿ”น

Type: ClusterType (optional, default: ClusterType.MULTI_NODE)

Settings for the individual instances that are launched.


defaultDatabaseName?๐Ÿ”น

Type: string (optional, default: default_db)

Name of a database which is automatically created inside the cluster.


defaultRole?๐Ÿ”น

Type: IRole (optional, default: No default role is specified for the cluster.)

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.


elasticIp?๐Ÿ”น

Type: string (optional, default: No Elastic IP)

The Elastic IP (EIP) address for the cluster.

See also: https://docs.aws.amazon.com/redshift/latest/mgmt/managing-clusters-vpc.html


encrypted?๐Ÿ”น

Type: boolean (optional, default: true)

Whether to enable encryption of data at rest in the cluster.


encryptionKey?๐Ÿ”น

Type: IKey (optional, default: AWS-managed key, if encryption at rest is enabled)

The KMS key to use for encryption of data at rest.


enhancedVpcRouting?๐Ÿ”น

Type: boolean (optional, default: false)

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).

See also: https://docs.aws.amazon.com/redshift/latest/mgmt/enhanced-vpc-routing.html


loggingProperties?๐Ÿ”น

Type: LoggingProperties (optional, default: No logging bucket is used)

Bucket details for log files to be sent to, including prefix.


nodeType?๐Ÿ”น

Type: NodeType (optional, default: NodeType.DC2_LARGE)

The node type to be provisioned for the cluster.


numberOfNodes?๐Ÿ”น

Type: number (optional, default: 2 if clusterType is ClusterType.MULTI_NODE, undefined otherwise)

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.


parameterGroup?๐Ÿ”น

Type: IClusterParameterGroup (optional, default: No parameter group.)

Additional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html.


port?๐Ÿ”น

Type: number (optional, default: The default for the engine is used.)

What port to listen on.


preferredMaintenanceWindow?๐Ÿ”น

Type: string (optional, 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.)

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'

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance


publiclyAccessible?๐Ÿ”น

Type: boolean (optional, default: false)

Whether to make cluster publicly accessible.


rebootForParameterChanges?๐Ÿ”น

Type: boolean (optional, default: false)

If this flag is set, the cluster will be rebooted when changes to the cluster's parameter group that require a restart to apply.


removalPolicy?๐Ÿ”น

Type: RemovalPolicy (optional, default: RemovalPolicy.RETAIN)

The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.


roles?๐Ÿ”น

Type: IRole[] (optional, default: No role is attached to the cluster.)

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.


securityGroups?๐Ÿ”น

Type: ISecurityGroup[] (optional, default: a new security group is created.)

Security group.


subnetGroup?๐Ÿ”น

Type: IClusterSubnetGroup (optional, default: a new subnet group will be created.)

A cluster subnet group to use with this cluster.


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional, default: private subnets)

Where to place the instances within the VPC.

Properties

NameTypeDescription
clusterEndpoint๐Ÿ”นEndpointThe endpoint to use for read/write operations.
clusterName๐Ÿ”นstringIdentifier of the cluster.
connections๐Ÿ”นConnectionsAccess to the network connections.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.
parameterGroup?๐Ÿ”นIClusterParameterGroupThe cluster's parameter group.
secret?๐Ÿ”นISecretThe secret attached to this cluster.

clusterEndpoint๐Ÿ”น

Type: Endpoint

The endpoint to use for read/write operations.


clusterName๐Ÿ”น

Type: string

Identifier of the cluster.


connections๐Ÿ”น

Type: Connections

Access to the network connections.


env๐Ÿ”น

Type: ResourceEnvironment

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๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


parameterGroup?๐Ÿ”น

Type: IClusterParameterGroup (optional)

The cluster's parameter group.


secret?๐Ÿ”น

Type: ISecret (optional)

The secret attached to this cluster.

Methods

NameDescription
addDefaultIamRole(defaultIamRole)๐Ÿ”นAdds default IAM role to cluster.
addIamRole(role)๐Ÿ”นAdds a role to the cluster.
addRotationMultiUser(id, options)๐Ÿ”นAdds the multi user rotation to this cluster.
addRotationSingleUser(automaticallyAfter?)๐Ÿ”นAdds the single user rotation of the master password to this cluster.
addToParameterGroup(name, value)๐Ÿ”นAdds a parameter to the Clusters' parameter group.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
asSecretAttachmentTarget()๐Ÿ”นRenders the secret attachment target specifications.
enableRebootForParameterChanges()๐Ÿ”นEnables automatic cluster rebooting when changes to the cluster's parameter group require a restart to apply.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromClusterAttributes(scope, id, attrs)๐Ÿ”นImport an existing DatabaseCluster from properties.

addDefaultIamRole(defaultIamRole)๐Ÿ”น

public addDefaultIamRole(defaultIamRole: IRole): void

Parameters

  • defaultIamRole IRole โ€” the IAM role to be set as the default role.

Adds default IAM role to cluster.

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


addIamRole(role)๐Ÿ”น

public addIamRole(role: IRole): void

Parameters

  • role IRole โ€” the role to add.

Adds a role to the cluster.


addRotationMultiUser(id, options)๐Ÿ”น

public addRotationMultiUser(id: string, options: RotationMultiUserOptions): SecretRotation

Parameters

  • id string
  • options RotationMultiUserOptions

Returns

  • SecretRotation

Adds the multi user rotation to this cluster.


addRotationSingleUser(automaticallyAfter?)๐Ÿ”น

public addRotationSingleUser(automaticallyAfter?: Duration): SecretRotation

Parameters

  • automaticallyAfter Duration โ€” Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.

Returns

  • SecretRotation

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


addToParameterGroup(name, value)๐Ÿ”น

public addToParameterGroup(name: string, value: string): void

Parameters

  • name string โ€” the parameter name.
  • value string โ€” the parameter name.

Adds a parameter to the Clusters' parameter group.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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).


asSecretAttachmentTarget()๐Ÿ”น

public asSecretAttachmentTarget(): SecretAttachmentTargetProps

Returns

  • SecretAttachmentTargetProps

Renders the secret attachment target specifications.


enableRebootForParameterChanges()๐Ÿ”น

public enableRebootForParameterChanges(): void

Enables automatic cluster rebooting when changes to the cluster's parameter group require a restart to apply.


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromClusterAttributes(scope, id, attrs)๐Ÿ”น

public static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster

Parameters

  • scope Construct
  • id string
  • attrs ClusterAttributes

Returns

  • ICluster

Import an existing DatabaseCluster from properties.