Amazon Web Services (AWS) - Delete Lambda Layer using the AWS CLI

by
Jeremy Canfield |
Updated: November 28 2023
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
The aws lambda list-layers command can be used to list the Lambda Layers you have created.
aws lambda list-layers
Something like this should be returned.
{
"Layers": [
{
"LayerName": "sam-app7427b055-HelloWorldFunction19d43fc4-DepLayer",
"LayerArn": "arn:aws:lambda:us-east-1:123456789012:layer:sam-app7427b055-HelloWorldFunction19d43fc4-DepLayer",
"LatestMatchingVersion": {
"LayerVersionArn": "arn:aws:lambda:us-east-1:123456789012:layer:sam-app7427b055-HelloWorldFunction19d43fc4-DepLayer:1",
"Version": 1,
"Description": "Auto created layer for dependencies of function HelloWorldFunction",
"CreatedDate": "2023-11-17T02:56:35.074+0000",
"CompatibleRuntimes": [
"python3.9"
]
}
}
]
}
Then the aws lambda delete-layer-version command can be used to delete a specific version of a Lambda Layer.
aws lambda delete-layer-version --layer-name sam-app7427b055-HelloWorldFunction19d43fc4-DepLayer --version-number 1
Did you find this article helpful?
If so, consider buying me a coffee over at