Alana Storm
Alana Storm

Reputation: 166066

Remove a Layer from an AWS Lambda Function

Is there a way (using either the AWS CLI or some API) to programmatically remove a layer from an AWS lambda function?

That is, I know I can add or update a layer version by running something like the following

aws lambda update-function-configuration --function-name my-function-name --layer arn:aws:lambda:us-west-2:000000000:layer:layer-name:7

However, this only allows me to add or update the function's configuration. I'd like to programmatically remove the arn:aws:lambda:us-west-2:000000000:layer:layer-name:7 layer from the AWS function named my-function-name

Upvotes: 3

Views: 1489

Answers (1)

Alana Storm
Alana Storm

Reputation: 166066

The values passed to --layers (note: not --layer, which appears to be an alias to the actual option) option replaces your entire layers configuration. This means that, by passing an empty --layers

$ aws lambda update-function-configuration --function-name my-function-name --layers 

you can remove your entire layers configuration.

Upvotes: 3

Related Questions