我如何找到安装到特定 EFS 的所有 EC2 实例

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

我需要用加密的 EFS 替换 EFS。计划是将其所有内容复制到 S3,用 S3 内容填充新 EFS,然后卸载旧 EFS 并将新 EFS 安装在同一位置。

问题是,我不知道如何找到安装到该特定 EFS 的所有 EC2 实例。我查看了 aws efs 文档,但没有任何内容符合我的要求。

没有一个地方或命令可以列出安装 EFS 的 ec2 实例。

我建议做的下一个最好的事情是将 Cloudwatch 仪表板与 EFS 指标结合使用。 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.

您可以轻松创建 Cloudwatch 仪表板 -

  1. 转到您的 CloudWatch 控制台 -> 仪表板创建仪表板按钮。
  2. 将您的仪表板命名为 "EFS" 并单击创建仪表板。
  3. 下一步请参阅类型 selection,select 行(第一个)并单击配置:
  4. 然后 select 位于底部“所有指标”选项卡下的 EFS。
  5. 单击文件系统指标
  6. 然后 select 客户端连接在您要退出的非加密 EFS 驱动器名称下。然后单击创建小部件按钮。

图表将是连接数。当您将 EC2 移出非加密驱动器时,这个数字应该会下降。

最终的仪表板将类似于: