This script sets AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN (where applicable) from
the values configured in ~/.aws/config and ~/.aws/credentials
This is useful for cases where the tool being used doesn't support --profile
being passed in, i.e. most unit/system tests
It also can handle cases where the credentials aren't static (i.e. assume-role giving temporary credentials), it uses the awscli's implementation to resolve and cache those credentials. This is very handy for when a tool is using the aws-sdk to load credentials and can read the AWS_PROFILE environment variable but can't handle the assume-role, usuaully due to an MFA prompt. In those cases it would reolve the tokens and set them as env vars. Calling it again would refersh them if required.