- Docker
- AWS SAM CLI
The account that you are running the commands with should be able to manager Docker (e.g., be member of the docker
group or use sudo
)
To install AWS SAM CLI, run the following command:
pip install --upgrade aws-sam-cli
For more details please go to https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
To build the code locally please use the following command:
CI_PIPELINE_ID=local build/linux-build.sh
Please build the code as explained in the previous section. After the code is built, run the following command to start the local API Gateway instance:
sam local start-api
After the API Gateway container is up and running you, can call the Lambda function using http://127.0.0.1:3000/
For more details on testing and debugging the Lambda function locally, please check https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-debugging-golang.html
When the API Gateway is up and running, you can use the following commands to check if its working:
curl --request GET \
--url http://127.0.0.1:3000/
curl --request POST \
--url http://127.0.0.1:3000/ \
--header 'Content-Type: application/json' \
--data '{"name": "YourName"}'