- Newest
- Most votes
- Most comments
If anything, CDK is making CloudFormation even more so required: CDK generates the templates that are then used to deploy your resources in AWS via CloudFormation, not instead of using CloudFormation.
Now, is it always worth using it ? I do not think so at all. CDK fits some needs, but why spend the time and effort into writing a script in CDK that should really just be a simpler template?
Plus, again that's just my opinion, using CDK also takes away some of the key functionalities that make CFN so great. You might end up feeling like you have to "hardcode" values into your templates, which could just have been a parameter, a mapping, or have in code conditions that will only work for a narrow case but a CFN Conditon would have done just fine.
Seen plenty of CDK generated stuff where the template becomes un-reusable in different accounts, regions, partitions and so on. And that's a damn shame considering that CFN is here to allow taking one template, and it will work, anywhere in AWS.
I much prefer Troposphere to CDK too. At least in Python. Troposphere in version 4+ generates his code from the AWS CloudFormation specifications, and the property names are a 1:1 match to the documentation, whereas in CDK so many resources have their properties renamed.
As for CDK doing lookup of existing resources, nothing you could not do with the APIs anyways, and again, often, that's a hardcode.
It depends on your preference. If you are comfortable writing Infrastructure as Code in YAML (or JSON), then you should use Cloudformation.
If you are comfortable writing code in a programming language like Java, Python, Javascript, Go etc. then CDK is the tool you may want to use. You should take a look at the CDK FAQs to better understand all the capabilities that CDK offers - https://aws.amazon.com/cdk/faqs
If my answer resolves your question, please upvote and accept my answer. Thanks
Relevant content
- asked 3 days ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
Good answer! In my opinion, Terraform and CloudFormation are most easy and beautiful!!!