从 EC2 安装到 EFS 时出现 AWS Key 错误

问题描述 投票:0回答:3

我正在尝试使用 mount 命令将 EC2 堡垒上的目录挂载到 AWS EFS。我正在使用 EFS documentation 并尝试以下命令,

   sudo mount -t efs -o tls,iam,accesspoint=fsap-xxx fs-xxx: /myDirThatINeedToMountOnRoot

这样做后,我得到,

AWS Access Key ID and Secret Access Key are not found in AWS credentials file (/root/.aws/credentials), config file (/root/.aws/config), from ECS credentials relative uri, or from the instance security credentials service

此外,我还检查了 ~/.aws/credentials 和 ~/.aws/config

一切都在现场。请问有什么指导吗?

amazon-web-services amazon-ec2 deployment configuration amazon-efs
3个回答
1
投票

先决条件:

  1. 设置 IAM 用户 (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html);创建访问密钥 (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey))
  2. 向 IAM 用户添加允许 AmazonElasticFileSystemClientFullAccess 的策略 (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html)
  3. 在 EC2 实例上安装 AWS CLI https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

然后: 有了访问密钥,在 EC2 上运行 aws configure 并设置凭证 (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)

这将保存它正在寻找的凭证文件;但是,凭证文件位于用户的主目录 (.aws/) 中。因此,将 .aws 目录从 /home 移动或复制到 /root


0
投票

删除给定cmd中的iam选项。

您的命令将如下所示 ->

sudo mount -t efs -o tls,accesspoint=fsap-xxx fs-xxx: /myDirThatINeedToMountOnRoot

0
投票

sudo mount -t efs -o tls,(iam: 这就是问题,删除它),accesspoint=fsap-xxx fs-xxx: /myDirThatINeedToMountOnRoot

这样做 sudo mount -t efs -o tls,accesspoint=fsap-xxx fs-xxx: /myDirThatINeedToMountOnRoot

© www.soinside.com 2019 - 2024. All rights reserved.