Cross region references #36768
JonWallsten
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Cross region references is great in theory, but in practice it's not really useful due to one single fact. The ExportsWriter.
During the last 3 years I have rewritten the entire CDK app at least 3 times after multiple talks with experts on AWS (that we set up under the Enterprice licence). Now we have as few stacks as possbile, and we have group as many resources as possible in each stack to avoid cross-stack and cross-region references.
We use Cloudfront, and we're not int he US, so we are forced to use two different regions.
Certificate and WaF needs to be in the us-east-1 region.
With Lambda @ Edge you can use a "hack" and add it in the other region, and a stack will automatically be created for you in in us-east-1. That way you can keep Cloudfront and Lambda @ Edge, S3 buckets, API etc in the same stack in the same region. This solved a lot of issues for us.
But the cert for Cloudfront and the WaF needs to be deployed in the us-east-1 stack.
Once the cert is deployed and referenced in the other stack, you are screwed. You can never remove the cert, or change it. The hard reference in the ExportsWriter won't allow it. The only viable solution is to deploy the second stack exclusively and manually first, and then depoy the us-east-stack. But if you create a new cert in the us-east-1 stack, then it won't be exported until that stack is deployed. But you can't deploy that stack because you have changed the reference.
There was an issue about using weak references to fix this. But it was closed.
What is the plan for the cross-region references? Right now it really can't be used. I'm currently replacing it with the use of parameters since I'm so tried of not being able to update certain resoruces or remove stacks in a certain order. It's not worth it.
Which is a shame, because it's so brilliant. To just have references in the code instead of more complex usage with imports of parameters etc.
@pahud: Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions