Many technology users are aware of the concept of serverless computing, but not sure of the advantages it has over other software implementations, or how easy it is to develop a solution that fits into their business practices. In the past, all business processes – even very basic and infrequently used ones – needed to have a server or container running 24/7 to listen for requests. With serverless computing, users can fully harness the power of the cloud to drive down maintenance and operational costs. Serverless computing means that the cloud service provider is completely managing the server behind the scenes and all the user has to do is to upload their code and configurations to the cloud. Cost is pay-as-you-go when implementing with serverless computing; users are only charged when their code is executed.
A big hurdle to overcome with serverless computing is the change in development style. When coding for serverless computing, it is best to break down processes into small, discrete functions and couple them together. However, this increases the complexity of the project. Usually, the more code changes that propagate throughout the project, the more functions that need to be updated, and the more files that need to be uploaded individually. On top of that, coupling these functions together takes additional effort and troubleshooting in the console. Tracking all of this can quickly become time-consuming and lead to human error.
This is where a code framework can assist with tedious tasks. There are a variety of third-party and open source tools a user can leverage for this. AWS has a native tool called the Serverless Application Model (SAM). AWS SAM is free and streamlines existing AWS serverless services such as Lambda, API Gateway, and DynamoDB. Without this framework, an intrepid developer could create their own repository structure and pipeline. However, AWS has already done the work and even created a separate AWS SAM CLI that is used just for this process.
Serverless computing is the best way to see code live in the real world as fast as possible and as cheaply as possible, especially for simple projects. A user doesn’t have to run a server around the clock or spend extra time troubleshooting server and networking configurations. AWS SAM is extremely helpful on larger projects, but also surprisingly helpful on smaller ones as well. A user may initially not want to spend the time to learn yet another tool, but they will immediately reap the benefits of organized code. Troubleshooting configuration errors and reviewing code months down the road is easier when a consistent framework is in place.
When a project is initialized in AWS SAM, a folder structure is created for the user. Within this structure is a place for Lambda functions, code tests, and a template file (built on CloudFormation). This template simplifies common configurations that would take many lines in a CloudFormation template into just a few lines. Creating DynamoDB tables, S3 buckets, Lambda functions, and all of the associated IAM permissions and SNS, SQS, or API Gateway triggers, is easy to do and makes tracking everything over time much less tedious.
AWS SAM can build and deploy directly to the cloud from the CLI with a simple command. Additionally, functions can be tested locally using Docker. SAM spins up a container with the required code that mimics the AWS Lambda environment existing in the cloud.
If a cloud user is comfortable with AWS services, specifically serverless computing technologies, transitioning to AWS SAM is as simple as following the CLI installation instructions. If a user is new to serverless computing, learning AWS SAM will give them a well-rounded and thorough understanding of serverless concepts, and of AWS’s serverless computing offering.