Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

SharedCredentials not loading credentials if profile is a role #222

Closed
mikelorant opened this issue Aug 24, 2015 · 1 comment
Closed

SharedCredentials not loading credentials if profile is a role #222

mikelorant opened this issue Aug 24, 2015 · 1 comment

Comments

@mikelorant
Copy link

When trying to use Aws::SharedCredentials, I am finding that if the profile is assuming a role, that the access keys are being set to nil.

The file ~/.aws/credentials.

[default]
aws_access_key_id = id
aws_secret_access_key = key

[example]
role_arn = arn:aws:iam::12345678:role/example
source_profile = default

Working:

Aws> credentials = Aws::SharedCredentials.new(profile_name: 'default')
=> #<Aws::SharedCredentials profile_name="default" path="/home/user/.aws/credentials">
Aws> credentials.credentials
=> #<Aws::Credentials access_key_id="id">

Failing:

Aws> credentials = Aws::SharedCredentials.new(profile_name: 'example')
=> #<Aws::SharedCredentials profile_name="example" path="/home/user/.aws/credentials">
Aws> credentials.credentials
=> #<Aws::Credentials access_key_id=nil>

When I try to use the credentials I get the following error:

Aws::CloudFormation::Client.new(credentials: Aws::SharedCredentials.new(profile_name: 'example')).describe_stacks
Aws::Errors::MissingCredentialsError: unable to sign request without credentials set

Is this the correct way to assume a role that is an existing profile? Otherwise, what is the best way to deal with this?

@mikelorant
Copy link
Author

Moved to issue to correct repository.

aws/aws-sdk-ruby#910

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant