Search code examples
amazon-ec2aws-lambdaamazon-dynamodbboto3amazon-efs

write data from dynamodb to EFS share connected to a fleet of EC2 instances


I have configured my react app to submit data to a dynamodb and dynamodb trigger to start lambda as soon as new data is submitted.

I would like to use the lambda to save the data as a JSON file to EFS share. The efs share is currently mounted on EC2 linux instance

Any ideas on how to accomplish this with python lambda and boto3?


Solution

  • You don't need boto3 for this, and indeed you can't write to EFS using the AWS API at all, so boto3 can't help you here. The only way to write to an EFS volume (at this time) is to mount the volume. Luckily you can configure your Lambda functions to mount the EFS volume. Then it would just just be a matter of writing the file to the volume's path, just like writing any other file from Python.