2

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/

2
  • 1
    Do you mean you want a second EFS share with the same data, or do you want it in EBS / an on-premise disk? Please edit your question to clarify what you need. My initial thought it to mount EFS and whatever else you want your data in and use rsync
    – Tim
    Commented Nov 23, 2018 at 18:32
  • 1
    @Tim - just posted an update, let me know if that clarifies, thanks.
    – elPastor
    Commented Nov 23, 2018 at 19:10

3 Answers 3

2

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/
5
  • There's a good chance it could be that simple, I'm a newbie when it comes to AWS, and specifically EFS. I was hoping to find a solution that didn't require mounting anything to the existing instance and could be done entirely from the AWS GUI.
    – elPastor
    Commented Nov 23, 2018 at 19:24
  • I'm not aware of any way to do this from the GUI, but I haven't used EFS much so I can't say for sure. I suspect mounting the two volumes on an instance is the simplest way. Note that a copy will take capacity from the volumes, so they may be slower for other things during the copy.
    – Tim
    Commented Nov 23, 2018 at 19:51
  • Great. As I said, I'm a total newb, so I'm actually just now figuring out the mounting process. As soon as I wrap my head around that, I'm going to try your answer and accept it if it gets the job done. Thanks.
    – elPastor
    Commented Nov 23, 2018 at 19:53
  • I've updated the answer to give you code that should work. Look at what MLu's answer as well, it's more complex but gives you another option.
    – Tim
    Commented Nov 23, 2018 at 23:18
  • It looks like there is no way to copy an EFS instance directly on AWS, and now that I understand a bit more about mounting them to EC2 instances, it really is as easy as you say. So I'm going to mark this as the accepted answer because it sent me looking in the right direction. Thanks @Tim.
    – elPastor
    Commented Nov 24, 2018 at 0:44
2

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 :)

1
  • Thanks MLu - think I'm good to go. I basically just had very little understanding of the overall EC2 / EFS relationship when I posted the question.
    – elPastor
    Commented Nov 24, 2018 at 0:46
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .