What is AWS SAM?
The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications.
With this framework, your technical team can model, materialize and test a whole backend application with a Serverless approach, providing order and control to the project, a replicable structure, and enabling its faster execution.
How does AWS SAM work?
Defining the application structure in a template (inside a file with .yaml extension) and using a shorthand syntax, your team defines functions, APIs, databases, and event source mappings that describe the application landscape with just a few lines per resource.
Here we have a small example of the resources created:
Once the description is complete, SAM capabilities,including SAM CLI, allow the template transformation to a runnable project.
This runnable project is useful for local testing and debugging the application, improving application lifecycle construction times.
The runnable project can be used for deploying your application to AWS. When deploying the application, all the resources described on the template are created and configured on your AWS account, shortening your go-live times and helping to shape your go-live strategies as well.
What are the SAM Advantages?
In short, creating the backend architecture for your Serverless applications with SAM can:
- Increase project control and organization by organizing the diverse resources in your solution, sharing configuration parameters, and versioning the entire backend in a single unit.
- Create faster project delivery times and improved testing. Testing changes to Serverless resources locally allows speedier development cycles and improves code debugging and quality.
- High-performing, resilient, and efficienct infrastructure with cloud best practices. By Following the AWS SAM approach, you are performing operations as code.It limits human error and enables consistent response to events described by the Operational Excellence Pillar of the AWS Well-Architected Framework.
- Enable safer deployments. If you use AWS SAM to create your Serverless application, it comes built-in with CodeDeploy to provide gradual Lambda deployments. With just a few lines of configuration, AWS SAM provides the following:
- Deploys new versions of your Lambda functions and automatically creates aliases that point to the latest version.
- Gradually shift customer traffic to the new version until you’re satisfied that it’s working as expected or roll back the update.
- Defines pre-traffic and post-traffic test functions to verify that the newly deployed code is configured correctly, and your application operates as expected.
- Rolls back the deployment if CloudWatch alarms are triggered.
Where can I find more information?
- AWS Serverless Application Model – Amazon Web Services
- AWS Serverless Application Model – Developer Guide
- AWS SAM CLI
- The AWS Well-Architected Framework
We hope you enjoyed this post about AWS SAM. If you want to know more, please send us a line, we are happy to talk about technology and its benefits for daily life and companies.