Monitoring Lambda code storage - AWS Lambda

Monitoring Lambda code storage

The Lambda service stores your function code in an internal S3 bucket that’s private to your account. Each AWS account is allocated 75 GB of storage in each Region. Code storage includes the total storage used by both Lambda functions and layers. If you reach the quota, you receive a CodeStorageExceededException when you attempt to deploy new functions.

It’s best practice to manage the storage space available and clean up old versions of functions and remove unused code.

The Lambda console shows the total storage used in the Dashboard submenu:


            monitoring observability figure 26

You can see the storage used by individual functions both in the Functions submenu and by using the Lambda CLI command list-versions-by-function:


            monitoring observability figure 27

This returns each published version of the function together with the $LATEST version. The CodeSize attribute shows the total number of bytes used by code storage of this function.

Similarly, for Lambda layers, you can see the code storage used by each layer version by using the CLI command get-layer-version:


            monitoring observability figure 28