Serverless Framework is great for deploying your Lambda functions. But deploying any other AWS resources requires you to write a lot of CloudFormation in YAML. CloudFormation templates are incredibly verbose and even creating simple resources can take hundreds of lines of YAML. AWS CDK solves this by allowing you to generate CloudFormation templates using modern programming languages. Making it truly, infrastructure as code.
However, there are some architectural differences between CDK and Serverless Framework that makes it tricky to use them together. For example, you’ll need to prefix your stack names and make sure that they are deployed to the same region and AWS account.
To fix this, we created Serverless Stack Toolkit (SST).
So you can deploy your Lambda functions using:
$ AWS_PROFILE=production serverless deploy --stage prod --region us-east-1
And use CDK for the rest of your AWS infrastructure:
$ AWS_PROFILE=production npx sst deploy --stage prod --region us-east-1
We’ve also created a completely new deployment infrastructure in Seed. Making it the fastest possible way to deploy your SST apps! This features:
- Build servers that start deployments instantly
- Deploying all your CloudFormation stacks concurrently
- And not wasting build minutes waiting for CloudFormation to update
This means that SST apps are deployed incredibly fast. And since you are not charged while waiting for CloudFormation to complete, deployments will be practically free!
As an example, a simple AWS CDK app with 7 stacks (a few DynamoDB tables, SNS topics, and SQS queues), deployed on CircleCI takes 417 seconds. While on Seed it takes 100 seconds. And subsequent deployments take 193 seconds on CircleCI vs. 40 seconds on Seed!
We’d like you to give SST a try and to send us your feedback.
- Fork the sample repo — github.com/serverless-stack/serverless-stack-resources-sample
- Add it to Seed
- Deploy it
Also, make sure to check out the docs and star the SST repo — github.com/serverless-stack/serverless-stack
SST deployments during the beta are free. So try it out and let us know what you think!