Bobcares

Access AWS EFS file from lambda: How to?

by | Sep 8, 2022

Let us take a closer at how to access the aws efs file from lambda in a few simple steps with the support of our AWS support services at Bobcares.

 

Setup to AWS EFS File System for Lambda

access aws efs file from lambda

The setup is straightforward, requiring only the creation of an EFS file system, the addition of permissions to the function, and the attachment of the EFS file system to the Lambda function.

 

Creating the AWS EFS file system

To set up an EFS files system for Lambda to access follow the steps given below:

  • Go to the AWS EFS console, click “Create file system,” then pick a VPC and the desired AZs. Next, ensure that the General Purpose option is chosen and then click Next.
     
  • Create a file system access point now. We can see some examples of details to fill in, but make sure we understand the setting and alter it as needed.
     
  • Create and confirm the file system.
 

Let’s now change the IAM role of the required Lambda function to access the aws efs file from lambda. To open the IAM console, go to the permissions tab and click on the role name.

 

Attach Permissions on the IAM console, and then add the following permissions:

  • AWSLambdaVPCAccessExecutionRole
  • AmazonElasticFileSystemClientFullAccess
 

Return to the Lambda function, then near the bottom, locate the new File system section and click the Add File System button.

 

In the File system settings do the following configurations to access aws efs file from lambda:

  • Select the necessary file system from the EFS file system menu. Select the relevant EFS access point from the Access point menu.
     
  • Enter the path used by the Lambda function to access this resource in the Local mount path. Enter a path that is absolute.
     
  • Click on the Save button post the configurations.
 

Eventually, it should give a an output with the credentials marking the final step approach aws efs file from lambda. After this we can now access files on the mount we created.

 

[Need assistance with similar queries? We are here to help]

 

Conclusion

   To conclude we have learned more about how to access aws efs file from lambda with a few simple steps beginning with setting up the EFSA files and creating the file system for Lambda with the assistance of our AWS support services.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.