Skip to content
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

[aws-redshift] Single-node clusters fail with node count error #9856

Closed
Mejato opened this issue Aug 20, 2020 · 1 comment · Fixed by #9961
Closed

[aws-redshift] Single-node clusters fail with node count error #9856

Mejato opened this issue Aug 20, 2020 · 1 comment · Fixed by #9961
Assignees
Labels
@aws-cdk/aws-redshift Related to Amazon Redshift bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1

Comments

@Mejato
Copy link

Mejato commented Aug 20, 2020

Issue

Unable to deploy a single node Redshift cluster using the high level 'Cluster' construct.

Reproduction Steps


class RedshiftStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Define a VPC
        my_vpc = ec2.Vpc(self, id='my-vpc', cidr='10.0.0.0/16', enable_dns_hostnames=True, enable_dns_support=True)

        # Define a Redshift cluster
        my_redshift_cluster = redshift.Cluster(self, id='my-redshift-cluster', master_user=redshift.Login(master_username='username'), vpc=my_vpc, cluster_type=redshift.ClusterType.SINGLE_NODE)

What did you expect to happen?

A successful deployment of a basic 1 node Redshift cluster.

What actually happened?

Error with deployment.

8:09:58 PM | CREATE_FAILED | AWS::Redshift::Cluster | my-redshift-cluster
Number of nodes must be not be supplied for cluster type single-node. (Service: AmazonRedshift; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 57b21bf4-0b33-4b60-a6c1-4bdada5ed268)

Environment

  • CLI Version : aws-cdk@1.60.0
  • Framework Version: 1.60.0
  • Node.js Version: v12.18.3
  • OS : Ubuntu 20.04.1 LTS
  • Language (Version): Python 3.8.2

Suggestion

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clustertype

ClusterType

The type of the cluster. When cluster type is specified as

    single-node, the NumberOfNodes parameter is not required.

    multi-node, the NumberOfNodes parameter is required.

Valid Values: multi-node | single-node

Default: multi-node 

NumberOfNodes

The number of compute nodes in the cluster. This parameter is required when the ClusterType parameter is specified as multi-node.

For information about determining how many nodes you need, go to Working with Clusters in the Amazon Redshift Cluster Management Guide.

If you don't specify this parameter, you get a single-node cluster. When requesting a multi-node cluster, you must specify the number of nodes that you want in the cluster. 

This is 🐛 Bug Report

@Mejato Mejato added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 20, 2020
@SomayaB SomayaB changed the title [aws_redshift] [aws-redshift] Aug 20, 2020
@github-actions github-actions bot added the @aws-cdk/aws-redshift Related to Amazon Redshift label Aug 20, 2020
@njlynch njlynch added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 21, 2020
@njlynch
Copy link
Contributor

njlynch commented Aug 21, 2020

Thanks for the bug report, @Mejato.

It looks like we are explicitly setting the node count here to 1, rather than letting it remained undefined if the node type is single-node.

const nodeCount = props.numberOfNodes !== undefined ? props.numberOfNodes : (clusterType === ClusterType.MULTI_NODE ? 2 : 1);

The fix would be to only set the nodeCount explicitly for MULTI_NODE setups. Bonus would be to validate it's either unset or 1 if SINGLE_NODE, and unset it if set to 1.

@njlynch njlynch changed the title [aws-redshift] [aws-redshift] Single-node clusters fail with node count error Aug 21, 2020
njlynch added a commit that referenced this issue Aug 25, 2020
Single-node clusters defaulted to a `numberOfNodes` of 1; while this makes
sense, CloudFormation actually throws if any number of nodes is defined for a
single-node cluster. This change fixes this to default to `undefined` and
extends the validation for multi-node clusters.

fixes #9856
@njlynch njlynch added the in-progress This issue is being actively worked on. label Aug 25, 2020
@mergify mergify bot closed this as completed in #9961 Aug 27, 2020
mergify bot pushed a commit that referenced this issue Aug 27, 2020
Single-node clusters defaulted to a `numberOfNodes` of 1; while this makes
sense, CloudFormation actually throws if any number of nodes is defined for a
single-node cluster. This change fixes this to default to `undefined` and
extends the validation for multi-node clusters.

fixes #9856

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-redshift Related to Amazon Redshift bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants