Skip to content

Commit b39929f

Browse files
Added EFS Accesspoint Ids to mount commands (aws#2791)
* improved mount commands to include the accesspoint id option --------- Co-authored-by: Ryan Anderson <[email protected]>
1 parent 00e1aa8 commit b39929f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

cookbooks/aws-parallelcluster-environment/recipes/config/update_shared_storages.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# get efs to unmount
3838
node.default['cluster']['unmount_efs_shared_dir_array'], node.default['cluster']['unmount_efs_fs_id_array'], = get_efs(UNMOUNT_ACTION)
3939
# get efs to mount
40-
node.default['cluster']['mount_efs_shared_dir_array'], node.default['cluster']['mount_efs_fs_id_array'], node.default['cluster']['mount_efs_encryption_in_transit_array'], node.default['cluster']['mount_efs_iam_authorization_array'] = get_efs(MOUNT_ACTION)
40+
node.default['cluster']['mount_efs_shared_dir_array'], node.default['cluster']['mount_efs_fs_id_array'], node.default['cluster']['mount_efs_encryption_in_transit_array'], node.default['cluster']['mount_efs_iam_authorization_array'], node.default['cluster']['mount_efs_access_point_array'] = get_efs(MOUNT_ACTION)
4141
# get fsx to unmount
4242
node.default['cluster']['unmount_fsx_fs_id_array'], node.default['cluster']['unmount_fsx_fs_type_array'], node.default['cluster']['unmount_fsx_shared_dir_array'], node.default['cluster']['unmount_fsx_dns_name_array'], node.default['cluster']['unmount_fsx_mount_name_array'], node.default['cluster']['unmount_fsx_volume_junction_path_array'] = get_fsx(UNMOUNT_ACTION)
4343
# get fsx to mount
@@ -78,6 +78,7 @@ def get_efs(action)
7878
efs_fs_id_array = []
7979
efs_encryption_in_transit_array = []
8080
efs_iam_authorization_array = []
81+
efs_access_point_id_array = []
8182
unless in_shared_storages_mapping["efs"].nil?
8283
in_shared_storages_mapping["efs"].each do |storage|
8384
next unless not_in_shared_storages_mapping["efs"].nil? || !not_in_shared_storages_mapping["efs"].include?(storage)
@@ -86,9 +87,10 @@ def get_efs(action)
8687
# The EFS resource expects strings for these attributes, not booleans
8788
efs_encryption_in_transit_array.push(String(storage["efs_encryption_in_transit"]))
8889
efs_iam_authorization_array.push(String(storage["efs_iam_authorization"]))
90+
efs_access_point_id_array.push(String(storage["efs_access_point_id"]))
8991
end
9092
end
91-
[shared_dir_array, efs_fs_id_array, efs_encryption_in_transit_array, efs_iam_authorization_array]
93+
[shared_dir_array, efs_fs_id_array, efs_encryption_in_transit_array, efs_iam_authorization_array, efs_access_point_id_array]
9294
end
9395

9496
def get_fsx(action)

cookbooks/aws-parallelcluster-environment/resources/efs/partial/_mount_umount.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,18 @@
4343

4444
# See reference of mount options: https://docs.aws.amazon.com/efs/latest/ug/automount-with-efs-mount-helper.html
4545
mount_options = "_netdev,noresvport"
46-
if efs_access_point_id
47-
mount_options = "iam,tls,access_point=#{efs_access_point_id}"
48-
elsif efs_encryption_in_transit == "true"
46+
if efs_encryption_in_transit == "true"
4947
mount_options += ",tls"
48+
# iam authorization requires tls
5049
if efs_iam_authorization == "true"
5150
mount_options += ",iam"
5251
end
52+
# accesspoint requires tls
53+
if efs_access_point_id && efs_access_point_id != ''
54+
mount_options += ",accesspoint=#{efs_access_point_id}"
55+
end
5356
end
57+
5458
mount_point = efs_mount_point_array.nil? ? "/" : efs_mount_point_array[index]
5559

5660
# Create the EFS shared directory

0 commit comments

Comments
 (0)