Skip to content

Commit

Permalink
Update network_construct.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasDobsonDunavant committed Feb 5, 2025
1 parent a5d9608 commit cfcfe46
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/custom_constructs/network_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ def create_security_groups(self):
allow_all_outbound=True
)

# RDS Security Group
rds_name = f"outlier-rds-{self.environment}-sg-test"
self.rds_sg = ec2.SecurityGroup(
# Import existing RDS Security Group
self.rds_sg = ec2.SecurityGroup.from_security_group_id(
self,
"RdsSecurityGroup",
vpc=self.vpc,
security_group_name=rds_name,
description=f"Security group for outlier {self.environment} RDS instance",
"ExistingRdsSecurityGroup",
"sg-05fcdaf33c1d2a016", # The actual RDS security group ID from AWS
allow_all_outbound=True
)

Expand Down Expand Up @@ -90,6 +87,14 @@ def create_security_groups(self):
description="Allow inbound from ALB"
)

# In NetworkConstruct's create_security_groups method
self.rds_sg = ec2.SecurityGroup.from_security_group_id(
self,
"ExistingRdsSecurityGroup",
"sg-05fcdaf33c1d2a016", # Use the existing RDS security group ID
allow_all_outbound=True
)

# RDS rules
self.rds_sg.add_ingress_rule(
peer=ec2.Peer.security_group_id(self.service_sg.security_group_id),
Expand Down

0 comments on commit cfcfe46

Please sign in to comment.