Serverless Framework vs. AWS CDK

in Serverless

Serverless Framework vs. AWS CDK

Serverless Framework and AWS CDK are infrastructure-as-code tools that complement one another. We’ve explained the differences between both tools in this article.

    Serverless Framework is the most popular and widely used tool for building serverless applications. However, since AWS introduced AWS CDK, it has gained ground among developers who build serverless applications, especially on AWS.

    What are the differences between these two tools?

    Will AWS CDK eventually replace Serverless Framework?

    These are some of the questions we will discuss in this article.

    What is Serverless Framework?

    Serverless Framework is an open-source infrastructure-as-code (IaC) tool and development framework that allows you to build and deploy serverless applications. It’s an easy-to-use framework that enables you to define your serverless application resources in a YAML file then deploy the application on multiple cloud providers. It takes the resource definition in a "serverless.yml" file then converts it to a template of the specified cloud provider.

    What is AWS Cloud Development Kit (CDK)?

    Amazon Web Service (AWS) CDK is an open source serverless application development framework that enables you to define cloud resources for your serverless applications using programming languages like TypeScript, Python, and Java then deploy it on AWS Lambda.

    What are the differences between Serverless Framework and AWS CDK?

    Even though both tools are easy to use and serve the same purposes, some notable differences set them apart.

    Cloud Agnosticism

    The main difference between AWS CDK and Serverless Framework is cloud agnosticism. Serverless Framework allows you to build and deploy serverless applications for all major cloud platforms, including AWS, Google Cloud Platform, and Microsoft Azure. On the other hand, CDK is a serverless IaC tool specific to Amazon Cloud Services alone.

    Think of this as Terraform or Pulumi vs. CloudFormation. While Terraform and Pulumi are used by developers and DevOps professionals to create and provision infrastructure for multiple cloud providers, CloudFormation does exactly the same but only for AWS.

    Resources Definition

    AWS CDK makes it easy to define multiple infrastructure resources like DynamoDB tables and multiple AIM roles. Serverless Framework only allows you to create a basic DynamoDB table in the serverless.yml file, to manage advanced aspects of DynamoDb like autoscaling or creating a global table, you need to configure it directly from the CloudFormation template or integrate an external plugin.

    Also, Serverless Framework creates a CloudWatch Logs group to track the logs of the deployed serverless function in its CloudFormation template. To invoke the logs of a serverless function deployed using AWS CDK, you need to use another tool like AAWS SAM or AWS CLI.


    Both Serverless Framework and AWS CDK support extensions with plugins, but Serverless Framework has an advantage in this case. Serverless Framework has been in use for years, and it has a vast library of plugins that can help you perform any extended functionality you need.


    Rather than uploading the CloudFormation template in an accessible S3 bucket like Serverless Framework does, AWS CDK uses CDK metadata which does not give you access to configure, thereby making it safer from possible threats that may occur through tampering with the configuration.

    Use of Programming Language

    AWS CDK takes a programmatic approach to define cloud resource provisioning for AWS serverless functions. It allows you to use popular programming languages like JavaScript, TypeScript, Python, Java, C#, and .NET to define the resources needed for your serverless application.

    Better Documentation

    Serverless Framework is a matured and well-used tool compared to AWS CDK that was introduced barely a few years ago; therefore it has a clearer, well-explained documentation of various aspects of the tool.

    For example; Serverless Framework comes with a sample of how you can add an AWS Lambda function to the serverless.yml file, while AWS CDK does not include such examples, leaving you to figure it out by checking up the documentation.

    Local Testing

    Serverless offers a great experience for local development, including testing your serverless application locally. AWS CDK does not offer this feature unless integrated with AWS SAM CLI.


    Features provided by AWS CDK make it an ideal framework to use in building and deploying complicated serverless functions with additional services. At the same time, Serverless Framework is excellent for use in deploying small to medium serverless projects.

    Deployment Speed

    AWS CDK deploys your CloudFormation template in sequential order; it waits for one template to be complete before it deploys another. In contrast, Serverless Framework deploys CloudFormation templates concurrently, making the deployment process faster.

    Will AWS CDK replace Serverless Framework?

    Considering that AWS CDK can only be used on AWS while Serverless Framework can be used on multiple cloud platforms, we can agree that CDK will not replace Serverless Framework.

    Both Serverless Framework and AWS CDK are excellent tools for deploying serverless functions, and it really depends on your preference to determine which one to use. Because CDK is a tool developed by AWS itself, with the fact that it gives you the flexibility to use a programming language to define your application resources, you might want to consider using CDK for your AWS Lambda projects. However, Serverless Framework has a great reputation for various use cases.

    Taking a good look at the differences we highlighted earlier, you will observe that each tool has a better advantage in areas where the other lags, so you need to consider choosing what tool is right for you.

    Get similar stories in your inbox weekly, for free

    Share this story with your friends
    The Chief I/O

    The team behind this website. We help IT leaders, decision-makers and IT professionals understand topics like Distributed Computing, AIOps & Cloud Native

    Latest stories

    DevOps: Report on Devil's Practices by DORA

    The report is drafted from a report release of the annual research and survey of …

    Amazon Elasticsearch Gets a New Version With Name Deprecated

    Accompanied by new advancements is Amazon OpenSearch, the same body of code as its predecessor, …

    McAfee Partners With IBM Security to Deliver TD Synnex Security Solution

    The MVISION platform and Security wing of IBM's partnership endgame are to extend increased protection …

    Amazon MSK Connect Launched to Better Apache Kafka UX

    Amazon follows up on its 2018 data streaming software, Amazon Managed Streaming for Apache Kafka, …

    Cloud: Zone Redundant Storage Released on General Availability

    The report is drafted from a press release of the Microsoft Azure team on the …

    Security: IBM Traces Two-Thirds of Compromises to Misconfigured APIs

    The report is drafted from a sweeping survey of dark web analysis and various X-Force …