Skip to main content

cdk-lambda-alias-retention

Project description

NPM version PyPI version Release

cdk-lambda-alias-retention

Create lambda alias and retain it forever.

What's the problem?

When using AWS CDK to create lambda with version and alias, it will retain the latest alias only. See the sample code as blow:

# Example automatically generated from non-compiling source. May contain errors.
const fn = new lambda.DockerImageFunction(stackTest, 'TestLambda', {
    code: lambda.DockerImageCode.fromImageAsset(
    path.join(__dirname, '../lambda'),
    ),
    currentVersionOptions: {
    removalPolicy: RemovalPolicy.RETAIN,
    },
});

fn.currentVersion.addAlias('v1.0.0');

In general, the lambda code will be iterated continuously and the alias will be changed probably ever time, such as v1.0.1, v1.0.2, v1.0.3 etc...

AWS CDK don't support to retain old alias now and it support to retain old version only.

Support CDKv1 and CDKv2

CDKv2

npm install cdk-lambda-alias-retention
or
npm install cdk-lambda-alias-retention@latest
or
npm install cdk-lambda-alias-retention@^2.0.0

CDKv1

npm install cdk-lambda-alias-retention@cdkv1
or
npm install cdk-lambda-alias-retention@^1.0.0

Usage

# Example automatically generated from non-compiling source. May contain errors.
new LambdaAliasRetention(stackTest, 'TestLambdaAliasRetention', {
    fn,
    lambdaAlias: 'v1',
});

Complete sample code is in src/integ.default.ts

It can use context or environemnt variable for lambdaAlias.

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

cdk-lambda-alias-retention-2.1.2.tar.gz (27.7 kB view hashes)

Uploaded Source

Built Distribution

cdk_lambda_alias_retention-2.1.2-py3-none-any.whl (27.9 kB view hashes)

Uploaded Python 3

Supported by

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