Derek Lawless

There is always sunshine. Above the grey sky

The packaged .zip for a Lambda layer can be downloaded using the AWS console (appropriate IAM permissions notwithstanding) - as long as you have access to the host AWS account of course.

If the Lambda layer originates in a different AWS account you don’t have console access to, you will need to use the AWS CLI.

Why would you want or need to do this though?

  1. As with any third party dependency it makes sense to examine it rather than simply trusting it to be benign in nature
  2. You want to override the layer’s behaviour in a specific way (i.e. by merging a later layer) and need to examine its implementation

Fortunately, the aws lambda CLI provides two useful options - one for downloading a layer version by name, the other by its ARN.

Downloading a Lambda layer version by name

To download version 99 of a Lambda layer called acme-corp-lambda-layer using its name, use the get-layer-version option:

URL=$(aws lambda get-layer-version --layer-name ars:aws:lambda:$AWS_REGION:$AWS_ACME_CORP_ACCOUNT:layer:acme-corp-lambda-layer --version-number:99 --query Content.Location --output text)

curl $URL -o

Downloading a Lambda layer version by ARN

If you want to download version 99 of of the layer using its ARN instead, use get-layer-version-by-arn:

URL=$(aws lambda get-layer-version-by-arn --arn arn:aws:lambda:$AWS_REGION:$AWS_ACME_CORP_ACCOUNT:layer:my-lambda-layer:99 --query Content.Location --output text)

curl $URL -o
© 2022 Derek Lawless. Built with Gatsby