amazon-efs

How do i find all EC2 instances that are mounted to a specific EFS


I need to replace an EFS with an encrypted one. The plan is to copy all of its contents to S3, populate the new EFS with the S3 contents, and then unmount the old EFS and mount the new EFS in the same location.

The problem is, I do not know how to find all the EC2 instances that are mounted to that particular EFS. I've looked through the aws efs documentation and nothing looks like it does what I want.


Solution

  • There is no single place or command that lists the ec2 instances mounting an EFS.

    The next best thing I would suggest to do is use to use Cloudwatch dashboard with an EFS metric. There is one metric that shows you the number of EC2 instances that are connected to your EFS share: It is the Sum statistic of the ClientConnections metric under EFS.

    You can create a Cloudwatch dashboard easily -

    1. go to your CloudWatch console -> Dashboard Create Dashboard button.
    2. Name your Dashboard "EFS" and click Create Dashboard.
    3. Next step see type selection, select Line (first one) and click Configure: enter image description here
    4. Then select EFS under All Metrics tab on the bottom.
    5. click File System Metrics
    6. Then select Client Connections under the non encrpted EFS drive name that you are moving off of. Then click the create widget button. enter image description here

    The graph will be the number of connections to that. As you move EC2s off that non encrypted drive, this number should go down.

    The final dashboard will look something like:

    enter image description here