AWS Package a Lambda

The Problem

You have built a .net core based AWS lambda package and now you wish to publish it.

Googling the internet you find that this can be done by running the following script:

dotnet lambda package -o ..\lambda-1.zip

It throws the error: “dotnet : No executeable found matching command “dotnet-lambda”

The Issue

You Lambda project requires some special tools that provide the aws lambda packager.

The Solution .net core 2.x

Edit your .net core project file and ensure that the following block exists as an item group


    

Restore the packages, (dotnet restore), and retry the “package” command and the lambda should now build and be packed into your lambda-1.zip file.

The Solution .net core 3.x

In .net core 3.x, things have changed and you no longer need to include the client tool reference as part of the project file.

Instead you need to install the Amazon Lambda tools as a globally accessible tool. Run the following common to install

dotnet tool install --global Amazon.Lambda.Tools

The nuget package details are here:
https://www.nuget.org/packages/Amazon.Lambda.Tools

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.