跳至內容

如何關閉對 Amazon Redshift 查詢編輯器的臨時憑證存取權?

1 分的閱讀內容
0

我想關閉對 Amazon Redshift 查詢編輯器的臨時憑證存取權。

簡短描述

您可以使用 AWS Secrets Manager 或 AWS Identity and Access Management (IAM) 臨時憑證,透過查詢編輯器存取 Amazon Redshift 叢集。若要使用臨時憑證連線,使用者可以使用資料庫使用者名稱或 IAM 身分。

如需詳細資訊,請參閱連線至 Amazon Redshift 資料庫

解決方法

若要建立 IAM 政策,以限制對 Amazon Redshift 查詢編輯器的臨時憑證存取權,請完成下列步驟:

  1. 開啟 IAM console (IAM 主控台)。

  2. 建立 IAM 角色

  3. 在導覽窗格中,選擇 Users (使用者)。

  4. User name (使用者名稱) 中,選擇您要用於禁止存取查詢編輯器的 IAM 使用者。

  5. 選擇 Permissions (權限) 索引標籤,然後選擇 Add inline policy (新增內嵌政策)。

  6. 選擇 JSON 政策索引標籤,然後貼上下列政策:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Deny",
                "Action": [
                    "redshift:GetClusterCredentialsWithIAM",
                    "redshift:GetClusterCredentials"
                ],
                "Resource": [
                    "arn:aws:redshift:*:<account-id>:dbgroup:*/*",
                    "arn:aws:redshift:*:<account-id>:dbname:*/*",
                    "arn:aws:redshift:*:<account-id>:dbuser:*/*"
                ]
            }
        ]
    }

    **注意:**將 account-id 替換為您的 AWS 帳戶 ID。

  7. 選擇 Review policy (檢閱政策)。

  8. Name (名稱) 中,輸入政策名稱,然後選擇 Create policy (建立政策)。

當具有臨時憑證的 IAM 使用者嘗試存取查詢編輯器時,他們會收到類似以下錯誤: 「無法列出資料庫」。

相關資訊

為什麼我無法連線至 Amazon Redshift 中的 AmazonRedshiftQueryEditor?

AWS 官方已更新 10 個月前