AWS Local Serverless Environment Setup using AWS SAM

Cristian Carballo
2 min readFeb 27, 2021

--

This post is intended to list the steps for setting up your local development environment for creating serverless applications using the AWS SAM CLI.

I will list below all the pre-requisites that you need to have installed in your local machine:

  • A valid AWS Account —To build and deploy our serverless function to the AWS Lambda, so you must have a valid AWS account. If you are new and do not have an account yet, you can navigate to http://console.aws.amazon.com/ and signup for a new account
  • Python — My example is developed in Python so i will recommend you to install Python if you want to use my code. You can download the latest version of python by visiting https://www.python.org/downloads/ and install the same based on the operating system you are using. It is important to mention that you can build your serverless functions with any language of your choice. There are quite a few languages supported by AWS Lambda, like Python, C#, Ruby, NodeJS, etc.
  • AWS CLI — In addition to building the serverless apps locally, we will also need to access the AWS services programmatically. This can be achieved by installing the AWS CLI or the command-line interface, using which you can perform many administrative activities on your AWS Account.
  • AWS SAM CLI — In order to develop and test the applications locally, you need to install the AWS SAM CLI on your machine. The AWS SAM CLI will provide an AWS Lambda like execution environment using which you can run your code locally and get the output
  • Docker — Finally, you also need to get Docker installed on your machine if you want to test the application locally. The AWS SAM CLI will use Docker to mount an image where the execution will be performed. You can install Docker by visiting https://docs.docker.com/desktop/
  • Visual Studio Code — For developing the code, we are going to use the Visual Studio Code as the editor. You can download this from http://code.visualstudio.com/

Once you have installed all the pre-requisites on your machine, you can check the installed versions by running the following commands.

  • Python — python –version
  • AWS CLI — aws –version
  • AWS SAM CLI — sam –version
  • Docker — Docker –version

--

--