- Newest
- Most votes
- Most comments
It turns out the issue was that the SignInLocalDevelopmentAccess policy was disabled for my group. Enabling it allowed me to sign in and the issue is resolved.
It sounds like you're experiencing an issue with the AWS CLI authentication process. This problem could be occurring for several reasons:
-
Credential Configuration Issues: There might be a mismatch between your configured credentials and the authentication method you're trying to use. The "400 - Bad Request" error often indicates that something in the authentication request is malformed or invalid.
-
SSO vs. IAM User Credentials: Your error suggests you might be mixing authentication methods. If your organization uses IAM Identity Center (formerly AWS SSO), but you've configured the CLI with IAM user credentials (or vice versa), this can cause authentication failures.
-
Expired or Invalid Tokens: If you're using SSO authentication, your tokens may have expired. The CLI attempts to refresh these tokens automatically, but sometimes this process fails.
-
Browser Session Issues: Since the authentication is happening through a browser, there could be issues with cookies, cache, or session data interfering with the process.
Here are some steps to troubleshoot and resolve this issue:
-
Clear Browser Cache: Try clearing your browser's cookies and cache, or use an incognito/private browsing window when the CLI opens the authentication page.
-
Check Configuration: Run
aws configure listto verify what credentials and region are actually being used by your CLI. -
Delete AWS Credentials Folder: If you suspect there might be conflicting or corrupted credential files, try deleting the
.awsfolder from your user home directory and reconfigure your credentials. -
Verify Authentication Method: Ensure you're using the correct authentication method for your account setup. If you're using SSO, you should configure the CLI with
aws configure ssorather than justaws configure. -
Check Time Synchronization: Ensure your system clock is accurately synchronized, as AWS authentication is time-sensitive.
If these steps don't resolve the issue, you might need to contact AWS Support for further assistance, as there could be an account-specific problem that requires their intervention.
Sources
Problem with credentials when working with AWS CLI commands | AWS re:Post
Why doesn't my AWS CLI work? | AWS re:Post
You can also try logging in private or incognito mode and retry. Also, if you have setup profiles, make sure you use the profile in your login command.
