Skip to main content

AWS Lambda Pipeline

A library that creates a full out-of-the-box solution for AWS Lambda with CI/CD pipeline.

Remarks

The project is written by Deividas Tamkus, supervised by Laimonas Sutkus and is owned by iDenfy. This is an open source library intended to be used by anyone. iDenfy aims to share its knowledge and educate market for better and more secure IT infrastructure.

This project utilizes the following technology:

  • AWS (Amazon Web Services).
  • AWS CDK (Amazon Web Services Cloud Development Kit).
  • AWS CloudFormation.
  • AWS Lambda.
  • AWS CodePipeline.

Assumptions

This library project assumes the following:

  • You have knowledge in AWS (Amazon Web Services).
  • You have knowledge in AWS CloudFormation.
  • You are managing your infrastructure with AWS CDK.
  • You are writing AWS CDK templates with a python language.

Install

The project is built and uploaded to PyPi. Install it by using pip.

pip install aws-lambda-pipeline

Or directly install it through source.

./build.sh -ic

Description

This package creates a Lambda function and a pipeline for a complete out-of-the-box hosting infrastructure.

The pipeline takes your source code from CodeCommit and deploys it to Lambda.

Tutorial

  • Create a full infrastructure around AWS Lambda by using the following code below in your stack.
from aws_ci_cd_lambda.parameters.pipeline_parameters import PipelineParameters
from aws_ci_cd_lambda.parameters.ssh_parameters import SshParameters
from aws_ci_cd_lambda.parameters.lambda_parameters import LambdaParameters
from aws_ci_cd_lambda.parameters.vpc_parameters import VpcParameters
from aws_ci_cd_lambda.ci_cd_lambda import CiCdLambda
from aws_cdk import core, aws_ec2, aws_iam
from aws_cdk.aws_lambda import Runtime

class MainStack(core.Stack):
    def __init__(self, scope: core.App) -> None:
        super().__init__(
            scope=scope,
            id='MyCoolStack'
        )

        # Create your own vpc or use an existing one.
        vpc = aws_ec2.Vpc(...)

        # Create an execution role for your function.
        role = aws_iam.Role(...)

        # Create a security group for your function.
        sg = aws_ec2.SecurityGroup(...)

        vpc_params = VpcParameters(
            vpc=vpc,
            subnets=vpc.isolated_subnets,
            security_groups=[sg],
        )

        lambda_params = LambdaParameters(
            execution_role=role,
            lambda_memory=1024,
            lambda_timeout=60,
            lambda_runtime=Runtime.PYTHON_3_6,
            lambda_handler='manage.runner',
        )

        pipeline_params = PipelineParameters(
            ssh_params=SshParameters(
                aws_secret=(
                    'MyCoolSecret',
                    'arn:aws:secretsmanager:region:account_id:secret:MyCoolSecret-rAnDomStrinG',
                    None
                )
            )
        )   

        self.ci_cd_lambda = CiCdLambda(
            scope=self,
            prefix='MyCool',
            vpc_params=vpc_params,
            lambda_params=lambda_params,
            pipeline_params=pipeline_params
        )
  • Provision you infrastructure with CloudFormation by calling cdk deploy.

  • After you provision your infrastructure, go to AWS CodeCommit in your AWS Console.

  • Find a newly created git repository.

  • Commit any code you want to the newly created repository to trigger a pipeline.

(A tutorial on pushing code to remote repositories: AWS Tutorial).

(A tutorial on setting up git ssh with aws git repositories: AWS Tutorial)

Release history

3.4.0

Add md files.

3.3.0

Dependency update 1.60.0 - 2.0.0.

3.2.0

Force update AWS CDK dependency version to 1.44.0.

3.1.0

Added the ability to add custom commands to buildspec.

3.0.1

Bug fix.

3.0.0

Moved SSH parameters to a separate class.

2.3.0

Add ability to specify KMS key for secret decryption.

2.2.0

Add ability to specify arguments for install and test scripts.

2.1.0

Add error and throttles alarms. Add ability to specify lambda environment. Add reserved concurrent executions.

2.0.1

Bug fix.

2.0.0

Refactor. Increase clarity.

1.1.0

Major refactoring and minor updates and fixes.

1.0.1

Made use CDK version 1.27.0

1.0.0

Initial commit.

Metadata

Release files for aws-ci-cd-lambda 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-ci-cd-lambda 3.4.0
File Size Uploaded Provenance
aws_ci_cd_lambda-3.4.0.tar.gz 9.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-ci-cd-lambda 3.4.0
File Interpreter ABI Platform
aws_ci_cd_lambda-3.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.0 kB

Release files / aws_ci_cd_lambda-3.4.0.tar.gz

Download URL aws_ci_cd_lambda-3.4.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bc825e87a7390bf8c0f614f0a0085f1b238eafa2543884b5a8a92117e3124af4
BLAKE2b-256 checksum
How to use checksums
702dd7b38e8b2df12e3de9910bcb194ff19c114ff92c23d79ccb7ea6fa2f8916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.17

Release files / aws_ci_cd_lambda-3.4.0-py3-none-any.whl

Download URL aws_ci_cd_lambda-3.4.0-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0447927bb55fe46ee140042fc2c54ecbd7b490abf07ce514effbffa46bcc6e42
BLAKE2b-256 checksum
How to use checksums
d10ceb443b52588f343a651c968110b8f88a350fd6dfe40c341fba2b8c861e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.17

Security for aws-ci-cd-lambda 3.4.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page