Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

amazon web services - AWS command line - unable to locate credentials - when specifying profile

I have multiple profiles set up in my .awscredentials file.

From the Windows 10 command line I have tried two approaches as per https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

aws cp s3://bucketname etc... --profile profile1

setx AWS_PROFILE profile1 aws cp etc...

Both cases give me "unable to locate credentials" on each file that is being uploaded to S3.

I use these profiles in Python with no issue.

This is the output of the "aws configure list" command:

C:Users
walt>aws configure list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key                <not set>             None    None
secret_key                <not set>             None    None
    region                us-east-1      config-file    ~/.aws/config

but if I type "aws configure list --profile profile", then I see the profile name, and keys filled in.

question from:https://stackoverflow.com/questions/65904486/aws-command-line-unable-to-locate-credentials-when-specifying-profile

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Turns out, I was not reading carefully. After adding the --profile profile1, the error changed to "access denied", which is something totally different.

I'm leaving the question though, because it might help someone see how to work with multiple profiles.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...