TL;DR: An AWS SSO login was successful, but subsequent AWS commands failed with "No credentials found" because the shell alias was pointing to a profile name that didn't match the configured credential block in ~/.aws/config .
I wanted to automate my AWS authentication by creating an alias in my .zshrc to trigger the SSO login process. After running the command, the terminal reported Login successful , but any subsequent attempt to list S3 buckets or use the AWS CLI resulted in a credential error.
The issue stemmed from a mismatch between how the profile was defined in ~/.aws/config and how I was calling it via the CLI.
Here is the configuration block I had in my ~/.aws/config :
[profile 123456789012_AWSEngineerAccessRole] sso_start_url = https://your-org.awsapps.com/start sso_region = eu-west-2 sso_account_id = 123456789012 sso_role_name = AWSEngineerAccessRole region = eu-west-2
Enter fullscreen mode
Exit fullscreen mode
When I ran my login command, the output was:
Login successful
Enter…