CDK vs CloudFormation

Published: Friday, Feb 5, 2021 Last modified: Monday, Jun 14, 2021

I am sold on terraform for my AWS deployments. It shits all over cloudformation in many ways.

— Matt Gillard (@mattgillard) March 9, 2021

Kai Hendry Today at 8:49 PM Is there a good comparison between using either Cloudformation or Terraform for a project? i.e. what can Cloudformation do that Terraform can’t? 17 replies Philipp Garbe 15 hours ago this is a good one: https://cloudonaut.io/cloudformation-vs-terraform/ cloudonautcloudonaut CloudFormation vs. Terraform The most reliable way to automate creating, updating, and deleting your cloud resources is to describe the target state of yo… Philipp Garbe 15 hours ago and I’ve to say: why not CDK? :slightly_smiling_face: :100: 1

Ewan Leith 15 hours ago It feels like there should be a great “go to” place for this, but I can’t see one. Terraform can do everything cloudformation can, and more, it’s faster to adopt new features, has a nicer language, etc. But on the other side, Cloudformation has lots of support from AWS Ewan Leith 15 hours ago I agree with Philipp, if you’re starting from scratch your choice should likely be between the CDK and Terraform, not Cloudformation and Terraform :+1::skin-tone-3: 1

Kai Hendry 14 hours ago CDK is not declarative which puts me right off Mads Toftum:speech_balloon: 14 hours ago if you find something useful in cdk, then you can have it spit out a cloudformation template Philipp Garbe 14 hours ago For me that’s the advantage that CDK is not declarative. At some point you’ll find yourself in a situation where you have to repeat yourself, copy&paste things, apply changes in multiple repos. That’s where CDK can help you. Mads Toftum:speech_balloon: 14 hours ago I’m not sure about the current state of the terraform docs, but in the past and for other hashicorp bits I’ve used it seems you’re often stuck reading github issues and commit messages to find documentation. Philipp Garbe 14 hours ago regarding number of supported resources: https://twitter.com/iann0036/status/1347381025723203585 Ben Bridts 14 hours ago I disagree strongly with “CDK is better than CloudFormation in every situation'. One of the advantages of CFN is that it’s completely managed by AWS. If we’re going to make broad statements, I’d argue that that makes cloudformation the more serverless/cloud-native solution :100: 3

Mads Toftum:speech_balloon: 14 hours ago I’ve yet to be convinced by cdk except as a shortcut to get an example cloudformation template Ben Bridts 14 hours ago re: number of resources, that’s mostly not as big of an issue as it would appear. of supported resources is less important than “does it support the resources I want to use” New services are more frequently releasing with CFN support from day one Both terraform and CFN can be extended with your custom resource provider (terraform front-loads that work by having you setup an environment to run terraform in as the first step; which makes it sometimes a bit easier to get started with development. oth all you need for non-custom CloudFormation is an editor) (edited) Thorsten Hoeger 14 hours ago About declarative vs imperative: The IaC part of CDK is still declarative as it is CFN. Only the way to generate the template is imperative. But all the benefits of declarative infra definition still hold Ben Bridts 14 hours ago You lose the benefits of using a declarative DSL. You can argue about how important that is, but splitting up the generation from deployment is an implementation detail, not the direction that CDK encourages you to take (edited) Steven John Cuthill 12 hours ago We looked at CDK but the learning curve for a the team was steep for it to basically do the same thing as CFN yaml, so we did not move forward with it. Would be nice if CFN vastly improved its syntax support and maybe support for important the code for 3rd party Modules in TF format as there is already a huge library. And a way to public the custom resource to all accounts in the AWS organisation. Noel Martin Llevares:flag-au: 9 hours ago It’s now infrastructure-as-declarative-code vs infrastructure-as-imperative-code. :smile:

Philipp Garbe 9 hours ago At least it’s as-code :smile: