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

gefragt vor 2 Jahren3076 Aufrufe
2 Antworten
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."

EXPERTE
beantwortet vor 2 Jahren
AWS
EXPERTE
überprüft vor 2 Jahren
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
EXPERTE
Rajiv_G
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen