Mount Amazon Elastic File System (EFS) in AWS Lambda Functions

For Lambda functions that run in a VPC, it’s possible to mount EFS onto them. This lets you share the EFS among concurrent executions of the Lambda function & even with EC2 & on-prem instances.

To mount an EFS in a Lambda function, open the function in the web console & scroll down to the File System section:

Assuming you have the EFS ready & that the Lambda is in the same VPC as the EFS, click Add File System:

All subsequent invocations of the Lambda function can now access the EFS at /mnt/efs. For demonstration, I’ve added an EFS to a Bash Lambda created here. The df command then shows the EFS at /mnt/efs. with 8 exabytes of free space!

function handler () {
    DATA=`df -h | grep /mnt/efs`
    RESPONSE="{\"statusCode\": 200, \"body\": \"$DATA\"}"
    echo $RESPONSE
  "statusCode": 200,
  "body": " 8.0E 0 8.0E 0% /mnt/efs"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.