AWS python Lambda can't access EFS files

1.8k Views Asked by At

I'm trying to have python lambda use EFS as library storage, but it seems it can't get the contents of it. so this code:

import sys
sys.path.append("/mnt/efs/features")
import pandas as pd

Doesn't work on lambda, however when i mount the EFS from c9 same code works (I'm sure that the c9 python installation doesn't have pandas itself).

I tried doing

logger.info(os.path.ismount("/mnt/efs"))

which logs True, then I tried

logger.info(os.listdir("/mnt/efs"))

which logs empty array

I've defined local path for lambda file system as /mnt/efs and in c9 env i see that the features directory is created there, in efs I see that the size matches. access point is defined with root path /efs and has 777 permissions. Any ideas what I'm missing would be appriciated.

1

There are 1 best solutions below

0
On BEST ANSWER

The issue was where I had placed features dir in EFS. the access point had defined root as /efs but I had put it via c9 into /features, after moving features to /efs/features it worked fine.