

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 Python UDF。现有的 Python UDF 将继续正常运行至 2026 年 6 月 30 日。有关更多信息，请参阅[博客文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

# 使用 IAM 策略管理对数据共享 API 操作的访问
<a name="iam-policy"></a>

要控制对数据共享 API 操作的访问，请使用基于 IAM 操作的策略。有关如何管理 IAM 策略的信息，请参阅《IAM 用户指南》**中的[管理 IAM 策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage.html)。

有关使用数据共享 API 操作所需的权限信息，请参阅《Amazon Redshift 管理指南》**中的[使用数据共享 API 操作所需的权限](https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html)。

为了提高跨账户数据共享的安全性，您可以将条件键 `ConsumerIdentifier` 用于 `AuthorizeDataShare` 和 `DeauthorizeDataShare` API 操作。这样您就可以明确控制哪些 AWS 账户 可以调用两个 API 操作。

您可以拒绝授权或取消授权任何不属于您自己账户的使用者数据共享。为此，请指定 IAM 策略中的 AWS 账户 数字。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Deny",
            "Action": [
                "redshift:AuthorizeDataShare",
                "redshift:DeauthorizeDataShare"
            ],
            "Resource": "*",
            "Condition": {
                "StringNotEquals": {
                    "redshift:ConsumerIdentifier": "555555555555"
                }
            }
        }
    ]
}
```

------

您可以允许拥有 DataShareArn **testshare2** 的创建者明确与拥有 IAM 策略中 111122223333 的 AWS 账户 使用者共享。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "redshift:AuthorizeDataShare",
                "redshift:DeauthorizeDataShare"
            ],
            "Resource": "arn:aws:redshift:us-east-1:666666666666:datashare:af06285e-8a45-4ee9-b598-648c218c8ff1/testshare2",
            "Condition": {
                "StringEquals": {
                    "redshift:ConsumerIdentifier": "111122223333"
                }
            }
        }
    ]
}
```

------