IAM Identity Center 对 Amazon OpenSearch 无服务器的支持 - Amazon OpenSearch Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

IAM Identity Center 对 Amazon OpenSearch 无服务器的支持

IAM Identity Center 对 Amazon OpenSearch 无服务器的支持

您可以使用 IAM Identity Center 主体(用户和群组)通过 Amazon OpenSearch 应用程序访问 Amazon OpenSearch 无服务器数据。要启用 IAM Identity Center 对 Amazon OpenSearch 无服务器的支持,您需要启用 IAM Identity Center。要了解有关如何执行此操作的更多信息,请参阅 What is IAM Identity Center?

创建 IAM Identity Center 实例后,客户账户管理员需要为 Amazon OpenSearch 无服务器服务创建 IAM Identity Center 应用程序。这可以通过调用 CreateSecurityConfig: 完成。客户账户管理员可指定用于授权请求的属性。使用的默认属性是 UserIdGroupId.

适用于 Amazon OpenSearch 无服务器的 IAM Identity Center 集成使用以下 Amazon IAM Identity Center(IAM)权限:

  • aoss:CreateSecurityConfig:创建 IAM Identity Center 提供程序

  • aoss:ListSecurityConfig:列出当前账户中的所有 IAM Identity Center 提供程序。

  • aoss:GetSecurityConfig:查看 IAM Identity Center 提供程序信息。

  • aoss:UpdateSecurityConfig:修改给定的 IAM Identity Center 配置

  • aoss:DeleteSecurityConfig:删除 IAM Identity Center 提供程序。

以下基于身份的访问策略可用于管理所有 IAM Identity Center 配置:

JSON
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "aoss:CreateSecurityConfig", "aoss:DeleteSecurityConfig", "aoss:GetSecurityConfig", "aoss:UpdateSecurityConfig", "aoss:ListSecurityConfigs" ], "Effect": "Allow", "Resource": "*" } ] }
注意

Resource 元素必须是通配符。

创建 IAM Identity Center 提供程序(控制台)

您可以创建 IAM Identity Center 提供程序,以便使用 OpenSearch 应用程序启用身份验证。要为 OpenSearch 控制面板启用 IAM Identity Center 身份验证,请执行以下步骤:

  1. 登录到 Amazon OpenSearch Service 控制台。

  2. 在左侧导航面板上,展开无服务器,然后选择身份验证

  3. 选择 IAM Identity Center 身份验证

  4. 选择编辑

  5. 选中“使用 IAM Identity Center 进行身份验证”旁边的复选框。

  6. 从下拉菜单中选择用户和组属性键。用户属性将用于根据 UserNameUserIdEmail 对用户进行授权。组属性将用于根据 GroupNameGroupId 对用户进行身份验证。

  7. 选择 IAM Identity Center 实例。

  8. 选择保存

创建 IAM Identity Center 提供程序(Amazon CLI)

要通过 Amazon Command Line Interface(Amazon CLI)创建 IAM Identity Center 提供程序,请使用以下命令:

aws opensearchserverless create-security-config \ --region us-east-2 \ --name "iamidentitycenter-config" \ --description "description" \ --type "iamidentitycenter" \ --iam-identity-center-options '{ "instanceArn": "arn:aws:sso:::instance/ssoins-99199c99e99ee999", "userAttribute": "UserName", "groupAttribute": "GroupId" }'

启用 IAM Identity Center 后,客户仅可修改用户和组属性。

aws opensearchserverless update-security-config \ --region us-east-1 \ --id <id_from_list_security_configs> \ --config-version <config_version_from_get_security_config> \ --iam-identity-center-options-updates '{ "userAttribute": "UserId", "groupAttribute": "GroupId" }'

要通过 Amazon Command Line Interface 查看 IAM Identity Center 提供商,请使用以下命令:

aws opensearchserverless list-security-configs --type iamidentitycenter

删除 IAM Identity Center 提供程序

IAM Identity Center 提供两个提供程序实例,一个用于组织账户,另一个用于成员账户。如果要更改 IAM Identity Center 实例,则需通过 DeleteSecurityConfig API 删除安全配置,并使用新的 IAM Identity Center 实例创建新的安全配置。要删除 IAM Identity Center 提供程序,可使用以下命令:

aws opensearchserverless delete-security-config \ --region us-east-1 \ --id <id_from_list_security_configs>

授予 IAM Identity Center 访问集合数据的权限

启用 IAM Identity Center 提供程序后,您可以更新集合数据访问策略,以包含 IAM Identity Center 主体。需要按以下格式更新 IAM Identity Center 主体:

[ { "Rules":[ ... ], "Principal":[ "iamidentitycenter/<iamidentitycenter-instance-id>/user/<UserName>", "iamidentitycenter/<iamidentitycenter-instance-id>/group/<GroupId>" ] } ]
注意

Amazon OpenSearch 无服务器仅支持单个 IAM Identity Center 实例管理所有客户集合,且单个用户最多可支持 100 个组。如果尝试使用超过允许的实例数量,您将遇到与数据访问策略授权处理不一致的情况,并收到 403 错误消息。

您可以授予针对集合、索引或两者的访问权限。如果您希望不同用户拥有不同权限,您将需要创建多条规则。有关可用权限的列表,请参阅 Amazon OpenSearch Service 中的 Identity and Access Management。有关如何设置访问策略格式的信息,请参阅授予 SAML 身份访问集合数据的权限

IAM Identity Center 提供两个提供程序实例,一个用于组织账户,另一个用于成员账户。如果要更改 IAM Identity Center 实例,则需通过 DeleteSecurityConfig API 删除安全配置,并使用新的 IAM Identity Center 实例创建新的安全配置。要删除 IAM Identity Center 提供程序,可使用以下命令:

aws opensearchserverless delete-security-config \ --region us-east-1 \ --id <id_from_list_security_configs>