-
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): execute resource action #31995
Changes from 6 commits
7986dcd
6896b65
7f8fbcb
d2840aa
726a01d
efc34e3
eecaac9
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 |
---|---|---|
|
@@ -80,6 +80,28 @@ export enum ClusterType { | |
MULTI_NODE = 'multi-node', | ||
} | ||
|
||
/** | ||
* The Amazon Redshift operation | ||
*/ | ||
export enum ResourceAction { | ||
/** | ||
* Pause the cluster | ||
*/ | ||
PAUSE_CLUSTER = 'pause-cluster', | ||
|
||
/** | ||
* Resume the cluster | ||
*/ | ||
RESUME_CLUSTER = 'resume-cluster', | ||
|
||
/** | ||
* Failing over to the other availability zone | ||
* | ||
* @see https://docs.aws.amazon.com/redshift/latest/mgmt/test-cluster-multi-az.html | ||
*/ | ||
FAILOVER_PRIMARY_COMPUTE = 'failover-primary-compute', | ||
} | ||
|
||
/** | ||
* Username and password combination | ||
*/ | ||
|
@@ -399,6 +421,13 @@ export interface ClusterProps { | |
* @default - false | ||
*/ | ||
readonly multiAz?: boolean; | ||
|
||
/** | ||
* The Amazon Redshift operation to be performed. | ||
* | ||
* @default - no operation | ||
*/ | ||
readonly resourceAction?: ResourceAction; | ||
} | ||
|
||
/** | ||
|
@@ -584,6 +613,10 @@ export class Cluster extends ClusterBase { | |
} | ||
} | ||
|
||
if (props.resourceAction === ResourceAction.FAILOVER_PRIMARY_COMPUTE && !props.multiAz) { | ||
throw new Error('ResourceAction.FAILOVER_PRIMARY_COMPUTE can only be used with multi-AZ clusters.'); | ||
} | ||
|
||
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 enable_user_activity_logging. |
||
// Basic | ||
allowVersionUpgrade: true, | ||
|
@@ -613,6 +646,7 @@ export class Cluster extends ClusterBase { | |
elasticIp: props.elasticIp, | ||
enhancedVpcRouting: props.enhancedVpcRouting, | ||
multiAz: props.multiAz, | ||
resourceAction: props.resourceAction, | ||
}); | ||
|
||
this.cluster.applyRemovalPolicy(removalPolicy, { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I tried to execute failover for the single AZ cluster but I got a deployment error.
Results:
I also confirmed we can execute failover operation for a multi-AZ cluster.