Skip to content

Basic and clean unofficial docker image for Amazon Serverless Application Model local

Notifications You must be signed in to change notification settings

xemuliam/docker-sam-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sam-local-logo

SAM local

0.x

  • Version Layers 0.2.11 = 0.2 = latest
  • Version Layers
  • Version Layers
  • Version Layers
  • Version Layers
  • Version Layers

Docker image for AWS SAM local.

  • Docker builds Docker Pulls Docker Stars
 ___________
< SAM local >
 -----------
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/

Overview

Main idea is to give possibility to develop and test AWS SAM applications without AWS involvement and charging.

You can make direct invocation of particular lambda functions or use APIG-interface to call them.

Two runtimes are present in examples: Pytnon and NodeJS. Examples have been made to provide simple and clear view how it works. Examples are identical in the result and almost identical in code-style and formatting.

Feel difference :)

Official SAM Local Documentation

Usage

This image can either be used as a image for building on top of SAM-local or just to experiment with. I personally have not attempted to use this in a production use case.

Pre-Requisites

Ensure the following pre-requisites are met.

  • Linux, Mac, Windows + WSL
  • Docker 1.10+

How to use

  1. Clone or download this project code
  2. Go to docker-sam-local directory

Please bear in mind that syntax of commands remains intact despite dockerization

Help

./sam

Template validation

./sam validate

or

./sam validate -t template.yaml

Local invoke of lambda-function:

with event from stdin

echo '{"name":"Jude"}' | ./sam local invoke python

with event from file

./sam local invoke -e event.json node

Don't be confused by calling functions node or python. Those are resource names in my template.yaml file. Just for fun.

Service (API) mode:

./sam local start-api

In service mode you can use your browser or curl to call particular functions by REST-API:

GET request

curl http://localhost:3000/python/Jude

POST request

curl -d '{"test":"payload"}' http://localhost:3000/node/Vanessa

Enjoy! :)

About

Basic and clean unofficial docker image for Amazon Serverless Application Model local

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published