In this article, we are going to work on setting up your local development environment for creating serverless applications using the AWS SAM CLI. This article is a part of the three-article series “Develop and Deploy Serverless Applications with AWS SAM CLI”. If you already know about the working principle of the AWS SAM CLI, you may proceed with this; otherwise, I would highly recommend reading my previous article on the series, Getting started with the AWS SAM CLI, where I talk about the introduction to the AWS Serverless Application Model and its workflow.

Pre-requisites

In order to set up the local environment to develop serverless applications, you need to have the following requirements fulfilled. All the items mentioned below are a must if you want to create and test the application on your local machine before deploying it to the AWS environment.

  • A valid AWS Account – For the sake of this article, we are going 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– 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. For this tutorial, we are going to develop our application using python. So, you must have python installed on your machine before proceeding forward. 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
  • 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. There is a very good article, Learn AWS CLI: An Overview of AWS CLI (AWS Command Line Interface), on how to get the AWS CLI installed on your machine. Please follow this article if you do not have it installed yet
  • 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

All Pre-Requisites up and running - AWS SAM CLI

Figure 1 – All Pre-Requisites up and running

#aws #aws sam cli #amazon web services

Set up a local serverless environment using the AWS SAM CLI
1.30 GEEK