aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

cross-account assumed-role doesnt work

Open dy10 opened this issue 9 years ago • 1 comments

From an EC2 instance running in Account-A, with role-A, i want to execute aws command to describe instances in account-B by assuming role-B, where role-A has permission to assume role-B

A detailed description of the problem posted by someone else is available at: https://serverfault.com/questions/841337/how-to-execute-aws-ec2-describe-instances-for-different-account

AWS CLI version is aws-cli/1.11.29 Python/2.7.12 Linux/4.9.20-11.31.amzn1.x86_64 botocore/1.5.66

When i tried the aws cli command with --debug, it gave following stacktrace

2017-06-13 11:41:04,892 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role 2017-06-13 11:41:04,892 - MainThread - botocore.credentials - DEBUG - Retrieving credentials via AssumeRole. 2017-06-13 11:41:04,892 - MainThread - awscli.clidriver - DEBUG - Exception caught in main() Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 197, in main return command_table[parsed_args.command](remaining, parsed_args) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 333, in call return command_table[parsed_args.operation](remaining, parsed_globals) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 503, in call call_parameters, parsed_globals) File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 620, in invoke verify=parsed_globals.verify_ssl) File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 825, in create_client credentials = self.get_credentials() File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 449, in get_credentials 'credential_provider').load_credentials() File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 1146, in load_credentials creds = provider.load() File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 842, in load return self._load_creds_via_assume_role() File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 861, in _load_creds_via_assume_role creds, response = self._retrieve_temp_credentials() File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 966, in _retrieve_temp_credentials client = self._create_client_from_config(config) File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 957, in _create_client_from_config 'sts', aws_access_key_id=source_cred_values['aws_access_key_id'], KeyError: 'aws_access_key_id' `

dy10 avatar Jun 13 '17 14:06 dy10

This is currently not supported, but something we want to support that is on our backlog. The tracking work for this is here: https://github.com/boto/botocore/pull/851

Closing as a dupe.

jamesls avatar Jun 13 '17 17:06 jamesls