aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.37k stars 3.77k forks source link

Multiple stacks: document resource sharing #4788

Open nmussy opened 4 years ago

nmussy commented 4 years ago

The current version of Create an App with Multiple Stacks in the Developer Guide does not document how to share resources across multiple stacks.

The CDK EC2 documentation has a pretty good example which could be used in the general dev guide: Sharing VPCs between stacks


This is a 📕 documentation issue

deleugpn commented 4 years ago

I'd go a step further and say the Sharing VPC documentation isn't enough. What I'd like to see documented is how to share resources across multiple apps from multiple repositories. My wish is to create one 'App' which is generic and contains generic infrastructure (Vpc, ALB, Route 53 Zone, Cognito Pool, IAM Roles, ECS Cluster, etc) and then several apps that "Import" those resources for use. For instance, I have about 45 ECS Services (independently deployable) running on the same Cluster using Fargate. About 25 of those services are web applications behind a single ALB. Each of them have their own DNS under the same Hosted Zone Id. They all authenticate using the same Cognito Pool. With plain CloudFormation, this was done using Export / Import most of the time and for a few exceptions, we used SSM Parameters. It would be nice to be able to have a similar workflow for CDK.

NGL321 commented 3 years ago

Hey @nmussy,

Going through old feature requests, I can confirm this is still on the to-do list.

😸 😷