Using redshift-data boto3 to make cross account redshift calls

0

HI

I am using Boto3 - redshift-data to connect/query to Redshift.

I would like to connect to a redshift cluster in a different account. Where do I set the account id or URL for cross account Redshift query ?

Currently I am doing:

redshift_client_data = boto3.client('redshift-data')
test_query = redshift_client_data.execute_statement(
        ClusterIdentifier='rs-****-d1',
        Database='dw1',
        DbUser='username',

        Sql='select * from ***.address_data limit 35;',

    )

How do we modify clusterIdentifier to do cross account calls ? Thanks

asked 2 years ago2995 views
2 Answers
0

See https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html : "To run a query on a cluster that is owned by another account, the owning account must provide an IAM role that the Data API can assume in the calling account."

EXPERT
answered 2 years ago
AWS
EXPERT
reviewed 2 years ago
0

You can/should specify and API KEY & ID when you're constructing your client which refers to an identity in the target account.

redshift_client = boto3.client('redshift-data',
            aws_access_key_id='abc',
            aws_secret_access_key='123'
        )
profile pictureAWS
EXPERT
Rajiv_G
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions