While working on Hoist, I wanted its Bedrock credential check to work with a named AWS profile. The probe could use credentials passed to it or read a key pair from the environment. With the key pair only in the shared credentials file, it returned NoCredentialProviders. The CLI and desktop app now also look in the profile selected by AWS_PROFILE.
The case worth testing was a partial environment. If it contains an access key and a session token but no secret key, the CLI skips that source and uses the complete set from the file. The token stays with the key pair it came from. The regression test gives the probe a token in the environment and a key pair in the file, then checks that the request uses the file's key and carries no session token. It uses a local HTTP fixture and dummy credentials.
Region follows its own lookup. The CLI uses a supplied region, then AWS_REGION or AWS_DEFAULT_REGION, then the selected profile's region in the shared config file, and finally us-east-1. For a named profile, the same name has two spellings on disk. [team-dev] belongs in ~/.aws/credentials and [profile team-dev] belongs in ~/.aws/config.1
Both changes merged with the app and CLI checks passing. This covers key pairs already present in the environment or shared credentials file. SSO login and role assumption are outside this change.