Cross Region Transfer of Data from EFS to EFS Using AWS DataSync
Tags: awsdatasync, ec2, vpc, amazonefs
Published: 2023-09-10 14:50:22

“ I have checked the documents of AWS to transfer the data between an elastic file system in cross-region. AWS Datasync service makes easy and secure transfer of data from efs to efs. In terms of cost, the solution is cheaper and secure.”

AWS DataSync is an online data movement and discovery service that simplifies data migration and helps you quickly, securely and easily transfer your file or object data to, from and between AWS storage services.

In this post, you will experience the cross region transfer of data from efs to efs using aws datasync. Here I have created a vpc, efs, ec2 and datasync across regions.

#Prerequisites
You’ll need an Amazon Virtual Private Cloud for this post. [Getting started with amazon VPC](https://aws.amazon.com/vpc/getting-started/) provides instructions on how to create a VPC. For this blog, I assume that I have a VPC created in both regions.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8v5481h53y7lfr43ovsi.jpg)
The architecture diagram shows the overall deployment architecture with data flow, two aws regions, vpc, efs, ec2 and aws datasync.

#Solution overview
The blog post consists of the following phases:
1. In N.Virginia, Create of VPC Peering Connection to Connect with Oregon Region VPC
2. In N.Virginia and Oregon Region, Create of Amazon Elastic File System
3. In N.Virginia and Oregon Region, Launch of EC2 for DataSync Agent Instance and Windows Activate Agent
4. In Windows Activate Instance, Connect through RDP and Login to AWS Console in Oregon Region, Creation of VPC Endpoint and Creation of AWS DataSync Agent
5. In the Oregon Region, Creation of Locations and Tasks in AWS DataSync. Also Transfer of Data from EFS of One Region to EFS of Another Region

In two aws regions of same account, I have a vpc created with subnets, route tables, internet gateway and nat gateway as below →

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ellcbobkigo0gbfk79s.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufm7uyga9fkmcv6prasx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vlmozqeocvchzrek5fna.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zbrf0ak6ct4azi1c0bbg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u509cy61z2mxhx1gc5ft.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n81nhxhjz29573rilqnl.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suef1as1781dujviub9s.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmrw47g4ehhscvmy11k2.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lz39twcc4qrlh440ji5r.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcto162fou8onhscynur.png)

##Phase 1: In N.Virginia, Create of VPC Peering Connection to Connect with Oregon Region VPC
1. Open the console of VPC, choose peering connection to create a peering between two region vpc. Also accept peering connections in the Oregon region.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7cc1zvuo1jzb98h3oq79.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytiz2dv0b117f5ybvtjx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhrmwe8vysf4jpq7ibda.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zt8byjt0vajr35yg1ujr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7us4o2i3s0xgd2lwqvnt.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/65axkeg12f3uplnvmlf8.png)

##Phase 2: In N.Virginia and Oregon Region, Create of Amazon Elastic File System
1. Open the ec2 console, Create a security group for both region efs with required rule permission. Also create an elastic file system in both regions.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dsqtend7k0d38e2z7w5e.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1hemy02xrizezxlobm0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fusaf64djoig1qci3k7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9w910m5tgq5qhg061pcy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8te9uk1mstrvvk6ithh.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxz54xbo7htvovz151i6.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/berlnuzfw7e9kg552jtv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vtv6bnzv912v8fgobea.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k9ohcxyc82s11vxzkh5b.png)

##Phase 3: In N.Virginia and Oregon Region, Launch of EC2 for DataSync Agent Instance and Windows Activate Agent
1. Open the ec2 console, Create a security group for both regions ec2 instances with required rule permission. Also launch of instances in both regions for datasync agent.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6yoij6rb1rx4z24awmei.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uw2rbzj5sujsm837blqa.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1rphv31qwhw059kbfyp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5e0eaz4rgirgxm8hnby.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcnugn0mujb4u5k3ps6g.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cel5xmkvgclw1gytlw7n.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4oeupc3zqyxi71nhj5b.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfivu060gr74b2mckuv5.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgjtfk9mnlxjfaaqg3rf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kd9s82e8jfynmkz2zcej.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/loc83k4cb3xx13mte2uv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgy5p8aubujaimh0f9it.png)

##Phase 4: In Windows Activate Instance, Connect through RDP and Login to AWS Console in Oregon Region, Creation of VPC Endpoint and Creation of AWS DataSync Agent 
1. Open the VPC console, create a vpc endpoint to access private connections. Also open the datasync service, create of aws datasync agent with activation key.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2kr465qkwem7m7jie8c.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ae8iu72mboyonpz2ilm6.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khi6uk42hny35v63373e.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ji305f8g6d8gt1a23p57.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhp26zqds3ztuh6ummu7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x13atbakl9cv297yealz.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rq5s3o7n9oit0cact1t.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eq4rhg7w4ixwhtzzrq91.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hflh59ih6gwnp3aobfw.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lnjzx85ff7phq5kxzq2.png)

##Phase 5: In the Oregon Region, Creation of Locations and Tasks in AWS DataSync. Also Transfer of Data from EFS of One Region to EFS of Another Region

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e378porej4k9g2u93u8w.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y75m3rlwsxpqnm5order.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6yqjulas17ateozfb52i.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eoul15iibdvi20z9wzpg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jtg0rvj5upysyy8tqugk.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g5fk2kljrcra4r9v605o.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtmdom72att4hi53u5ud.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kka87ngalwoydocp91d.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fz3vcbjdi577bmmdv6w6.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8ub9wdvg8shu6rt7nsp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qflm1i0ek4b7zy49f0bg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6d07n552ofo1f8b0wn7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vw0uq9kbacpvjptq8o4.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hdj1jvyj9wnon9v97f5h.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdckc7mpkq8dnjzdbgcw.png)

#Clean-up
In Both Regions: Delete of VPC, EC2, EFS, AWS DataSync.

#Pricing
I review the pricing and estimated cost of this example. 

Cost of Elastic Compute Cloud = $1.06

Cost of Elastic File System = $0.05

Cost of Virtual Private Cloud = $0.05

Cost of AWS DataSync (DataSync fee for data copied) $0.0125 per GB = $0.0

Total Cost = $1.16

#Summary
In this post, I showed “how to cross region transfer of data from efs to efs using aws datasync”.

For more details on AWS DataSync, Checkout Get started AWS DataSync, open the [AWS DataSync console](https://us-west-2.console.aws.amazon.com/datasync/home?region=us-west-2#/getStarted). To learn more, read the [AWS DataSync documentation](https://docs.aws.amazon.com/datasync/?icmpid=docs_homepage_migration).

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)