I'm looking to replicate an existing EFS to a new EFS and mount it to a cloned environment for testing purposes but can't seem to find any good information on it.

To clarify - I'll be replicating an EC2 instance as well and want to create a completely separate environment so the new EFS instance will be identical to the source EFS at a certain point in time, but does not need to stay in sync afterward.

Any thoughts?

The following link is a potential solution, but seems overly complicated. That said, it may be the best / only way it can be done: https://aws.amazon.com/premiumsupport/knowledge-center/efs-file-sync-between-files/


This seems too simple... I'm not sure I've fully understood your question.

  1. Mount both EFS file systems to a single instance, likely your current instance.
  2. Use a copy command to copy the files to the new EFS file system.
  3. Disconnect the new file system from your instance
  4. Mount the new EFS file system to the new instance

Update

Here's some commands that have a pretty good chance of working. I took them from this page.

Mount the second file system

sudo mount -t efs -o tls fs-12345678:/ /mnt/efs2

Copy the files

sudo cp -r /mnt/efs /mnt/efs2/

Alternatively if you don't want to mount the new EFS on the existing server you can mount it only to the new one and copy the files over network.

[root@old-instance ~] # rsync -PrvaSHz /efs new-instance:/efs

(assuming the EFS volume is mounted as /efs on both sides)

Hope that helps :)


As of May 2019, AWS DataSync Now Supports EFS-to-EFS Transfer. Quoting from the blog post:

You can now use AWS DataSync to automatically, efficiently, and securely copy files between two Amazon Elastic File System (Amazon EFS) resources, including file systems in different AWS Regions and ones owned by different AWS accounts. Using DataSync to copy data between EFS file systems, you can perform one-time migrations, periodic ingest for distributed workloads, or automate replication for data protection and recovery, at speeds up to 10 times faster than open-source tools.