Emulating a Serverless Environment Locally

Get familiar with emulating an AWS environment locally.

We'll cover the following

The easiest way to run an AWS Lambda function locally is to use Lambda Test Tool. However, this tool only allows us to execute the Lambda function code in isolation. It doesn’t provide us with anything remotely similar to the real AWS environment. A tool that can provide a better emulation of the AWS environment is the AWS Serverless Application Model (SAM).

But SAM is more than just a tool for emulating a local AWS environment. It can also:

  • Deploy resources to AWS

  • List AWS resources

  • Delete AWS resources

  • View AWS event logs

Installing SAM

The process of installing SAM will differ depending on your operating system and the CPU architecture of the development machine. The official SAM website contains the most up-to-date installation instructions.

Using SAM

SAM is used with the CLI. Here’s a complete reference to SAM commands.

Get hands-on with 1200+ tech skills courses.