====== AWS codebuild ======
===== Python in Lambda =====
buildspec.yaml
version: 0.2
phases:
install:
commands:
- echo "Installing boto3 with pip"
- pip install boto3
build:
commands:
- echo "Running reports.py"
- python3 -c 'from reports import lambda_handler; lambda_handler({}, {})'
- echo "Finished reports.py"
Note the use of ''({}, {})'' to pass parameters in to the Lambda Function, in this case, no parameters are needed.
===== BASH shell script =====
buildspec.yaml
version: 0.2
phases:
build:
commands:
- export timestamp=$(date +%s%3N)
- echo "${timestamp}"
- aws logs put-log-events --log-group-name logging_test --log-stream-name 20150601 --log-events timestamp="${timestamp}",message="Hello"