# AWS CDK vs Serverless Framework for lambda?

**URL:** <https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673>\
**Category:** Serverless Framework\
**Created:** [September 3, 2018, 2:27pm UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673 "2018-09-03T14:27:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommedema](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tommedema/32/1257_2.png) [@tommedema](https://forum.serverless.com/u/tommedema)\
**Post date:** [September 3, 2018, 2:27pm UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673/1 "2018-09-03T14:27:31Z")

</div>

Read more about AWS CDK here: [https://awslabs.github.io/aws-cdk/](https://awslabs.github.io/aws-cdk/)

It has some obvious advantages over the serverless framework, most notably that you can write your stack in code. E.g. you can programmatically define that a certain stack should be deployed prior to another one, and you can easily pass references from one to another, which is much easier than relying on hardcoded cross-stack references and then remember whether that updated version of a referenced stack is already deployed or not.

Does anyone have experience with AWS CDK? Do you think it can replace this framework, or if this framework can rely on it or learn from it?

---

<div class="post-metadata">

**Author:** ![moravcik](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/moravcik/32/2800_2.png) [@moravcik](https://forum.serverless.com/u/moravcik)\
**Post date:** [December 6, 2018, 6:32pm UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673/2 "2018-12-06T18:32:03Z")

</div>

I have posted feature request to integrate with AWS CDK:

> <https://github.com/serverless/serverless/issues/5573>
>
> \<!--
> 1. If you have a question and not a feature request please ask first at ht…tp://forum.serverless.com
> 2. Please check if an issue already exists. This feature may have already been requested
> 3. Check out and follow our Guidelines: https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md
> 4. Fill out the whole template so we have a good overview on the issue
> 5. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
> 6. Please follow the template, otherwise we'll have to ask you to update it
> \--\>
> 
> \# This is a Feature Proposal
> 
> \## Description
> 
> Are there any plans to support or integrate into AWS CDK (Cloud Development Kit)?
> https://awslabs.github.io/aws-cdk/
> 
> \*\*AWS CDK\*\* can nicely handle CloudFormation Stack creation and updates using TypeScript, but lacks packaging lambda functions for deployment. For deploying lambda the AWS CDK supports only inline code, S3 archive and local directory. 
> 
> \*\*Serverless\*\* is managing its own CloudFormation stack with custom resources, and handles packaging of lambda nicely with plugins. 
> 
> How about to integrate these two tools?
> 
> There is one similar question on forum (yet unanswered):
> https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673

---

<div class="post-metadata">

**Author:** ![awhillas](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/awhillas/32/2123_2.png) [@awhillas](https://forum.serverless.com/u/awhillas)\
**Post date:** [June 14, 2019, 5:37am UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673/3 "2019-06-14T05:37:03Z")

</div>

Yes, just started using it and its a breath of fresh air! If you do anything other than Lambda functions on AWS its so much easier as you just define what you want and it creates all the IAM roles with minimal access permissions. And yes, you can script it so if you have a generic lambda that you call differently, i.e. different environmental vars say, you can loop over an array which contains the differences. You don’t have to write _any_ cloudformation template stuff anymore or dick around with references, its all setup for you, you just have to link the services.  
The only draw back is that there is vendor lock in, but it i expect a framework to emerge that abstracts the provider out and does this generically… i mean they pretty much all offer the same stuff.

---

<div class="post-metadata">

**Author:** ![fanjie](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/fanjie/32/3593_2.png) [@fanjie](https://forum.serverless.com/u/fanjie)\
**Post date:** [September 4, 2020, 7:05am UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673/4 "2020-09-04T07:05:08Z")

</div>

We actually put something together recently at Serverless Stack to helping using Serverless Framework and AWS CDK together. Serverless’s strength is working with Lambda and API Gateway. So a good pattern here is to use CDK for the rest of your infrastructure, and Serverless for your Lambda functions.

So we created a tool to do exactly this - Serverless Stack Toolkit (SST), which allows you to combine CDK and Serverless Framework - [https://github.com/serverless-stack/serverless-stack](https://github.com/serverless-stack/serverless-stack)

You can deploy your Serverless service and CDK service like `sls deploy --stage dev` and `sst deploy --stage dev`.

---

<div class="post-metadata">

**Author:** ![raghusujju](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/raghusujju/32/5249_2.png) [@raghusujju](https://forum.serverless.com/u/raghusujju)\
**Post date:** [February 15, 2021, 9:49pm UTC](https://forum.serverless.com/t/aws-cdk-vs-serverless-framework-for-lambda/5673/5 "2021-02-15T21:49:33Z")

</div>

Serverless makes it easier to deploy lambdas and other services around lambda ( apigateway, cognito etc etc) . It has few bugs here and there but all in all its very good framework to deploy lambdas. Atleast i found that it takes out lot of burden from developer. This is more of config over coding and i like it.

I used CDK for common infrastructure that’s created only once eg. ApiGateway, RDS, SQS queues, Route53 etc. I was used to writing this as bare cloudformation templates and cdk made it much easier for me.
