AWS Lambda CI
Continuous integration pipeline for aws lambda function
Features
✅ Supports the two famous lambda runtimes python and nodejs.
✅ Supports installing custom packages that does not exist in lambda runtime passed to CI process as a package’s descriptor file path in git repository.
✅ Supports installing custom pip/npm dependencies that does not exist in lambda runtime and passed to CI process as a package’s descriptor file path, packages.json or requirements.txt.
✅ The integration/deployment process is fast thanks to code and dependencies caching.
✅ The lambda dependencies packages are built in a sandboxed local environment that replicates the live AWS Lambda environment almost identically – including installed software and libraries.
✅ The pipeline does not break the currently published version and traffic shifting between the current and new deployment is seamless.
Requirements
IAM Permissions
The user/role that call this pipeline should have these permissions attached to it.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::artifacts-bucket-name/*",
"arn:aws:s3:::artifacts-bucket-name"
]
},
{
"Sid": "",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::artifacts-bucket-name/lambda-ci/function-name/*",
"arn:aws:s3:::artifacts-bucket-name/lambda-ci/function-name"
]
},
{
"Sid": "",
"Effect": "Allow",
"Action": [
"lambda:UpdateFunctionConfiguration",
"lambda:UpdateFunctionCode",
"lambda:UpdateAlias",
"lambda:PublishVersion",
"lambda:GetFunction"
],
"Resource": "arn:aws:lambda:us-east-1:YOUR_ACCOUNT_ID:function:function-name"
},
{
"Sid": "",
"Effect": "Allow",
"Action": [
"lambda:PublishLayerVersion",
"Lambda:ListLayerVersions"
],
"Resource": "arn:aws:lambda:us-east-1:YOUR_ACCOUNT_ID:layer:function-layer-name"
},
{
"Sid": "",
"Effect": "Allow",
"Action": "lambda:GetLayerVersion",
"Resource": "arn:aws:lambda:us-east-1:YOUR_ACCOUNT_ID:layer:function-layer-name:*"
}
]
}
Packages
python3
docker
Usage
Installation
pip3 install aws-lambda-ci
Arguments
These are the available arguments:
ARG |
USAGE |
||
|---|---|---|---|
–app-s3-bucket |
The s3 bucket name that will hold the application code and dependencies |
||
Required |
Default: None |
Allowed: existing S3 bucket name |
|
–function-name |
AWS lambda function name |
||
Required |
Default: None |
Allowed: existing lambda function name |
|
–function-runtime |
AWS lambda function runtime (eg: python3.7) |
||
Optional |
Default: python3.8 |
Allowed: pythonX.x``|``nodejsX.x |
|
–function-alias-name |
AWS Lambda alias name (eg: latest) |
||
Optional |
Default: latest |
Allowed: version tag (eg: latest, qa, prod …) |
|
–function-layer-name |
AWS Lambda layer name (eg: demo-lambda-dependencies) |
||
Optional |
Default: {function-name}-deps |
Allowed: a valid layer name |
|
–app-src-path |
Lambda function sources directory that will be archived (eg: demo-lambda/src) |
||
Optional |
Default: current directory |
Allowed: an existing directory with source code |
|
–app-packages-descriptor-path |
Packages descriptor path (eg: demo-lambda/requirements.txt) |
||
Optional |
Default: requirements.txt |
Allowed: an existing and valid requirements.txt or package.json |
|
–source-version |
The unique revision id (eg: github commit sha, or SemVer tag) |
||
Optional |
Default: Random hash |
Allowed: commit hash | tag ver |
|
–aws-profile-name |
AWS profile name (if not provided, will use default aws env variables) |
||
Optional |
Default: None |
Allowed: existing aws profile name |
|
–watch-log-stream |
Watch lambda log stream in realtime after publishing the function |
||
Optional |
Default: True |
Allowed: Boolean |
|
–build-docker-repo |
Use custom build docker repository (other than lambci/lambda) |
||
Optional |
Default: lambci/lambda |
Allowed: a valid docker repo without image tag part |
|
–build-docker-image |
Custom build docker image tag (if not provided, will use build-{[python|node][runtime-version]}) lambci/lambda repo |
||
Optional |
Default: None |
Allowed: an existing docker image tag |
|
Example
aws-lambda-ci \
--app-s3-bucket "kodhive-prd-useast1-ippan-core-artifacts" \
--function-name "useast1-mimoto-api-v1-codeless" \
--function-runtime "python3.11" \
--function-alias-name "latest" \
--function-layer-name "useast1-mimoto-api-v1-codeless-deps" \
--app-src-path "app/api/src" \
--app-packages-descriptor-path "app/api/src/requirements/lambda.txt" \
--source-version "1.0.1" \
--aws-profile-name "kodhive_prd" \
--watch-log-stream \
--build-docker-repo public.ecr.aws/sam/build-python3.11 \
--build-docker-image latest
Demos
Code and dependencies changes
If both code and dependencies changed, the pipeline will publish both changes.
Just code changed
If code changed but not dependencies, the pipeline with publish new code and the dependencies will be left intact.
Nothing changed
If both code and dependencies not changed, the pipeline will not publish anything.
Metadata
Release files for aws-lambda-ci 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aws_lambda_ci-0.0.8.tar.gz | 12.7 kB | Without provenance | Details for aws_lambda_ci-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aws_lambda_ci-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for aws_lambda_ci-0.0.8-py3-none-any.whl |
Total release size: 25.7 kB
Release files / aws_lambda_ci-0.0.8.tar.gz
| Download URL | aws_lambda_ci-0.0.8.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d21b81ead75630cf0b4696266b0cd503762fb8911b12f2a263daf60a7f0f425
|
|
BLAKE2b-256 checksum How to use checksums |
a5cbd75698d4c444f5763e5a6bf8cabf776f22a12d702e527ef70d947df36f4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / aws_lambda_ci-0.0.8-py3-none-any.whl
| Download URL | aws_lambda_ci-0.0.8-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10fc9ca132cbd35a816d765650b6dbb5affc8d60f823bebf537662b0b38c9df3
|
|
BLAKE2b-256 checksum How to use checksums |
ac8ff2fe0bb0def36ae936d591d6b74b7f6b015f823b938e20bb778a836e6106
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Security for aws-lambda-ci 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.