Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

AWS CDK package that helps deploying a lambda function.

Project description

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.

Related technology

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aws-ci-cd-lambda, version 3.4.0
Filename, size File type Python version Upload date Hashes
Filename, size aws_ci_cd_lambda-3.4.0-py3-none-any.whl (25.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aws_ci_cd_lambda-3.4.0.tar.gz (9.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page