Lab7a: Mounting EFS to multiple EC2 instances using AWS 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 AWS Systems Manager Run Command. For more information about AWS Systems Manager Run Command, see AWS Systems Manager run command in the AWS Systems Manager User Guide. The following prerequisites are required before mounting EFS file systems using this method:
- 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. - Version 1.28.1 or later of the Amazon EFS client (amazon-efs-utils package) is installed on the EC2 instances. You can use AWS 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
- Open the AWS Systems Manager console at https://console.aws.amazon.com/systems-manager/.
- In the navigation pane, choose Run Command.
- Choose Run a command.
- Enter
AWS-RunShellScript
in the Commands search field. - Select AWS-RunShellScript.
- 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
- Select the target AWS Systems Manager managed EC2 instances that you want the command to run on.
- 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.