Download the Code of an AWS Lambda Function

avatar

Borislav Hadzhiev

Last updated: Jul 24, 2022

banner

Photo from Unsplash

How to Download the Code of an AWS Lambda Function #

To download the code for a Lambda function:

  1. Open the AWS Lambda console and click on your function's name
  2. Click on the Actions button and click Export function

export function

  1. Select Download deployment package on the popup screen

download deployment package

  1. Extract the .zip file and you will find the code for the lambda function
If you're on Windows, the file might not have the .zip extension, in fact it might not have any extension. If it doesn't, you have to add it yourself.

When you're downloading the source code for a lambda function, check whether the function has layers.

To see if a lambda function has layers, click on the Code tab on the function's page and scroll down until you see the Layers section.

function layers

If your function has layers, you have to download the layer code as well.

In the screenshot above the function has a layer named yupFCE70298 with the Layer version 18.

In this case, we have to open the layers page from the sidebar and filter for the layer by its name:

find layer

Click on the layer's name and scroll down to the All versions section. Click on the version number that corresponds to your function's layer version.

Finally, click on the Download button.

download layer

Extract the zip file and add the lambda layer to your layers directory.

Further Reading #

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.