1

Been having issues with this for the past hour at least, and so I hope someone can point me in the right direction. I am running a windows system using the AWS CLI through windows PowerShell.

I have numerous profiles setup on my system for AWS. Normally, it is not a problem but today it seems to be. I need to switch from my default profile to another profile. Currently when I run aws configure list I get the following output:

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                      nam           manual    --profile
access_key     ****************KBU2 shared-credentials-file
secret_key     ****************XLn7 shared-credentials-file
    region                us-east-1      config-file    ~/.aws/config

So my default profile is set to nam, which is good. However, I need to use my profile called "butterfly". And this is where I am getting stuck. I can see that my butterfly profile is setup correctly by using aws configure-list --profile butterfly which results in:

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                butterfly           manual    --profile
access_key     ****************FS7W shared-credentials-file
secret_key     ****************88vh shared-credentials-file
    region                us-east-1      config-file    ~/.aws/config

All the documentation that I have found has suggested that either set AWS_DEFAULT_PROFILE=butterfly or setx AWS_DEFAULT_PROFILE butterfly should do the trick. However, when I re-run aws configure list after setting, I am still getting the previous output and no profile change.

My end goal is I need to connect several IoT devices using AWS. If I run aws iot list-things I get an error exception error:

An error occurred (InvalidSignatureException) when calling the ListThings operation: The request signature we calculated does not match the signature you provided

That is fine and I am not concerned about that. However, if I adjust my call and add a profile aws iot list-things --profile butterfly I then get a list of my IoT devices. I will be using mongoose os part of the software on these boards. https://mongoose-os.com/docs/mongoose-os/cloud/aws.md Where I am getting stuck with the profile is on the second step "setup device", with the provision AWS IoT.

EDIT Looking at the link in the first comment, I tried to set all the variables individually with:

setx AWS_ACCESS_KEY_ID AKIAIOSFODNN7EXAMPLE
setx AWS_SECRET_ACCESS_KEY wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
setx AWS_DEFAULT_REGION us-west-2

That still didn't do anything as when I list I still have nam.

I am cleary missing a step, just not sure what.

Paul Carlson
  • 379
  • 5
  • 18
  • Which document are you looking at? AWS_DEFAULT_PROFILE is not listed [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html). Suspect this is legacy. Use AWS_PROFILE. – jarmod Aug 11 '23 at 00:47
  • @jarmod I have been looking at many different pages and SO answers. I got the idea for AWS_DEFAULT_PROFILE from this SO answer: https://stackoverflow.com/questions/31012460/how-do-i-set-the-name-of-the-default-profile-in-aws-cli. I also updated my question at the bottom. – Paul Carlson Aug 11 '23 at 00:56

1 Answers1

1

AWS_DEFAULT_PROFILE is not listed at Environment variables to configure the AWS CLI. It is no longer supported. Arguably, it never made a lot of sense in the first place.

Use AWS_PROFILE instead.

jarmod
  • 71,565
  • 16
  • 115
  • 122
  • Thank you for bringing my attention back to that. I have looked over that page, a bunch of times. Each time I was missing this one crucial sentence: " It does not affect any command shell that is already". I have been so busy and focused I never reset my console. – Paul Carlson Aug 11 '23 at 02:12