class Cluster (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Redshift.Cluster |
Java | software.amazon.awscdk.services.redshift.Cluster |
Python | aws_cdk.aws_redshift.Cluster |
TypeScript (source) | @aws-cdk/aws-redshift ยป Cluster |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, ICluster
, IConnectable
, ISecret
Create a Redshift cluster a given number of nodes.
Example
import * as ec2 from '@aws-cdk/aws-ec2';
const vpc = new ec2.Vpc(this, 'Vpc');
const cluster = new Cluster(this, 'Redshift', {
masterUser: {
masterUsername: 'admin',
},
vpc
});
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. |
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. |
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. |
logging | IBucket | Bucket to send logs to. |
logging | string | Prefix used for logging. |
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. |
removal | Removal | The 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. |
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.
clusterName?
Type:
string
(optional, default: A name is automatically generated.)
An optional identifier for the cluster.
clusterType?
Type:
Cluster
(optional, default: {@link 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.
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.
loggingBucket?
Type:
IBucket
(optional, default: No Logs)
Bucket to send logs to.
Logging information includes queries and connection attempts, for the specified Amazon Redshift cluster.
loggingKeyPrefix?
Type:
string
(optional, default: no prefix)
Prefix used for logging.
nodeType?
Type:
Node
(optional, default: {@link 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.
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.
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.
Specify a maximum of 10 roles.
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 | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
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:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
secret?
Type:
ISecret
(optional)
The secret attached to this cluster.
Methods
Name | Description |
---|---|
add | Adds the multi user rotation to this cluster. |
add | Adds the single user rotation of the master password to this cluster. |
apply | Apply the given removal policy to this resource. |
as | Renders the secret attachment target specifications. |
to | Returns a string representation of this construct. |
static from | Import an existing DatabaseCluster from properties. |
RotationMultiUser(id, options)
addpublic addRotationMultiUser(id: string, options: RotationMultiUserOptions): SecretRotation
Parameters
- id
string
- options
Rotation
Multi User Options
Returns
Adds the multi user rotation to this cluster.
RotationSingleUser(automaticallyAfter?)
addpublic 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.
RemovalPolicy(policy)
applypublic 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
).
SecretAttachmentTarget()
aspublic asSecretAttachmentTarget(): SecretAttachmentTargetProps
Returns
Renders the secret attachment target specifications.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ClusterAttributes(scope, id, attrs)
static frompublic static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster
Parameters
- scope
Construct
- id
string
- attrs
Cluster
Attributes
Returns
Import an existing DatabaseCluster from properties.