Skip to content
v2.274.0

Experimental

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

Cluster L2 construct ​

Create a Redshift cluster a given number of nodes.

Example ​

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

const defaultRole = new iam.Role(this, 'DefaultRole', {
  assumedBy: new iam.ServicePrincipal('redshift.amazonaws.com'),
},
);

new Cluster(this, 'Redshift', {
    masterUser: {
      masterUsername: 'admin',
    },
    vpc,
    roles: [defaultRole],
    defaultRole: defaultRole,
});
python
from aws_cdk.aws_redshift_alpha import Login
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_iam as iam
# vpc: ec2.Vpc


default_role = iam.Role(self, "DefaultRole",
    assumed_by=iam.ServicePrincipal("redshift.amazonaws.com")
)

Cluster(self, "Redshift",
    master_user=Login(
        master_username="admin"
    ),
    vpc=vpc,
    roles=[default_role],
    default_role=default_role
)
java
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.iam.*;
Vpc vpc;


Role defaultRole = Role.Builder.create(this, "DefaultRole")
        .assumedBy(new ServicePrincipal("redshift.amazonaws.com"))
        .build();

Cluster.Builder.create(this, "Redshift")
        .masterUser(Login.builder()
                .masterUsername("admin")
                .build())
        .vpc(vpc)
        .roles(List.of(defaultRole))
        .defaultRole(defaultRole)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.IAM;
Vpc vpc;


var defaultRole = new Role(this, "DefaultRole", new RoleProps {
    AssumedBy = new ServicePrincipal("redshift.amazonaws.com")
});

new Cluster(this, "Redshift", new ClusterProps {
    MasterUser = new Login {
        MasterUsername = "admin"
    },
    Vpc = vpc,
    Roles = new [] { defaultRole },
    DefaultRole = defaultRole
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
import ec2 "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var vpc Vpc


defaultRole := iam.NewRole(this, jsii.String("DefaultRole"), &RoleProps{
	AssumedBy: iam.NewServicePrincipal(jsii.String("redshift.amazonaws.com")),
})

awscdkredshiftalpha.NewCluster(this, jsii.String("Redshift"), &ClusterProps{
	MasterUser: &Login{
		MasterUsername: jsii.String("admin"),
	},
	Vpc: Vpc,
	Roles: []IRole{
		defaultRole,
	},
	DefaultRole: defaultRole,
})

Initializer ​

ts
new Cluster(scope: Construct, id: string, props: ClusterProps)
python
Cluster(scope: Construct, id: str, props: ClusterProps)
java
new Cluster(Construct scope, String id, ClusterProps props)
csharp
new Cluster(Construct scope, string id, ClusterProps props)
go
NewCluster(Scope Construct, Id *string, Props ClusterProps)

Construct Props ​

availabilityZoneRelocationbooleanavailability_zone_relocationboolavailabilityZoneRelocationBooleanAvailabilityZoneRelocationboolAvailabilityZoneRelocation*bool= false#
Whether to enable relocation for an Amazon Redshift cluster between Availability Zones after the cluster is created.
classicResizingbooleanclassic_resizingboolclassicResizingBooleanClassicResizingboolClassicResizing*bool= Elastic resize type#
If this flag is set, the cluster resizing type will be set to classic.
notes

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.

clusterNamestringcluster_namestrclusterNameStringClusterNamestringClusterName*string= A name is automatically generate…#
An optional identifier for the cluster.
default

Default: A name is automatically generated.

clusterTypeClusterTypecluster_typeClusterTypeclusterTypeClusterTypeClusterTypeClusterTypeClusterTypeClusterType= `ClusterType.MULTI_NODE`#
Settings for the individual instances that are launched.
defaultDatabaseNamestringdefault_database_namestrdefaultDatabaseNameStringDefaultDatabaseNamestringDefaultDatabaseName*string= default_db#
Name of a database which is automatically created inside the cluster.
defaultRoleIRoledefault_roleIRoledefaultRoleIRoleDefaultRoleIRoleDefaultRoleIRole= No default role is specified for…#
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

Default: No default role is specified for the cluster.

elasticIpstringelastic_ipstrelasticIpStringElasticIpstringElasticIp*string= No Elastic IP#
The Elastic IP (EIP) address for the cluster.
encryptedbooleanencryptedboolencryptedBooleanEncryptedboolEncrypted*bool= true#
Whether to enable encryption of data at rest in the cluster.
encryptionKeyIKeyRefencryption_keyIKeyRefencryptionKeyIKeyRefEncryptionKeyIKeyRefEncryptionKeyIKeyRef= AWS-managed key, if encryption a…#
The KMS key to use for encryption of data at rest.
default

Default: AWS-managed key, if encryption at rest is enabled

enhancedVpcRoutingbooleanenhanced_vpc_routingboolenhancedVpcRoutingBooleanEnhancedVpcRoutingboolEnhancedVpcRouting*bool= 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).
Logging configuration for the cluster.
maintenanceTrackNameMaintenanceTrackNamemaintenance_track_nameMaintenanceTrackNamemaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackName= undefined - Redshift default is …#
The maintenance track name for the cluster.
default

Default: undefined - Redshift default is current

masterUserLoginmaster_userLoginmasterUserLoginMasterUserLoginMasterUserLoginrequired#
Username and password for the administrative user.
multiAzbooleanmulti_azboolmultiAzBooleanMultiAzboolMultiAz*bool= false#
Indicating whether Amazon Redshift should deploy the cluster in two Availability Zones.
nodeTypeNodeTypenode_typeNodeTypenodeTypeNodeTypeNodeTypeNodeTypeNodeTypeNodeType= `NodeType.RA3_LARGE`#
The node type to be provisioned for the cluster.
numberOfNodesnumbernumber_of_nodesint | floatnumberOfNodesNumberNumberOfNodesdoubleNumberOfNodes*float64= 2 if `clusterType` is ClusterTyp…#
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

Default: 2 if clusterType is ClusterType.MULTI_NODE, undefined otherwise

parameterGroupIClusterParameterGroupparameter_groupIClusterParameterGroupparameterGroupIClusterParameterGroupParameterGroupIClusterParameterGroupParameterGroupIClusterParameterGroup= No parameter group.#
Additional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html.
portnumberportint | floatportNumberPortdoublePort*float64= The default for the engine is us…#
What port to listen on.
default

Default: The default for the engine is used.

preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string= 30-minute window selected at ran…#
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

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.

publiclyAccessiblebooleanpublicly_accessibleboolpubliclyAccessibleBooleanPubliclyAccessibleboolPubliclyAccessible*bool= false#
Whether to make cluster publicly accessible.
rebootForParameterChangesbooleanreboot_for_parameter_changesboolrebootForParameterChangesBooleanRebootForParameterChangesboolRebootForParameterChanges*bool= 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.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.RETAIN#
The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.
resourceActionResourceActionresource_actionResourceActionresourceActionResourceActionResourceActionResourceActionResourceActionResourceAction= no operation#
The Amazon Redshift operation to be performed.
rolesIRole[]rolestyping.List[IRole]rolesList<IRole>RolesIRole[]Roles*[]IRole= No role is attached to the clust…#
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

Default: No role is attached to the cluster.

securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= a new security group is created.#
Security group.
subnetGroupIClusterSubnetGroupsubnet_groupIClusterSubnetGroupsubnetGroupIClusterSubnetGroupSubnetGroupIClusterSubnetGroupSubnetGroupIClusterSubnetGroup= a new subnet group will be creat…#
A cluster subnet group to use with this cluster.
default

Default: a new subnet group will be created.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC to place the cluster in.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= private subnets#
Where to place the instances within the VPC.

Properties ​

clusterEndpointEndpointcluster_endpointEndpointclusterEndpointEndpointClusterEndpointEndpointClusterEndpointEndpointrequired#
The endpoint to use for read/write operations.
clusterNamestringcluster_namestrclusterNameStringClusterNamestringClusterName*stringrequired#
Identifier of the cluster.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
Access to the network connections.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
secretISecretsecretISecretsecretISecretSecretISecretSecretISecret#
The secret attached to this cluster.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

addDefaultIamRole(defaultIamRole: IRole): voiddef add_default_iam_role(self, default_iam_role: IRole) -> Nonepublic void addDefaultIamRole(IRole defaultIamRole)public void AddDefaultIamRole(IRole defaultIamRole)func AddDefaultIamRole(DefaultIamRole IRole)#
Adds default IAM role to cluster.

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

1 parameter

Parameters

  • defaultIamRoledefault_iam_roledefaultIamRoledefaultIamRoleDefaultIamRole — the IAM role to be set as the default role.
addIamRole(role: IRole): voiddef add_iam_role(self, role: IRole) -> Nonepublic void addIamRole(IRole role)public void AddIamRole(IRole role)func AddIamRole(Role IRole)#
Adds a role to the cluster.
1 parameter

Parameters

  • roleroleroleroleRole — the role to add.
addRotationMultiUser(id: string, options: RotationMultiUserOptions): SecretRotationdef add_rotation_multi_user(self, id: str, options: RotationMultiUserOptions) -> SecretRotationpublic SecretRotation addRotationMultiUser(String id, RotationMultiUserOptions options)public SecretRotation AddRotationMultiUser(string id, RotationMultiUserOptions options)func AddRotationMultiUser(Id *string, Options RotationMultiUserOptions) SecretRotation#
Adds the multi user rotation to this cluster.
addRotationSingleUser(automaticallyAfter?: Duration): SecretRotationdef add_rotation_single_user(self, automatically_after: typing.Optional[Duration] = None) -> SecretRotationpublic SecretRotation addRotationSingleUser(Duration automaticallyAfter)public SecretRotation AddRotationSingleUser(Duration? automaticallyAfter = null)func AddRotationSingleUser(AutomaticallyAfter Duration) SecretRotation#
Adds the single user rotation of the master password to this cluster.
1 parameter

Parameters

  • automaticallyAfterautomatically_afterautomaticallyAfterautomaticallyAfterAutomaticallyAfter — Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
addToParameterGroup(name: string, value: string): voiddef add_to_parameter_group(self, name: str, value: str) -> Nonepublic void addToParameterGroup(String name, String value)public void AddToParameterGroup(string name, string value)func AddToParameterGroup(Name *string, Value *string)#
Adds a parameter to the Clusters' parameter group.
2 parameters

Parameters

  • namenamenamenameName — the parameter name.
  • valuevaluevaluevalueValue — the parameter name.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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(): SecretAttachmentTargetPropsdef as_secret_attachment_target(self, ) -> SecretAttachmentTargetPropspublic SecretAttachmentTargetProps asSecretAttachmentTarget()public SecretAttachmentTargetProps AsSecretAttachmentTarget()func AsSecretAttachmentTarget() SecretAttachmentTargetProps#
Renders the secret attachment target specifications.
enableRebootForParameterChanges(): voiddef enable_reboot_for_parameter_changes(self, ) -> Nonepublic void enableRebootForParameterChanges()public void EnableRebootForParameterChanges()func EnableRebootForParameterChanges()#
Enables automatic cluster rebooting when changes to the cluster's parameter group require a restart to apply.
fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster@staticmethod def from_cluster_attributes(scope: Construct, id: str, attrs: ClusterAttributes) -> IClusterpublic static ICluster fromClusterAttributes(Construct scope, String id, ClusterAttributes attrs)public static ICluster FromClusterAttributes(Construct scope, string id, ClusterAttributes attrs)func FromClusterAttributes(Scope Construct, Id *string, Attrs ClusterAttributes) IClusterstatic#
Import an existing DatabaseCluster from properties.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

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

  • xxxxX — Any object.

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

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.