My first serverless application was written in a Python language using the Chalice framework. This blog backend is based on this configuration.
It was a pleasant development experience. Chalice supports live reload, debugging, and local testing. It calculates IAM permissions from the source code and provisions required resources.
I combined a Cloudformation template that Chalice outputs with the CDK framework. On the front side, I’ve added a Nuxt framework and the blog was ready.
I didn’t have a lot of Python experience when I started. My initial plan was to test Chalice first and then move to the Zappa framework. I never had a chance to do that.
Sample applications on this blog and an authentication module took me around 100 hours of work.
Then I’ve moved to other topics.
A few weeks ago I was playing around with AWS Toolkit for Intellij Idea
https://aws.amazon.com/intellij/It offers nice integration with Serverless Application Model (SAM). I've implemented a test application using Typescript language. For tests, I added
aws-sdk-mock
Node library. It allows mocking AWS services in unit tests. With SAM I can run lambda locally and remotely. Debug is supported and works nicely with Intellij Idea debugger.
Integrated AWS Toolkit for CloudWatch logs and lambda triggers works very well in the IDE. I like the way how the plugin groups the log streams and how the interface handle viewing them. I miss the tailing of the live log but in general, all features improve lambda development experience.
What I don’t like is the delay between the code change and lambda reload. It takes too long to see your changes. And you have to ensure proper permissions are assigned to the lambda. Otherwise, you can have working lambda code locally and receiving access denied remotely. But the biggest issue is the code reload speed.
I think this is quite ok as an additional module for i.e. Java Fargate application. In such setup, you may need some lambda code to react to AWS events. In this scenario, I would go with SAM. But for implementing API with API Gateway + Lambda + DynamoDB I think SST is better.
I found it while searching serverless frameworks on Github and sorting by popularity. This is a solid piece of code I have to say. I didn’t have time to do a bigger project with the SST framework yet. What I see as a beginner is mind-blowing.
Documentation is short and filled with examples. The official website works fast and delivers a pleasant experience. A big plus is a tutorial for a severless framework that covers multiple interesting topics.
SST internally wraps a CDK library. Additionally, it includes some higher-level CDK constructs that are part of the framework. This natural combination works fast and without errors so far for me. I can easily provision my infrastructure and lambda based API. All in the same codebase and programming language of choice.
What is the most exciting is live code reload. And this is a live reload on the AWS side. We are not talking here about local development. This allows you to code lambda as you would edit code under AWS Console lambda editor. But without the need to press the ‘Deploy’ button. Additionally, this tool detects infrastructure changes and prompts you to accept them for deployment. Nice. SST is a framework of the year for me.
Ok, so I’ve decided to create a sample template project. It is a typescript project that includes
This is a stack that I use for quick prototyping. API access requires authentication. UI components for sign up and signing are taken from th Amplify web component library.
This is a very limited example but it presents a few ideas described before. You can deploy this with few commands to your AWS account and start coding directly on the AWS side with hot reload enabled.
Please refer to the official SST framework website for more details.
Links:
https://serverless-stack.com/ https://aws.amazon.com/serverless/sam/ https://aws.amazon.com/intellij/ https://github.com/aws/chalice https://github.com/Miserlou/Zappa https://github.com/dwyl/aws-sdk-mock