Skip to content
Discussion options

You must be logged in to vote

In the end this is how I solved it:

In the RDS/Database stack I added a new security group:

db = aws_rds.ServerlessCluster(
  # options
)
public_audit_log_sg = aws_ec2.SecurityGroup
  scope=stack,
  id="public-audit-log-sg",
  vpc=vpc,
  allow_all_outbound=True,
  description="Public audit log security group",
  security_group_name="public-audit-log-sg",
)

Then in your other stack

const vpc = aws_ec2.Vpc.fromLookup(this, "imported-vpc", { vpcId: "vpcIdHere" });
const sg = aws_ec2.SecurityGroup.fromLookupByName(this, "imported-sg", "public-audit-log-sg", vpc);
const helloFunction = new NodejsFunction(this, "function", {
  securityGroups: [sg]
})

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Lilja
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant