Updating files in Amazon EFS - Part 2

Search for a command to run...

No comments yet. Be the first to comment.
This series discusses a few options (DIY and AWS provided) to load and update the files in EFS placed in a private subnet.
Scenario - From Network Fileshare/device This is the scenario where the files are generated or updated to some file share/network drives. EC2 instance Sometimes, the the files may be generated to a network device that your VPC may have access to, lik...
AWS DataSync is a powerful service to move data between a range of sources and destinations. Being a managed service, it frees us from having to manage and maintain the infrastructure as well as the data transfer logic. While experimenting with AWS D...
Scenario - From Network Fileshare/device This is the scenario where the files are generated or updated to some file share/network drives. EC2 instance Sometimes, the the files may be generated to a network device that your VPC may have access to, lik...

Amazon EFS is a widely used AWS service. Be it applications running in EC2 instances or containers or serverless apps, EFS provide the 'external file storage' or a 'shared file storage' capability. Since the same EFS can be mounted from different pla...

Many tools and applications publish their docker images to docker hub and other public repositories, and many of them supply a docker-compose file to help with a boiler plate deployment. Those are helpful when you are playing around with the applicat...

The first part of this blog series discusses updating EFS placed in private subnet using AWS CodePipeline. This post discusses achieving the same using a lambda function as the heart of the solution.

Pros:
Cons:
Configuring the lambda trigger can be tricky when there are too many files and folders involved. For example, one may have a folder textFiles with multiple .txt files, an image folder with various images of gif, jpeg etc. and another folder scripts with many .py, .sh, .js etc files. Configuring the trigger then becomes erroneous and may cause multiple lambda trigger for a single upload that involves multiple files. This could be worked around by
Having a special trigger object: Have a predefined file or a predefined folder (and have files with predefined format in it), then configure that as the trigger for the lambda function. For example, trigger/-startupdate.txt. This would allow us to configure the s3 trigger with prefix as trigger/ and suffix as -startupdate.txt. Downside of this approach is that from the file origin we should create an extra file with the pattern (-startupdate.txt in our example) and upload to S3.
Upload as zip: The other alternative is to upload the whole files as a zip so we only have a single file to configure the S3 trigger. The lambda will extract and copy/sync files to S3. Again, this option is limited by the available ephemeral storage and currently that is 10GB with the recent update
A sample implementation of the approach discussed above can be found in this github repository
The approach discussed here and in the previous part of the series are useful only when it is possible to push the files from their source to a S3 bucket. But there can be situations where the files are generated to a network fileshare/drive and the files need to be copied/synced to EFS. The next part in the series will discuss the options to sync files from network fileshare/drive to EFS.