TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: CDK vs. Terraform – which one do you prefer and why?

10 点作者 imheretolearn超过 1 年前
Pretty much the title

12 条评论

fwungy超过 1 年前
Depends.<p>Terraform can get ugly for a large codebase. You have a lot of power with an actual programming language instead of YAML. But CDK is more complicated and the learning curve is higher.<p>My preference would be Terraform for small-mid sized infra and CDK for larger installations where code abstraction and reuse was more important.<p>But they both disappoint in their own ways. Orchestration is the great unsolved problem of the cloud.
评论 #38272364 未加载
chrismeller超过 1 年前
I haven&#x27;t spent a ton of time in either lately, but I do lean heavily towards Terraform simply because it&#x27;s vendor agnostic.<p>I&#x27;m probably never going to end up switching completely between providers, but I like having the ability to mix and match services if I do need to.
simplesagar超过 1 年前
Definitely Terraform for me: - Vendor agnostic but you do have to write separate code per vendor - Better state management capabilities - Fastest growing dev community in IAC space (except for maybe Pulumi?) - I don&#x27;t know the current state of CDK but last year imports weren&#x27;t really supported so there was no way to reconcile state with existing hand rolled infra. Speaks to TF&#x27;s drift detection being a core capability.
评论 #38272757 未加载
xyzzy123超过 1 年前
Our team uses CDK or CFN for building aws &quot;platform level&quot; infra (ie is go to for infra roles who build &#x2F; maintain kube clusters or account level stuff), but terraform as the iac for devs who manage their own app-level resources eg rds, queues, hsms etc.<p>The rationale is that CDK&#x2F;CFN seems to work more reliably &quot;at scale&quot; for commonly used stacks due to low drama rollbacks etc. Roles that are primarily infra tend to not mind using aws focused tooling.<p>For devs, the documentation and usability of terraform is just better, plus the wide range of 3rd party integrations is handy. While it can be fiddly &#x2F; not as scalable it&#x27;s also a lot easier to adopt resources or refactor stuff which you tend to need more with &quot;precious&quot; long lived app resources.
mr_o47超过 1 年前
I would recommend using Terraform, It has much better support and the documentation.<p>CDK is great if you are only using AWS but Documentation sucks. I actually worked on CFN team and we interacted a lot with CDK Team.<p>It&#x27;s actually written in TypeScript and then constructs are converted to other languages using Projen
ActorNightly超过 1 年前
Depends on the project.<p>Terraform is for when you are doing large projects in company, and want to have additional management features that CDK doesn&#x27;t have.<p>On the flip side, for personal projects, you can get away with using boto3 library with the api it provides to create infrastructure, considering infrastructure probably won&#x27;t change much, and its free. You pretty much just have to write a little wrapper to create the resource if it doesn&#x27;t exist, then modify its attributes whether its just been created or if it already exists.<p>CDK, and pure cloudformation, and others are somewhere in between
JimmyAustin超过 1 年前
CDK for Terraform (<a href="https:&#x2F;&#x2F;developer.hashicorp.com&#x2F;terraform&#x2F;cdktf" rel="nofollow noreferrer">https:&#x2F;&#x2F;developer.hashicorp.com&#x2F;terraform&#x2F;cdktf</a>) is the best of both worlds. We&#x27;ve been using it at Replit with great success.
superdeeda超过 1 年前
Terraform, because the tooling around it is just much better for things like drift detection, showing planned changes, pipelines, etc.
mlhpdx超过 1 年前
Neither. SAM and vanilla CloudFormation are my choice. Don’t get in the way, less fussy and are easier to maintain in the long term.
verdverm超过 1 年前
Don&#x27;t use AWS, so CDK is not an option
joshSzep超过 1 年前
Using Terraform, but secretly admiring Pulumi (Python)
nikolay超过 1 年前
Pulumi.