Do people create aws-cdk libs/modules and share th...
# random
s
Do people create aws-cdk libs/modules and share them between projects? If so, how?
t
I do. Nothing special just a normal library
s
What do you do to support multiple cdk versions
a
@Simon Reilly what kind of things do you share?
t
You can specify a peer dependency for cdk libraries
That allows flexibility for the version people are using instead of bundling it
s
@thdxr nice, this is what I was thinking šŸ‘
@AdriĆ”n Mouly working on a set of common utils: • Cognito configured for multi-tenancy • Custom resource to forward secrets to Vercel supporting preview environments Want to move fast with new SaaS projects, and not get bogged down in the boiler plate
a
Nice.
Do you have multiple repos?
I’m using mono-repo, but might need to separate it.
s
I want to create one mono-repo for my utils, that I can pull in to any project
So my projects would be separate repos
a
I see.
And how you planning on sharing resources?
I mean.
Like references.
Not the implementation.
s
Bit confused by the question. I am planning to just have one node module I can run yarn add in my new projects and not need to reimplement my utils
t
@Simon Reilly I did the same thing lol, I have some shared resources across projects
a
@Simon Reilly sorry, what I mean is… for example if you create an API, and want to share that ā€œrootā€ with other APIs that can extend it… how you do it? or if you have a Website and want to reference an API created on other project.
s
@AdriƔn Mouly I think there are many ways to solve that problem. Cfn import/export. Static lookup methods (see aws-cdk/aws-ec2 Vpc construct). Personally I would be looking for isolation, so not a problem for me atm
a
Ok, yes, lookup is what I do for VPC.
b
I used to, and I stopped when I moved to sst. It was a normal npm module. as much as I liked writing my own general purpose constructs, I now rarely find myself writing something generic enough that the sst team hasn't implemented it yet. when I will find such a use case, I'd love to contribute to the project. and also, if it's for compliance reasons, this has a few words about that: https://aws.amazon.com/blogs/devops/best-practices-for-developing-cloud-applications-with-aws-cdk/