AWS - Redshift -跨賬號導入 S3 數據

Redshift 跨賬號導入 S3 數據

在 S3 桶賬戶中,

  1. 創建可讀取S3的 策略。
  2. 建一個關聯其他賬號的role,並將(1)中建的策略附給role。

在redshift賬號中

  1. 創建策略,將以下內容輸入到json選項卡
{
    "Version": "2012-10-17",
    "Statement": [
            {
            "Sid": "CrossAccountPolicy",
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "ARN_for_S3_Role"
        }
    ]
}

ARN_for_S3_Role 爲在S3賬戶中建立的role的ARN

  1. 創建 Redshift 服務的 role,將(1)中的策略附給 role
  2. 將(2) 中的role 與redshift 關聯。

在 Redshift中執行 copy

copy test_s3
from 's3://chen-rs/test01.csv'
iam_role 'arn:aws-cn:iam::000000000000:role/chen-rs-role,arn:aws-cn:iam::111111111111:role/chen-rs-s3-role'
delimiter ',';
INFO:  Load into table 'test_s3' completed, 2 record(s) loaded successfully.
COPY

https://amazonaws-china.com/cn/premiumsupport/knowledge-center/redshift-s3-cross-account/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章