- Install Docker
- Install AWS SAM local from here
For deployment we follow the SAM documentation
To build the bundle.zip for lambda use the make bundle
target
make bundle
- Get it here
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
sam local start-api -n env.json
$ curl localhost:3000/game?create=true
GameModel Created
$ curl localhost:3000/game -X POST -d '{"player_id": "mark", "opponent_id": "dave", "winner_id": "mark"}' | python -m json.tool
{
"player_id": "mark",
"created_time": "2018-02-21T20:04:14.309467",
"opponent_id": "dave",
"winner_id": "mark"
}
$ curl localhost:3000/game -X POST -d '{"player_id": "mark", "opponent_id": "dave", "winner_id": "dave"}' | python -m json.tool
{
"player_id": "mark",
"created_time": "2018-02-21T20:04:28.546698",
"opponent_id": "dave",
"winner_id": "dave"
}
$ curl localhost:3000/game -X POST -d '{"player_id": "mark", "opponent_id": "bob", "winner_id": "mark"}' | python -m json.tool
{
"player_id": "mark",
"created_time": "2018-02-21T20:04:48.313896",
"opponent_id": "bob",
"winner_id": "mark"
}
$ curl localhost:3000/game/mark?opponent_id=dave | python -m json.tool
[
{
"winner_id": "mark",
"opponent_id": "dave",
"player_id": "mark",
"created_time": "2018-02-21T20:04:14.309467+00:00"
},
{
"winner_id": "dave",
"opponent_id": "dave",
"player_id": "mark",
"created_time": "2018-02-21T20:04:28.546698+00:00"
}
]
$ curl http://localhost:3000/game/mark?winner=true | python -m json.tool
[
{
"winner_id": "mark",
"opponent_id": "dave",
"player_id": "mark",
"created_time": "2018-02-21T20:04:14.309467+00:00"
},
{
"winner_id": "mark",
"opponent_id": "bob",
"player_id": "mark",
"created_time": "2018-02-21T20:04:48.313896+00:00"
}
]
- Add pycharm-debug-py3k.egg to the root directory
- Add the following lines to the lambda script
import sys
sys.path.append("pycharm-debug-py3k.egg")
import pydevd
pydevd.settrace('1.2.3.4', port=5858, stdoutToServer=True, stderrToServer=True, suspend=True)
- Remote debug on 5858
- pydevd to requirements.txt before building
- Add the following lines to the lambda script
import pydevd
pydevd.settrace('1.2.3.4', port=5858, stdoutToServer=True, stderrToServer=True, suspend=True)
- Remote debug on 5858