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

preguntada hace 2 años3076 visualizaciones
2 Respuestas
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."

EXPERTO
respondido hace 2 años
AWS
EXPERTO
revisado hace 2 años
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
EXPERTO
Rajiv_G
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas