I really wanted to have my database in a separate...
# typescript
I really wanted to have my database in a separate stack but it seems that'll only cause issues
You can have your database in a separate stack. You probably want to have this stack modify the security rules of the security group declared by the database stack.
Copy code
  .all([appSecurityGroup.id, sharedDbSecurityGroupId])
  .apply(async ([appSecurityGroupId, sharedDbSecurityGroupId]) => {
    const sharedDbSecurityGroup = awsx.ec2.SecurityGroup.fromExistingId("shared-db-sg", sharedDbSecurityGroupId, {
      vpc: vpc.vpc,

        sourceSecurityGroupId: appSecurityGroupId,
      new awsx.ec2.TcpPorts(3306),
      `For ${appName}`,
If it makes sense to have the database in a separate stack, then it should be in a separate project. If a resource ( e.g. a security group rule) is strongly logically coupled to another resource (e.g. a database), then ideally it would be in the same project and stack. Note that a security group rule might not be strongly logically coupled to its security group, depending on your programs' architecture. A rule just need a security group ID, which does not always imply a logical coupling.