What am I doing wrong here?
My %UserProfile%.aws\config file looks like this:
[profile foo]
output = json
region = us-east-1
My %UserProfile%.aws\credentials file looks like this:
[foo]
aws_access_key_id = BAOAIGKMPRBTLBNOSCZQ
aws_secret_access_key = OcML0LadbbD3Nt+PmAlhzNTmoS6Xx9M3M6DkBx4m
So there is no default profile configured: I want to set only for the Powershell session.
In Powershell I run:
set AWS_PROFILE=foo
Then I try to execute a cli command, but it says it cannot find the credentials:
PS D:\> aws ec2 describe-instances
You must specify a region. You can also configure your region by running "aws configure".
PS D:\> aws ec2 describe-instances --region us-east-1
Unable to locate credentials. You can configure credentials by running "aws configure".
Ah, I figured out that in Powershell you can't set environment variables using the set
command. (Aside: I wonder what Powershell thinks it's doing when you use the set
command... it doesn't give an error message).
The correct way is:
$env:AWS_PROFILE="foo"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With