-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(redshift): relocating a cluster #31993
Changes from 3 commits
ece730e
8bdb7fc
2d8359e
dd6a2a9
7ba3988
5602dfe
17ee5b3
cd51648
8ed6b6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,6 +399,15 @@ export interface ClusterProps { | |
* @default - false | ||
*/ | ||
readonly multiAz?: boolean; | ||
|
||
/** | ||
* Whether to enable relocation for an Amazon Redshift cluster between Availability Zones after the cluster is created. | ||
* | ||
* @see https://docs.aws.amazon.com/redshift/latest/mgmt/managing-cluster-recovery.html | ||
* | ||
* @default - false | ||
*/ | ||
readonly availabilityZoneRelocation?: boolean; | ||
} | ||
|
||
/** | ||
|
@@ -584,6 +593,10 @@ export class Cluster extends ClusterBase { | |
} | ||
} | ||
|
||
if (props.availabilityZoneRelocation && !nodeType.startsWith('ra3')) { | ||
throw new Error(`Availability zone relocation is supported for only RA3 node types, got: ${props.nodeType}`); | ||
} | ||
|
||
this.cluster = new CfnCluster(this, 'Resource', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji. Ensure that user activity logging is enabled for the Redshift cluster. This feature logs each query before it is executed on the cluster's database. To activate this, associate a Redshift Cluster Parameter Group with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this feedback is inappropriate. This implementation is for existing L2 code, and to avoid breaking changes, we should not forcefully enable |
||
// Basic | ||
allowVersionUpgrade: true, | ||
|
@@ -613,6 +626,7 @@ export class Cluster extends ClusterBase { | |
elasticIp: props.elasticIp, | ||
enhancedVpcRouting: props.enhancedVpcRouting, | ||
multiAz: props.multiAz, | ||
availabilityZoneRelocation: props.availabilityZoneRelocation, | ||
}); | ||
|
||
this.cluster.applyRemovalPolicy(removalPolicy, { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as ec2 from 'aws-cdk-lib/aws-ec2'; | ||
import * as cdk from 'aws-cdk-lib'; | ||
import * as integ from '@aws-cdk/integ-tests-alpha'; | ||
import * as constructs from 'constructs'; | ||
import * as redshift from '../lib'; | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'AzRelocationClusterStack'); | ||
|
||
cdk.Aspects.of(stack).add({ | ||
visit(node: constructs.IConstruct) { | ||
if (cdk.CfnResource.isCfnResource(node)) { | ||
node.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY); | ||
} | ||
}, | ||
}); | ||
|
||
const vpc = new ec2.Vpc(stack, 'Vpc', { | ||
restrictDefaultSecurityGroup: false, | ||
natGateways: 0, | ||
}); | ||
new redshift.Cluster(stack, 'Cluster', { | ||
vpc: vpc, | ||
vpcSubnets: { | ||
subnetType: ec2.SubnetType.PUBLIC, | ||
}, | ||
masterUser: { | ||
masterUsername: 'admin', | ||
}, | ||
publiclyAccessible: true, | ||
availabilityZoneRelocation: true, | ||
nodeType: redshift.NodeType.DC1_LARGE, | ||
}); | ||
|
||
new integ.IntegTest(app, 'AzRelocationClusterStackInteg', { | ||
testCases: [stack], | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, relocation cannot be enabled after a cluster has been created?
It appears from the current README that relocation cannot be enabled after a cluster is created, but the documentation suggests that it should be possible to enable it post-creation.
https://docs.aws.amazon.com/redshift/latest/mgmt/managing-cluster-recovery.html#cluster-recovery-console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right. I've updated description.