[Redshift] security group creation failed
In order to enable connectivity to Redshift cluster in a private subnet I am creating a bastion host with own security group. Redshift cluster is created in a VPC in private subnet. To enable the connectivity between the bastion host and Redshift cluster I am trying to create aws_redshift.CfnClusterSecurityGroup. It always failed with an error message.
Reproduction Steps
- Create VPC
- Create bastion SG and the host
- Create Redshift security group
self.vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="10.10.0.0/16",
# configuration will create 3 groups in 2 AZs = 6 subnets.
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
cidr_mask=24
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PRIVATE,
name="Private",
cidr_mask=24
)
]
)
_bastion_sg = ec2.SecurityGroup(self, id="bastion-sg", vpc=self.vpc, allow_all_outbound=None,
description=None, security_group_name="bastion-sg")
ec2.BastionHostLinux(self,
id="Bastion-Redshift",
vpc=self.vpc,
availability_zone=None,
block_devices=None,
instance_name="Bastion_Host",
instance_type=None,
machine_image=None,
security_group=_bastion_sg,
subnet_selection=None)
self.redshift_sg = redshift.CfnClusterSecurityGroup(self, id="redshift_sg",
description="Redshift Security group", tags=None)
What did you expect to happen?
The idea is to create Redshift cluster in a VPC, in a private subnet in own security group having ingress rules to enable connectivity from the bastion host.
What actually happened?
cdk deploy always failed on the CfnClusterSecurityGroup even without Redshift cluster creation further command.
9:57:40 AM | CREATE_FAILED | AWS::Redshift::ClusterSecurityGroup | redshift_sg
VPC-by-Default customers cannot use cluster security groups (Service: AmazonRedshift; Status Code: 400; Error Code: InvalidParameterValue; Request ID: xxxxx)
Environment
- CLI Version : 1.16.240
- Framework Version: 1.57.0 (build 2ccfc50)
- Node.js Version: v12.16.3
- OS : MacOS
- Language (Version): Python 3.6.8
Other
Maybe I am missing some parts, if yes, it would be great to have a working example. I found the discussion about the same issue in AWS forum, unfortunately it is hard to relate it to my use case.
This is :bug: Bug Report
After switching to L2 api of Redshift everything is working as expected. Please close this issue, thanks!