cd python-lambda-template
python - m venv.
source bin / activate.fish
pip install -r requirements.txt
- Project Structures> Python> Create your SDK with your Python
- Add SDK classpath:
/path/to/python/lib/python3.6
- Project Structures> Modules> Attatch src and test directory as
Sources
andTests
- install requirements.txt on Intellij
Using pytest.
make test-unit
Using AWS Serverless Application Model (AWS SAM).
Your task:
- Edit
Makevars
for your environment. - Create AWS SAM template in
templates/
directory. - Create Lambda handler in
src/functions/handlers/
directory.
The name of the following ${resource_name}
has to be matched:
templates/template_${resource_name}.yaml
src/functions/handlers/${resource_name}/example_handler.py
- Make task:
make deploy-${resource_name}
Before deploy, you should set your AccessKey and Secret for your AWS account. Deploy example:
make deploy-heroes env=test account_id=9999999999999
aws s3 mb s3://hero-lambda-deploy --profile your-profile
- Your CloudFormation stack will be created.
- Your Lambda Function will be deployed.