class Cluster (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Redshift.Alpha.Cluster |
![]() | github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2#Cluster |
![]() | software.amazon.awscdk.services.redshift.alpha.Cluster |
![]() | aws_cdk.aws_redshift_alpha.Cluster |
![]() | @aws-cdk/aws-redshift-alpha ยป Cluster |
Implements
IConstruct
, IDependable
, IResource
, ICluster
, IConnectable
, ISecret
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,
});
Initializer
new Cluster(scope: Construct, id: string, props: ClusterProps)
Parameters
- scope
Construct
- id
string
- props
Cluster
Props
Construct Props
Name | Type | Description |
---|---|---|
master | Login | Username and password for the administrative user. |
vpc | IVpc | The VPC to place the cluster in. |
availability | boolean | Whether to enable relocation for an Amazon Redshift cluster between Availability Zones after the cluster is created. |
classic | boolean | If this flag is set, the cluster resizing type will be set to classic. |
cluster | string | An optional identifier for the cluster. |
cluster | Cluster | Settings for the individual instances that are launched. |
default | string | Name of a database which is automatically created inside the cluster. |
default | IRole | A single AWS Identity and Access Management (IAM) role to be used as the default role for the cluster. |
elastic | string | The Elastic IP (EIP) address for the cluster. |
encrypted? | boolean | Whether to enable encryption of data at rest in the cluster. |
encryption | IKey | The KMS key to use for encryption of data at rest. |
enhanced | boolean | 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 | Logging | Bucket details for log files to be sent to, including prefix. |
multi | boolean | Indicating whether Amazon Redshift should deploy the cluster in two Availability Zones. |
node | Node | The node type to be provisioned for the cluster. |
number | number | Number of compute nodes in the cluster. Only specify this property for multi-node clusters. |
parameter | ICluster | Additional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html. |
port? | number | What port to listen on. |
preferred | string | A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). |
publicly | boolean | Whether to make cluster publicly accessible. |
reboot | boolean | If this flag is set, the cluster will be rebooted when changes to the cluster's parameter group that require a restart to apply. |
removal | Removal | The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. |
resource | Resource | The Amazon Redshift operation to be performed. |
roles? | IRole [] | A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services. |
security | ISecurity [] | Security group. |
subnet | ICluster | A cluster subnet group to use with this cluster. |
vpc | Subnet | Where 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.
availabilityZoneRelocation?
Type:
boolean
(optional, default: false)
Whether to enable relocation for an Amazon Redshift cluster between Availability Zones after the cluster is created.
See also: https://docs.aws.amazon.com/redshift/latest/mgmt/managing-cluster-recovery.html
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.
clusterName?
Type:
string
(optional, default: A name is automatically generated.)
An optional identifier for the cluster.
clusterType?
Type:
Cluster
(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:
Logging
(optional, default: No logging bucket is used)
Bucket details for log files to be sent to, including prefix.
multiAz?
Type:
boolean
(optional, default: false)
Indicating whether Amazon Redshift should deploy the cluster in two Availability Zones.
nodeType?
Type:
Node
(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:
ICluster
(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'
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:
Removal
(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.
resourceAction?
Type:
Resource
(optional, default: no operation)
The Amazon Redshift operation to be performed.
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:
ISecurity
[]
(optional, default: a new security group is created.)
Security group.
subnetGroup?
Type:
ICluster
(optional, default: a new subnet group will be created.)
A cluster subnet group to use with this cluster.
vpcSubnets?
Type:
Subnet
(optional, default: private subnets)
Where to place the instances within the VPC.
Properties
Name | Type | Description |
---|---|---|
cluster | Endpoint | The endpoint to use for read/write operations. |
cluster | string | Identifier of the cluster. |
connections | Connections | Access to the network connections. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
parameter | ICluster | The cluster's parameter group. |
secret? | ISecret | The 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:
Resource
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:
ICluster
(optional)
The cluster's parameter group.
secret?
Type:
ISecret
(optional)
The secret attached to this cluster.
Methods
Name | Description |
---|---|
add | Adds default IAM role to cluster. |
add | Adds a role to the cluster. |
add | Adds the multi user rotation to this cluster. |
add | Adds the single user rotation of the master password to this cluster. |
add | Adds a parameter to the Clusters' parameter group. |
apply | Apply the given removal policy to this resource. |
as | Renders the secret attachment target specifications. |
enable | Enables automatic cluster rebooting when changes to the cluster's parameter group require a restart to apply. |
to | Returns a string representation of this construct. |
static from | 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
Rotation
Multi User Options
Returns
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
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
Removal
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
).
asSecretAttachmentTarget()
public asSecretAttachmentTarget(): SecretAttachmentTargetProps
Returns
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
Cluster
Attributes
Returns
Import an existing DatabaseCluster from properties.