Open agaddamu opened 2 years ago
Moving to correct repo.
@agaddamu Why does your lambda function need access to files on your machine? Are you trying to test something specific?
I ask because when you deploy your lambda function, mounting other directories like this is not an option. You could use ESF however but that interaction we don't emulate locally. Mainly trying to understand what you are attempting to achieve with this.
As a note, you mentioned that "sam should honor docker options" but the reason we don't (in many cases) is because you can't do the same once deployed. So we don't provide the same options docker does to make sure we can emulate how lambda works as best we can.
@jfuss Sorry for the delayed response. The use case is "there is a requirement for the application to load certificates during startup. The certificates are available on the host machine."
We wan into this because we mount an EFS volume to the lambda that it reads from, but without the ability to mount local volumes under SAM a lambda like that can't be used locally.
Is there an alternative or a workaround?
Problem : sam local doesn't support docker volume mapping
Ex: Application has to read files on host machine. The host file location should be accessible to the application running in sam container. Currently there is no available option. The equivalent of this is -v in docker.
sam supports -v ( docker-volume-basedir ) but as per the spec is only for AWS SAM file.
"The location of the base directory where the AWS SAM file exists. If Docker is running on a remote machine, you must mount the path where the AWS SAM file exists on the Docker machine, and modify this value to match the remote machine"
Proposal
Tool built on top of underlying software should support the native options. For example : sam should honor docker options on top of sam options.
Things to consider: [ ] The SAM documentation will need to be updated
Additional Details