Skip to main content

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.

Source Distribution

aws_ci_cd_lambda-3.4.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_ci_cd_lambda-3.4.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file aws_ci_cd_lambda-3.4.0.tar.gz.

File metadata

  • Download URL: aws_ci_cd_lambda-3.4.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for aws_ci_cd_lambda-3.4.0.tar.gz
Algorithm Hash digest
SHA256 bc825e87a7390bf8c0f614f0a0085f1b238eafa2543884b5a8a92117e3124af4
MD5 ad90aa1107b264a3e0fa54ea116967b4
BLAKE2b-256 702dd7b38e8b2df12e3de9910bcb194ff19c114ff92c23d79ccb7ea6fa2f8916

See more details on using hashes here.

File details

Details for the file aws_ci_cd_lambda-3.4.0-py3-none-any.whl.

File metadata

  • Download URL: aws_ci_cd_lambda-3.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for aws_ci_cd_lambda-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0447927bb55fe46ee140042fc2c54ecbd7b490abf07ce514effbffa46bcc6e42
MD5 06777564802800b0a33aeb44121c0d2e
BLAKE2b-256 d10ceb443b52588f343a651c968110b8f88a350fd6dfe40c341fba2b8c861e20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page