Reputation: 267
I'm using python CDK to create a Postgres DB and all is fine.
I'm using
newdatabase = rds.DatabaseCluster(
)
Unfortunately, I couldn't find a way to attach an existing security group to this cluster. Anyone know how I could do it with Python?
Upvotes: 0
Views: 1524
Reputation: 105
Did you try calling the existing security group as shown below and then using the variable in the array. It worked for me.
security_group = _ec2.SecurityGroup.from_security_group_id(self, "imported-sg",security_group_id="sg-xxxxxxxx")
mydb= _rds.DatabaseInstance(self,
"mysql-rds",
security_groups=[security_group]
)
Upvotes: 0
Reputation: 238081
You set it using DatabaseClusterAttributes. Specifically using:
security_groups - The security groups of the database cluster. Default: - no security groups
Upvotes: 0