aws-clivscode-extensionsaws-samaws-toolkit

AWS Toolkit vscode extension, Connect Using AWS Identity Center keeps trying to access the wrong region


I installed the extension AWS Toolkit for VScode. My IAM Identity Center Users, Groups, etc were all created in us-east-2.
enter image description here

But for some reason AWS keeps trying to route me through us-east-1 even though this causes an invalid_grant Invalid grant provided error. I tried setting the region for AWS Toolkit to us-east-2:
enter image description here

enter image description here

After setting the region to us-east-2, I tried to connect via AWS Identity Center.
enter image description here

But it still directs me to https://device.sso.us-east-1.amazonaws.com/ to enter in my auth code. Notice the us-east-1 in the url instead of us-east-2. When I enter in the auth code, I get the dreaded invalid_grant Invalid grant provided error:
enter image description here

So how do I force it to use us-east-2 instead of us-east-2? It seems to ignore the fact that I set the region to us-east-2.


Solution

  • It looks like you are trying to use a credentials profile configured to use AWS IAM Identity Center (AWS SSO). This profile may not be configured to refer to the region where your SSO portal is defined.

    Check your credentials files (~/.aws/credentials and/or ~/.aws/config) for the credentials profile of interest. This profile should contain a sso_region property that is assigned to the region where your SSO portal is (us-east-2 in your case).