Is it possible to use profile from aws config files (.aws and configuration) directly in Go app, without setting any environment variables, like AWS_SDK_LOAD_CONFIG, AWS_PROFILE or any other environment variable containing plain text credentials?
region := "xxxxxx"
profile := "xxxxxx"
sess, err := session.NewSessionWithOptions(session.Options{
Config: aws.Config{Region: aws.String(region),
CredentialsChainVerboseErrors: aws.Bool(true)},
Profile: profile,
})
Response is this:
NoCredentialProviders: no valid providers in chain
caused by: EnvAccessKeyNotFound: failed to find credentials in the environment.
SharedCredsLoad: failed to load profile, xxxxxxxxxx.
EC2RoleRequestError: no EC2 instance role found
caused by: RequestError: send request failed