[英]Error: FATAL NoCredentialProviders: no valid providers in chain caused by: EnvAccessKeyNotFound:
I was using aws-runas to run the following aws-cli command:我使用aws-runas运行以下 aws-cli 命令:
aws-runas xxx-prod aws s3 ls
I got the following error:我收到以下错误:
FATAL NoCredentialProviders: no valid providers in chain caused by: EnvAccessKeyNotFound:
failed to find credentials in the environment. SharedCredsLoad: failed to load profile, xxx-
prod. EC2RoleRequestError: no EC2 instance role found caused by: RequestError: send request
failed caused by: Get http://169.254.169.254/latest/meta-data/iam/security-credentials/:
net/http: request canceled (Client.Timeout exceeded while awaiting headers)
my ~/.aws/credentials file:我的~/.aws/credentials文件:
[default]
aws_access_key_id=ABC
aws_secret_access_key=XYZ
my ~/.aws/config file:我的~/.aws/config文件:
[default]
region = us-east-1
output = json
[profile xxx-prod]
role_arn=arn:aws:iam::11111111:role/managed-role/AcctAdmin
mfa_serial =arn:aws:iam::2222222:mfa/abc@gmail.com
I was missing the following line in my ~/.aws/config file:我的~/.aws/config文件中缺少以下行:
source_profile=default
Adding the above fixed the problem.添加以上解决了问题。
My complete ~/.aws/config file:我完整的~/.aws/config文件:
[default]
region = us-east-1
output = json
[profile xxx-prod]
source_profile=default
role_arn=arn:aws:iam::11111111:role/managed-role/AcctAdmin
mfa_serial =arn:aws:iam::2222222:mfa/abc@gmail.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.