class ClusterSubnetGroup (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Redshift.ClusterSubnetGroup |
Java | software.amazon.awscdk.services.redshift.ClusterSubnetGroup |
Python | aws_cdk.aws_redshift.ClusterSubnetGroup |
TypeScript (source) | @aws-cdk/aws-redshift » ClusterSubnetGroup |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, ICluster
Class for creating a Redshift cluster subnet group.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as ec2 from '@aws-cdk/aws-ec2';
import * as redshift from '@aws-cdk/aws-redshift';
import * as cdk from '@aws-cdk/core';
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const clusterSubnetGroup = new redshift.ClusterSubnetGroup(this, 'MyClusterSubnetGroup', {
description: 'description',
vpc: vpc,
// the properties below are optional
removalPolicy: cdk.RemovalPolicy.DESTROY,
vpcSubnets: {
availabilityZones: ['availabilityZones'],
onePerAz: false,
subnetFilters: [subnetFilter],
subnetGroupName: 'subnetGroupName',
subnetName: 'subnetName',
subnets: [subnet],
subnetType: ec2.SubnetType.ISOLATED,
},
});
Initializer
new ClusterSubnetGroup(scope: Construct, id: string, props: ClusterSubnetGroupProps)
Parameters
- scope
Construct
- id
string
- props
Cluster
Subnet Group Props
Construct Props
Name | Type | Description |
---|---|---|
description | string | Description of the subnet group. |
vpc | IVpc | The VPC to place the subnet group in. |
removal | Removal | The removal policy to apply when the subnet group are removed from the stack or replaced during an update. |
vpc | Subnet | Which subnets within the VPC to associate with this group. |
description
Type:
string
Description of the subnet group.
vpc
Type:
IVpc
The VPC to place the subnet group in.
removalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.RETAIN)
The removal policy to apply when the subnet group are removed from the stack or replaced during an update.
vpcSubnets?
Type:
Subnet
(optional, default: private subnets)
Which subnets within the VPC to associate with this group.
Properties
Name | Type | Description |
---|---|---|
cluster | string | The name of the cluster subnet group. |
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. |
clusterSubnetGroupName
Type:
string
The name of the cluster subnet group.
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.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Imports an existing subnet group by name. |
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ClusterSubnetGroupName(scope, id, clusterSubnetGroupName)
static frompublic static fromClusterSubnetGroupName(scope: Construct, id: string, clusterSubnetGroupName: string): IClusterSubnetGroup
Parameters
- scope
Construct
- id
string
- clusterSubnetGroupName
string
Returns
Imports an existing subnet group by name.