Mounting EFS to multiple EC2 instances using Amazon Systems Manager - Amazon Elastic File System
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Mounting EFS to multiple EC2 instances using Amazon Systems Manager

You can mount EFS file systems to multiple Amazon EC2 instances remotely and securely without having to log in to the instances by using the Amazon Systems Manager Run Command. For more information about Amazon Systems Manager Run Command, see Amazon Systems Manager run command in the Amazon Systems Manager User Guide. The following prerequisites are required before mounting EFS file systems using this method:

  1. The EC2 instances are launched with an instance profile that includes the AmazonElasticFileSystemsUtils permissions policy. For more information, see Step 1: Configure an IAM instance profile with the required permissions.

  2. Version 1.28.1 or later of the Amazon EFS client (amazon-efs-utils package) is installed on the EC2 instances. You can use Amazon Systems Manager to automatically install the package on your instances. For more information, see Step 2: Configure an Association used by State Manager for installing or updating the Amazon EFS client.

To mount multiple EFS file systems to multiple EC2 instances using the console
  1. Open the Amazon Systems Manager console at https://console.amazonaws.cn/systems-manager/.

  2. In the navigation pane, choose Run Command.

  3. Choose Run a command.

  4. Enter Amazon-RunShellScript in the Commands search field.

  5. Select Amazon-RunShellScript.

  6. In Command parameters enter the mount command to use for each EFS file system that you want to mount. For example:

    sudo mount -t efs -o tls fs-12345678:/ /mnt/efs sudo mount -t efs -o tls,accesspoint=fsap-12345678 fs-01233210 /mnt/efs

    For more information about EFS mount commands using the Amazon EFS client, see Mounting on Amazon EC2 Linux instances using the EFS mount helper or Mounting on Amazon EC2 Mac instances using the EFS mount helper.

  7. Select the target Amazon Systems Manager managed EC2 instances that you want the command to run on.

  8. Make any other additional settings you would like. Then choose Run to run the command and mount the EFS file systems specified in the command.

    Once you run the command, you can see its status in the command history.