Skip to content

SharpeRAD/Cake.AWS.Lambda

Repository files navigation

Cake.AWS.Lambda

Cake Build addin for Amazon Lambda

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Table of contents

  1. Implemented functionality
  2. Referencing
  3. Usage
  4. Example
  5. Plays well with
  6. License
  7. Share the love

Implemented functionality

  • Update lambda code
  • Publish lambda version
  • Create lambda alias
  • Update lambda alias
  • Uses AWS fallback credentials (app.config / web.config file, SDK store or credentials file, environment variables, instance profile)

Referencing

NuGet Version NuGet Downloads

Cake.AWS.Lambda is available as a nuget package from the package manager console:

Install-Package Cake.AWS.Lambda

or directly in your build script via a cake addin directive:

#addin "Cake.AWS.Lambda"

Usage

#addin "Cake.AWS.Lambda"

Task("Update-Function-Code")
    .Description("Updates the AWS Lambda functions code.")
    .Does(async () =>
{
    var settings = new UpdateFunctionCodeSettings()
    {
        RevisionBucket = "company-deployments",
        RevisionKey = "AwesomeFunction.zip"
    }.Initialize(Environment);

    var version = await UpdateFunctionCode("MyFunction", settings);
});

Task("Publish-Version")
    .Description("Publishes a version of your function")
    .Does(async () =>
{
    var settings = new PublishVersionSettings()
    {
        RevisionBucket = "company-deployments",
        RevisionKey = "AwesomeFunction.zip",
        Description = "v1.0"
    }.Initialize(Environment);

    var version = await PublishLambdaVersion("MyFunction", settings);
});

Task("Create-Alias")
    .Description("Update an alias that points to the specified Lambda function version.")
    .Does(async () =>
{
    var version = "12345";
    var settings = new PublishVersionSettings()
    {
        Name = "Production",
        Version = version,
        Description = "v1.0"
    }.Initialize(Environment);

    await CreateLambdaAlias("MyFunction", settings);
});

Task("Update-Alias")
    .Description("Update an alias that points to the specified Lambda function version.")
    .Does(async () =>
{
    var version = "12345";
    var settings = new UpdateVersionSettings()
    {
        Name = "Production",
        Version = version,
        Description = "v1.0"
    }.Initialize(Environment);

    await UpdateLambdaAlias("MyFunction", settings);
});

RunTarget("Update-Function-Code");

Example

A complete Cake example can be found here.

Plays well with

If your deploying applications to AWS its worth checking out Cake.AWS.S3, if your deploying websites to IIS its worth checking out Cake.IIS or if your deploying windows services check out Cake.Services.

If your looking for a way to trigger cake tasks based on windows events or at scheduled intervals then check out CakeBoss.

License

Copyright (c) 2015 - 2016 Phillip Sharpe

Cake.AWS.Lambda is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please ⭐ the repository.

About

Cake build addon for AWS Lambda

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published