Amazon Web Services (AWS) - List Lambda Layers using the AWS CLI
by
Jeremy Canfield |
Updated: January 06 2024
| 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
And here is an example of how to limit the output using the --query option.
aws lambda list-layers --query 'Layers[?LayerName==`mylayer`]'
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"
]
}
}
]
}
Likewise, the aws lambda list-functions command can be used to list the Lambda Layers connected to a Lambda Function.
~]$ aws lambda list-functions
{
"Functions": [
{
"FunctionName": "sam-app-HelloWorldFunction-MgYCNMibayEZ",
"FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:sam-app-HelloWorldFunction-MgYCNMibayEZ",
"Runtime": "python3.9",
"Role": "arn:aws:iam::123456789012:role/sam-app-HelloWorldFunctionRole-RiTFI3yH1db7",
"Handler": "app.lambda_handler",
"CodeSize": 850,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2023-11-28T02:02:15.000+0000",
"CodeSha256": "fF2igsgz+Luy1NLV67RoHWDzVT7dnu+ncMbN3tp+Lmg=",
"Version": "$LATEST",
"VpcConfig": {
"SubnetIds": [],
"SecurityGroupIds": [],
"VpcId": ""
},
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "a2810ce8-0b8c-4c51-b104-aa8ea677101e",
"Layers": [
{
"Arn": "arn:aws:lambda:us-east-1:123456789012:layer:sam-app7427b055-HelloWorldFunction19d43fc4-DepLayer:1",
"CodeSize": 530296
},
{
"Arn": "arn:aws:lambda:us-east-1:123456789012:layer:paramiko:1",
"CodeSize": 1430666
}
],
"PackageType": "Zip",
"Architectures": [
"x86_64"
],
"EphemeralStorage": {
"Size": 512
},
"SnapStart": {
"ApplyOn": "None",
"OptimizationStatus": "Off"
}
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at