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
SourcesandTests - install requirements.txt on Intellij
Using pytest.
make test-unitUsing AWS Serverless Application Model (AWS SAM).
Your task:
- Edit
Makevarsfor 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}.yamlsrc/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.