diff --git a/README.md b/README.md index 9335eae4..43bfb698 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,12 @@ The access point must be in the "available" state before it can be used to mount $ sudo mount -t efs -o tls,accesspoint=access-point-id file-system-id efs-mount-point/ ``` +To not use the DNS name in the mount command, and force the use of the resolved IP instead. This option requires that `fall_back_to_mount_target_ip_address_enabled = true` is set in efs-utils.conf under the `[mount]` section. + +```bash +$ sudo mount -t efs -o forceuseip file-system-id efs-mount-point/ +``` + To mount your file system automatically with any of the options above, you can add entries to `/efs/fstab` like: ```bash diff --git a/src/mount_efs/__init__.py b/src/mount_efs/__init__.py index 5c19edca..784cc22c 100755 --- a/src/mount_efs/__init__.py +++ b/src/mount_efs/__init__.py @@ -220,6 +220,7 @@ "awsprofile", "az", "cafile", + "forceuseip", "iam", "mounttargetip", "netns", @@ -2343,13 +2344,18 @@ def _validate_replacement_field_count(format_str, expected_ct): ip_address=ip_address, fallback_message=fallback_message ) - if dns_name_can_be_resolved(dns_name): - return dns_name, None + if "forceuseip" not in options: + if dns_name_can_be_resolved(dns_name): + return dns_name, None - logging.info( - "Failed to resolve %s, attempting to lookup mount target ip address using botocore.", - dns_name, - ) + logging.info( + "Failed to resolve %s, attempting to lookup mount target ip address using botocore.", + dns_name, + ) + else: + logging.info( + "Forcing the use of IP address in the mount. Attempting to lookup mount target ip address using botocore." + ) try: fallback_mount_target_ip_address = get_fallback_mount_target_ip_address(