Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross account assumed role references wrong table #227

Open
atharvai opened this issue Nov 20, 2018 · 0 comments
Open

Cross account assumed role references wrong table #227

atharvai opened this issue Nov 20, 2018 · 0 comments

Comments

@atharvai
Copy link

I'm using assumed role and passing the keys to credstash along with session token. All this in Python (not CLI). However I'm unable to query the dynamoDB table correctly.

Code:

import boto3
import credstash

sts_client = boto3.client('sts')
_assumed_role = sts_client.assume_role(
        RoleArn="arn:aws:iam::ACCOUNT_A:role/CredstashRole",
        RoleSessionName="AssumeRoleSession1"
)
credstash.getSecret(property_name, version or '',
                                                     region='us-east-1',
                                                     table='credential-store,
                                                     aws_access_key_id=_assumed_role['Credentials']['AccessKeyId'],
                                                     aws_secret_access_key=_assumed_role['Credentials']['SecretAccessKey'],
                                                     aws_session_token=_assumed_role['Credentials']['SessionToken']
                                                     )

Error:

User: arn:aws:sts::ACCOUNT_B:assumed-role/CrossAccountCredstashRole not authorized to perform: dynamodb:Scan on resource: arn:aws:dynamodb:us-east-1:ACCOUNT_B:table/credential-store

It appears credstash is trying to query ACCOUNT_B table when it actually exists in ACCOUNT_A. If I specify table=<table_arn_ACCOUNT_A> I get validation error:

An error occurred (ValidationException) when calling the Scan operation: 1 validation error detected: Value 'arn:aws:dynamodb:us-east-1:ACCOUNT_A:table/credential-store' at 'tableName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.-]+

ref: https://github.com/fugue/credstash/wiki/Setting-up-cross-account-access

any way to resolve this?

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

No branches or pull requests

1 participant