Cake Build addin for Amazon Lambda
- 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)
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"
#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");
A complete Cake example can be found here.
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.
Copyright (c) 2015 - 2016 Phillip Sharpe
Cake.AWS.Lambda is provided as-is under the MIT license. For more information see LICENSE.
If this project helps you in anyway then please ⭐ the repository.