aws / efs-utils

Utilities for Amazon Elastic File System (EFS)
MIT License
285 stars 187 forks source link

Add crossaccount AZ-mapping mount option. #200

Closed seanzatzdev-amazon closed 6 months ago

seanzatzdev-amazon commented 6 months ago

Issue #, if available:

Description of changes: This PR adds the crossaccount mount option which can be used for cross-AWS-account mounts which require the client instance and EFS mount target to have the same availability zone ID/physical AZ location (e.g. use1-az1).

Tested via unit tests and manual testing:

[ec2-user@ip- ~]$ sudo mount -t efs -o crossaccount fs-redacted123:/ efs
[ec2-user@ip- ~]$ sudo umount efs
[ec2-user@ip- ~]$ sudo mount -t efs -o tls,crossaccount fs-redacted123:/ efs
[ec2-user@ip- ~]$ ls efs
hello.txt  out.txt
[ec2-user@ip- ~]$ sudo umount efs
[ec2-user@ip- ~]$ sudo mount -t efs -o tls,accesspoint=fsap-redacted123,crossaccount fs-redacted123:/ efs
[ec2-user@ip-192-168-0-254 ~]$ ls efs
hello.txt  out.txt
[ec2-user@ip- ~]$ sudo umount efs
[ec2-user@ip- ~]$ sudo mount -t efs -o tls,accesspoint=fsap-redacted123 fs-redacted123:/ efs
Failed to resolve "fs-redacted123.efs.ap-southeast-1.amazonaws.com" - check that your file system ID is correct, and ensure that the VPC has an EFS mount target for this file system ID.
See https://docs.aws.amazon.com/console/efs/mount-dns-name for more detail.
Attempting to lookup mount target ip address using botocore. Failed to import necessary dependency botocore, please install botocore first.
[ec2-user@ip- ~]$ sudo mount -t efs -o tls,accesspoint=fsap-redacted123,crossaccount fs-redacted123:/ efs
[ec2-user@ip- ~]$ ls efs
hello.txt  out.txt
[ec2-user@ip- ~]$ sudo umount efs

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.