mamreezaa / lambda-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda layers demo

Description

This project created to demonstrate the usage of layers and common modules

Tools we use

Run locally with local layer

  • pip install -r /home/mam/projects/gs/lambda-layers/layers/python3.7DepPack1/requirements.txt

Debug

  • Add debug configuration in .vscode/launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
           "name": "Debug demo function",
           "type": "python",
           "request": "attach",
           "port": 5890,
           "host": "localhost",
           "pathMappings": [
               {
                   "localRoot": "${workspaceFolder}/src",
                   "remoteRoot": "/var/task"
               }
           ]
       }
   ]
 }
  • install ptvsd pip install ptvsd --system -t ./src
  • add these line on top of function file
import ptvsd
ptvsd.enable_attach(address=('0.0.0.0', 5890), redirect_output=True)
ptvsd.wait_for_attach()
  • run ./invoke.sh
  • start debug (F5)

Useful commands

Commands or sh Description
export PYTHONPATH=./src:/home/mam/projects/gs/lambda-layers:$PYTHONPATH Let python interpreter know the src module
python -m pytest Run unite test
./invoke.sh Invoke function locally
./dev-deploy.sh Deploy the function to de aws account
pip freeze > dev-requirements.txt Freeze all dev modules to a file

About


Languages

Language:Python 50.8%Language:Shell 49.2%