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

질문됨 2년 전3076회 조회
2개 답변
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."

전문가
답변함 2년 전
AWS
전문가
검토됨 2년 전
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
전문가
Rajiv_G
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인