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
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,
});
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
)
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();
// 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
});
// 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
new Cluster(scope: Construct, id: string, props: ClusterProps)
Cluster(scope: Construct, id: str, props: ClusterProps)
new Cluster(Construct scope, String id, ClusterProps props)
new Cluster(Construct scope, string id, ClusterProps props)
NewCluster(Scope Construct, Id *string, Props ClusterProps)
Construct Props
availabilityZoneRelocationbooleanavailability_zone_relocationboolavailabilityZoneRelocationBooleanAvailabilityZoneRelocationboolAvailabilityZoneRelocation*bool= false#classicResizingbooleanclassic_resizingboolclassicResizingBooleanClassicResizingboolClassicResizing*bool= Elastic resize type#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…#default
Default: A name is automatically generated.
clusterTypeClusterTypecluster_typeClusterTypeclusterTypeClusterTypeClusterTypeClusterTypeClusterTypeClusterType= `ClusterType.MULTI_NODE`#defaultDatabaseNamestringdefault_database_namestrdefaultDatabaseNameStringDefaultDatabaseNamestringDefaultDatabaseName*string= default_db#defaultRoleIRoledefault_roleIRoledefaultRoleIRoleDefaultRoleIRoleDefaultRoleIRole= No default role is specified for…#The default role must be included in the roles list.
default
Default: No default role is specified for the cluster.
encryptionKeyIKeyRefencryption_keyIKeyRefencryptionKeyIKeyRefEncryptionKeyIKeyRefEncryptionKeyIKeyRef= AWS-managed key, if encryption a…#default
Default: AWS-managed key, if encryption at rest is enabled
enhancedVpcRoutingbooleanenhanced_vpc_routingboolenhancedVpcRoutingBooleanEnhancedVpcRoutingboolEnhancedVpcRouting*bool= false#loggingClusterLoggingloggingClusterLoggingloggingClusterLoggingLoggingClusterLoggingLoggingClusterLogging= no logging#maintenanceTrackNameMaintenanceTrackNamemaintenance_track_nameMaintenanceTrackNamemaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackNameMaintenanceTrackName= undefined - Redshift default is …#default
Default: undefined - Redshift default is current
nodeTypeNodeTypenode_typeNodeTypenodeTypeNodeTypeNodeTypeNodeTypeNodeTypeNodeType= `NodeType.RA3_LARGE`#numberOfNodesnumbernumber_of_nodesint | floatnumberOfNodesNumberNumberOfNodesdoubleNumberOfNodes*float64= 2 if `clusterType` is ClusterTyp…#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.#default
Default: The default for the engine is used.
preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string= 30-minute window selected at ran…#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#rebootForParameterChangesbooleanreboot_for_parameter_changesboolrebootForParameterChangesBooleanRebootForParameterChangesboolRebootForParameterChanges*bool= false#removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.RETAIN#resourceActionResourceActionresource_actionResourceActionresourceActionResourceActionResourceActionResourceActionResourceActionResourceAction= no operation#rolesIRole[]rolestyping.List[IRole]rolesList<IRole>RolesIRole[]Roles*[]IRole= No role is attached to the clust…#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.#subnetGroupIClusterSubnetGroupsubnet_groupIClusterSubnetGroupsubnetGroupIClusterSubnetGroupSubnetGroupIClusterSubnetGroupSubnetGroupIClusterSubnetGroup= a new subnet group will be creat…#default
Default: a new subnet group will be created.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= private subnets#Properties
clusterEndpointEndpointcluster_endpointEndpointclusterEndpointEndpointClusterEndpointEndpointClusterEndpointEndpointrequired#connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#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.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#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)#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)#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#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#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)#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)#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)#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#enableRebootForParameterChanges(): voiddef enable_reboot_for_parameter_changes(self, ) -> Nonepublic void enableRebootForParameterChanges()public void EnableRebootForParameterChanges()func EnableRebootForParameterChanges()#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#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#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#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#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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.