AWS Serverless Developer Journey
Journey of a Serverless Developer
Let's assume you're a developer who wants to use Lambda in production.
When first experimenting with Lambda, you'll use the AWS Management Console to develop and deploy.
It makes it easy to develop with Lambda, but it is not suitable for production.
It's like altering files on your production servers.
Local Testing
It is recommended to use IDE or a basic text editor on your local workstation.
Every code change is sent to source and version control.
Developers need to be able to develop, test, and distribute their code locally.
This is where The AWS Serverless Application Model or AWS SAM comes in.
Journey of a Serverless Developer Video
W3schools.com collaborates with Amazon Web Services to deliver digital training content to our students.
AWS SAM
AWS SAM is a serverless application deployment module for AWS CloudFormation.
With AWS SAM, you can design Lambda functions, APIs, serverless applications from the AWS Serverless Application Repository.
AWS CloudFormation is commonly associated with infrastructure as code in AWS.
You may specify your infrastructure in JSON or YAML templates.
This will construct the resources in your AWS environment when you upload these templates to CloudFormation.
There are two key components of AS SAM:
- SAM Command Line Interface
- SAM Templates
SAM Templates
To grasp SAM templates, you must first grasp infrastructure as code.
A template is a group of a specification to define your serverless application.
Templates allow you to create serverless solutions quickly and easily.
With templates, you don't need to write custom scripts or perform manual tasks.
Before deploying a template, you should test your configured Lambda functions.
Traditional apps are tested initially locally on the developer's workstation using unit tests.
Ideally, you'd utilize the same local testing method with Lambda functions.
But this requires simulating a Lambda-like execution environment locally.
SAM Command Line Interface
The SAM CLI allows you to test your code locally and simulate the Lambda environment.
It allows for local invocations, sample payload generation, and Lambda function debugging.
This allows you to run unit tests, debug, and resolve issues locally.
After validating the code and templates, you may use the SAM package to build a deployment package.
It is a .zip file that SAM saves in Amazon S3.
You can then use CloudFormation to deploy the .zip file to generate resources using SAM deploy.
Related reads:
AWS SAM and SAM CLI GiHub Reference GuideAWS SAM Gradual Code Deployment
Working with Deployment Configurations in AWS CodeDeploy