View a markdown version of this page

跨帳戶資料存取 OpenSearch 網域 - Amazon OpenSearch Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

跨帳戶資料存取 OpenSearch 網域

您可以在一個帳戶中設定 OpenSearch UI 應用程式,以存取不同帳戶中的 OpenSearch 網域。當您使用跨帳戶資料來源建立 OpenSearch UI 應用程式時,您會提供iamRoleForDataSourceArn指向目標帳戶中 IAM 角色的 。OpenSearch UI 透過擔任此角色並呼叫 es:DescribeDomain 來驗證網域可存取性來驗證請求。跨帳戶角色僅在資料來源關聯期間使用。資料平面存取是由目標網域的存取政策單獨控制。

跨帳戶資料來源支援需要在目標網域上啟用精細存取控制。精細存取控制提供網域存取政策以外的額外授權層,可讓您控制對個別索引、文件和欄位的存取。

重要概念

來源帳戶

AWS 帳戶 託管 OpenSearch UI 應用程式的 。

目標帳戶

AWS 帳戶 OpenSearch 網域所在的 。

跨帳戶角色

目標帳戶中的 IAM 角色,僅在資料來源關聯期間使用。OpenSearch UI 會擔任此角色來呼叫 es:DescribeDomain,這會擷取網域端點並驗證是否已啟用精細存取控制。這是探索和驗證步驟,而不是安全界限。跨帳戶角色永遠不會用於資料平面存取。關聯後,所有資料平面請求都會由網域的存取政策和後端角色映射授權,與跨帳戶角色無關。

IAM Identity Center 應用程式角色

來源帳戶中的 IAM 角色,用於 IAM Identity Center 使用者資料平面存取。

跨帳戶角色假設的運作方式

當您使用跨帳戶資料來源建立或更新 OpenSearch UI 應用程式時,OpenSearch UI 會使用轉送存取工作階段 (FAS) 在目標帳戶中擔任跨帳戶角色。FAS 會將呼叫主體自己的 IAM 身分傳播到sts:AssumeRole呼叫。這表示:

  • 目標帳戶的信任政策會控制哪些來源帳戶主體可以擔任跨帳戶角色。

  • 擔任的角色工作階段會攜帶啟動 CreateApplicationUpdateApplication請求的發起人身分。

  • 只有在呼叫 的關聯期間,才會擔任跨帳戶角色es:DescribeDomain。它不會用於任何後續的資料平面操作。

對於資料平面存取:

  • IAM 使用者使用自己的 IAM 登入資料簽署請求。目標網域的存取政策會直接授權這些請求。

  • IAM Identity Center 使用者使用來源帳戶中的 IAM Identity Center 應用程式角色 (iamRoleForIdentityCenterApplicationArn) 簽署其請求。目標網域的存取政策和後端角色映射會授權這些請求。

先決條件

設定跨帳戶資料存取之前,請確定您有下列項目:

  • AWS CLI 已安裝和設定

  • 同時存取來源和目標 AWS 帳戶

  • 已啟用精細存取控制的 OpenSearch 網域。沒有精細存取控制的網域不支援跨帳戶資料來源關聯。

  • 對於 IAM Identity Center 流程: AWS IAM Identity Center 組織執行個體

案例

選擇符合您身分驗證方法和網域組態的案例:

案例 1:存取公有網域的 IAM 使用者

步驟 1:建立跨帳戶 IAM 角色 (目標帳戶)

在目標帳戶中建立 IAM 角色,允許來源帳戶擔任該角色進行網域驗證。

建立跨帳戶角色
  1. 建立允許來源帳戶擔任角色的信任政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:root" }, "Action": "sts:AssumeRole" }] }
  2. 建立角色:

    aws iam create-role \ --role-name OpenSearchUIAccessRole \ --assume-role-policy-document file://trust-policy.json
  3. 建立僅具有 es:DescribeDomain動作的許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "es:DescribeDomain", "Resource": "arn:aws:es:region:target-account-id:domain/*" }] }
  4. 將許可政策連接至角色:

    aws iam put-role-policy \ --role-name OpenSearchUIAccessRole \ --policy-name ValidationOnly \ --policy-document file://permissions-policy.json

步驟 2:建立 OpenSearch 網域 (目標帳戶)

在已啟用精細存取控制和加密的目標帳戶中建立 OpenSearch 網域:

aws opensearch create-domain \ --domain-name domain-name \ --engine-version OpenSearch_2.19 \ --cluster-config InstanceType=m5.large.search,InstanceCount=1 \ --ebs-options "EBSEnabled=true,VolumeType=gp3,VolumeSize=100" \ --advanced-security-options '{"Enabled":true,"InternalUserDatabaseEnabled":true,"MasterUserOptions":{"MasterUserName":"admin","MasterUserPassword":"master-password"}}' \ --node-to-node-encryption-options '{"Enabled":true}' \ --encryption-at-rest-options '{"Enabled":true}' \ --domain-endpoint-options '{"EnforceHTTPS":true,"TLSSecurityPolicy":"Policy-Min-TLS-1-2-2019-07"}' \ --access-policies '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::source-account-id:root"},"Action":"es:ESHttp*","Resource":"arn:aws:es:region:target-account-id:domain/domain-name/*"}]}' \ --region region
注意

此存取政策會限制從來源帳戶對 IAM 主體的資料平面存取。如需更嚴格的存取,請以特定 IAM 使用者或角色 ARNs 取代帳戶根主體。精細存取控制提供額外的授權層,用於控制對索引和文件的存取。

等待網域狀態變為 ,Active再繼續。

步驟 3:建立 OpenSearch UI 應用程式 (來源帳戶)

使用跨帳戶資料來源在來源帳戶中建立應用程式:

aws opensearch create-application \ --region region \ --name "cross-account-iam-app" \ --data-sources '[{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/domain-name", "dataSourceDescription":"Cross-account domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" }]' \ --app-configs '[{"key":"opensearchDashboards.dashboardAdmin.users","value":"[\"*\"]"}]'

步驟 4:驗證和存取

擷取應用程式詳細資訊以取得端點 URL:

aws opensearch get-application \ --region region \ --id application-id
  • 從回應導覽至應用程式端點 URL。

  • 使用 IAM 登入資料登入。

  • IAM 使用者使用自己的登入資料簽署資料平面請求。

  • 目標網域存取政策控制使用者可以存取哪些資料。

案例 2:存取公有網域的 IAM Identity Center 使用者

步驟 1:建立跨帳戶 IAM 角色 (目標帳戶)

在目標帳戶中建立 IAM 角色,允許來源帳戶擔任該角色進行網域驗證。

建立跨帳戶角色
  1. 建立允許來源帳戶擔任角色的信任政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:root" }, "Action": "sts:AssumeRole" }] }
  2. 建立角色:

    aws iam create-role \ --role-name OpenSearchUIAccessRole \ --assume-role-policy-document file://trust-policy.json
  3. 建立僅具有 es:DescribeDomain動作的許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "es:DescribeDomain", "Resource": "arn:aws:es:region:target-account-id:domain/*" }] }
  4. 將許可政策連接至角色:

    aws iam put-role-policy \ --role-name OpenSearchUIAccessRole \ --policy-name ValidationOnly \ --policy-document file://permissions-policy.json

步驟 2:建立 OpenSearch 網域 (目標帳戶)

在目標帳戶中建立 OpenSearch 網域。使用與 相同的命令步驟 2:建立 OpenSearch 網域 (目標帳戶),但更新存取政策以允許來源帳戶的 IAM Identity Center 應用程式角色:

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:role/NeoIdCAppRole" }, "Action": "es:ESHttp*", "Resource": "arn:aws:es:region:target-account-id:domain/domain-name/*" }] }

等待網域狀態變為 ,Active再繼續。

步驟 3:建立 IAM Identity Center 應用程式的 IAM 角色 (來源帳戶)

在 OpenSearch UI 用於 IAM Identity Center 使用者資料平面存取的來源帳戶中建立 IAM 角色。

建立 IAM Identity Center 應用程式角色
  1. 建立信任政策:

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "application.opensearchservice.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Effect": "Allow", "Principal": { "Service": "application.opensearchservice.amazonaws.com" }, "Action": "sts:SetContext", "Condition": { "ForAllValues:ArnEquals": { "sts:RequestContextProviders": "arn:aws:iam::source-account-id:oidc-provider/portal.sso.region.amazonaws.com/apl/application-id" } } } ] }
  2. 建立許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Sid": "OpenSearchDomain", "Effect": "Allow", "Action": ["es:ESHttp*"], "Resource": "*" }] }
  3. 建立角色並連接政策:

    aws iam create-role \ --role-name NeoIdCAppRole \ --assume-role-policy-document file://neoidc-trust-policy.json aws iam put-role-policy \ --role-name NeoIdCAppRole \ --policy-name NeoIdCAppPermissions \ --policy-document file://neoidc-permissions-policy.json

步驟 4:使用 IAM Identity Center (來源帳戶) 建立 OpenSearch UI 應用程式

aws opensearch create-application \ --region region \ --name "cross-account-idc-app" \ --iam-identity-center-options '{ "enabled":true, "iamIdentityCenterInstanceArn":"arn:aws:sso:::instance/ssoins-instance-id", "iamRoleForIdentityCenterApplicationArn":"arn:aws:iam::source-account-id:role/NeoIdCAppRole" }' \ --data-sources '[{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/domain-name", "dataSourceDescription":"Cross-account domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" }]' \ --app-configs '[{"key":"opensearchDashboards.dashboardAdmin.users","value":"[\"*\"]"}]'

步驟 5:建立和指派 IAM Identity Center 使用者和群組

建立 IAM Identity Center 使用者

執行下列命令。使用您的資訊取代預留位置的值

aws identitystore create-user \ --identity-store-id d-directory-id \ --user-name user-email \ --display-name "display-name" \ --name Formatted=string,FamilyName=last-name,GivenName=first-name \ --emails Value=user-email,Type=work,Primary=true
建立 IAM Identity Center 群組並新增使用者

執行下列命令:

aws identitystore create-group \ --identity-store-id d-directory-id \ --display-name "OpenSearchUsers" \ --description "Users with OpenSearch access" aws identitystore create-group-membership \ --identity-store-id d-directory-id \ --group-id group-id \ --member-id UserId=user-id
將使用者或群組指派給應用程式

執行以下命令:

aws sso-admin create-application-assignment \ --application-arn "arn:aws:sso:::source-account-id:application/ssoins-instance-id/apl-application-id" \ --principal-id user-id-or-group-id \ --principal-type USER
在目標網域上設定後端角色映射

將 IAM Identity Center 群組映射至目標網域上的 OpenSearch 安全角色:

curl -XPUT "https://domain-endpoint/_plugins/_security/api/rolesmapping/all_access" \ -u admin:master-password \ -H 'Content-Type: application/json' \ -d '{ "backend_roles": ["group-id"], "hosts": [], "users": [] }'

步驟 6:驗證和存取

aws opensearch get-application \ --region region \ --id application-id
  • 導覽至應用程式端點 URL。

  • 使用 IAM Identity Center 使用者憑證登入。

  • IAM Identity Center 使用者的資料請求會使用 IAM Identity Center 應用程式角色簽署,而不是跨帳戶角色。

  • 網域控制資料存取許可上的後端角色映射。

案例 3:存取 VPC 網域的 IAM 使用者

步驟 1:建立跨帳戶 IAM 角色 (目標帳戶)

在目標帳戶中建立 IAM 角色,允許來源帳戶擔任該角色進行網域驗證。

建立跨帳戶角色
  1. 建立允許來源帳戶擔任角色的信任政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:root" }, "Action": "sts:AssumeRole" }] }
  2. 建立角色:

    aws iam create-role \ --role-name OpenSearchUIAccessRole \ --assume-role-policy-document file://trust-policy.json
  3. 建立僅具有 es:DescribeDomain動作的許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "es:DescribeDomain", "Resource": "arn:aws:es:region:target-account-id:domain/*" }] }
  4. 將許可政策連接至角色:

    aws iam put-role-policy \ --role-name OpenSearchUIAccessRole \ --policy-name ValidationOnly \ --policy-document file://permissions-policy.json

步驟 2:設定 VPC (目標帳戶)

如果目標帳戶中已存在 VPC,請略過此步驟。

# Create VPC aws ec2 create-vpc \ --cidr-block 10.0.0.0/16 \ --region region # Create subnet aws ec2 create-subnet \ --vpc-id vpc-id \ --cidr-block 10.0.1.0/24 \ --availability-zone regiona \ --region region # Create security group aws ec2 create-security-group \ --group-name opensearch-vpc-sg \ --description "Security group for OpenSearch VPC domain" \ --vpc-id vpc-id \ --region region # Allow inbound HTTPS aws ec2 authorize-security-group-ingress \ --group-id security-group-id \ --protocol tcp \ --port 443 \ --cidr 10.0.0.0/16 \ --region region

進一步了解 VPC 網域建立

步驟 3:建立 VPC 網域 (目標帳戶)

aws opensearch create-domain \ --domain-name vpc-domain-name \ --engine-version OpenSearch_2.19 \ --cluster-config InstanceType=m5.large.search,InstanceCount=1 \ --ebs-options "EBSEnabled=true,VolumeType=gp3,VolumeSize=100" \ --vpc-options "SubnetIds=subnet-id,SecurityGroupIds=security-group-id" \ --advanced-security-options '{"Enabled":true,"InternalUserDatabaseEnabled":true,"MasterUserOptions":{"MasterUserName":"admin","MasterUserPassword":"master-password"}}' \ --node-to-node-encryption-options '{"Enabled":true}' \ --encryption-at-rest-options '{"Enabled":true}' \ --domain-endpoint-options '{"EnforceHTTPS":true,"TLSSecurityPolicy":"Policy-Min-TLS-1-2-2019-07"}' \ --access-policies '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::source-account-id:root"},"Action":"es:ESHttp*","Resource":"arn:aws:es:region:target-account-id:domain/vpc-domain-name/*"}]}' \ --region region
注意

此存取政策會限制從來源帳戶對 IAM 主體的資料平面存取。如需更嚴格的存取,請以特定 IAM 使用者或角色 ARNs 取代帳戶根主體。精細存取控制提供額外的授權層,用於控制對索引和文件的存取。

等待網域狀態變為 ,Active再繼續。

步驟 4:授權 OpenSearch UI 服務主體的 VPC 端點 (目標帳戶)

重要

這是 VPC 網域獨有的關鍵步驟。OpenSearch UI 服務必須明確授權才能存取 VPC 端點。

# Authorize the service principal aws opensearch authorize-vpc-endpoint-access \ --domain-name vpc-domain-name \ --service "application.opensearchservice.amazonaws.com" \ --region region # Verify authorization aws opensearch list-vpc-endpoint-access \ --domain-name vpc-domain-name \ --region region

預期回應:

{ "AuthorizedPrincipalList": [ { "PrincipalType": "AWS_SERVICE", "Principal": "application.opensearchservice.amazonaws.com" } ] }

步驟 5:建立 OpenSearch UI 應用程式 (來源帳戶)

aws opensearch create-application \ --region region \ --name "cross-account-vpc-iam-app" \ --data-sources '[{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/vpc-domain-name", "dataSourceDescription":"Cross-account VPC domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" }]' \ --app-configs '[{"key":"opensearchDashboards.dashboardAdmin.users","value":"[\"*\"]"}]'

步驟 6:驗證和存取

擷取應用程式詳細資訊以取得端點 URL:

aws opensearch get-application \ --region region \ --id application-id
  • 從回應導覽至應用程式端點 URL。

  • 使用 IAM 登入資料登入。

  • IAM 使用者使用自己的登入資料簽署資料平面請求。

  • 目標網域存取政策控制使用者可以存取哪些資料。

案例 4:存取 VPC 網域的 IAM Identity Center 使用者

步驟 1:建立跨帳戶 IAM 角色 (目標帳戶)

在目標帳戶中建立 IAM 角色,允許來源帳戶擔任該角色進行網域驗證。

建立跨帳戶角色
  1. 建立允許來源帳戶擔任角色的信任政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:root" }, "Action": "sts:AssumeRole" }] }
  2. 建立角色:

    aws iam create-role \ --role-name OpenSearchUIAccessRole \ --assume-role-policy-document file://trust-policy.json
  3. 建立僅具有 es:DescribeDomain動作的許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "es:DescribeDomain", "Resource": "arn:aws:es:region:target-account-id:domain/*" }] }
  4. 將許可政策連接至角色:

    aws iam put-role-policy \ --role-name OpenSearchUIAccessRole \ --policy-name ValidationOnly \ --policy-document file://permissions-policy.json

步驟 2:設定 VPC (目標帳戶)

如果目標帳戶中已存在 VPC,請略過此步驟。

# Create VPC aws ec2 create-vpc \ --cidr-block 10.0.0.0/16 \ --region region # Create subnet aws ec2 create-subnet \ --vpc-id vpc-id \ --cidr-block 10.0.1.0/24 \ --availability-zone regiona \ --region region # Create security group aws ec2 create-security-group \ --group-name opensearch-vpc-sg \ --description "Security group for OpenSearch VPC domain" \ --vpc-id vpc-id \ --region region # Allow inbound HTTPS aws ec2 authorize-security-group-ingress \ --group-id security-group-id \ --protocol tcp \ --port 443 \ --cidr 10.0.0.0/16 \ --region region

進一步了解 VPC 網域建立

步驟 3:建立 VPC 網域 (目標帳戶)

使用與 相同的命令步驟 3:建立 VPC 網域 (目標帳戶),但更新存取政策以允許來源帳戶的 IAM Identity Center 應用程式角色:

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::source-account-id:role/NeoIdCAppRole" }, "Action": "es:ESHttp*", "Resource": "arn:aws:es:region:target-account-id:domain/vpc-domain-name/*" }] }

等待網域狀態變為 ,Active再繼續。

步驟 4:授權 OpenSearch UI 服務主體的 VPC 端點 (目標帳戶)

重要

這是 VPC 網域獨有的關鍵步驟。OpenSearch UI 服務必須明確授權才能存取 VPC 端點。

# Authorize the service principal aws opensearch authorize-vpc-endpoint-access \ --domain-name vpc-domain-name \ --service "application.opensearchservice.amazonaws.com" \ --region region # Verify authorization aws opensearch list-vpc-endpoint-access \ --domain-name vpc-domain-name \ --region region

預期回應:

{ "AuthorizedPrincipalList": [ { "PrincipalType": "AWS_SERVICE", "Principal": "application.opensearchservice.amazonaws.com" } ] }

步驟 5:建立 IAM Identity Center 應用程式的 IAM 角色 (來源帳戶)

在 OpenSearch UI 用於 IAM Identity Center 使用者資料平面存取的來源帳戶中建立 IAM 角色。

建立 IAM Identity Center 應用程式角色
  1. 建立信任政策:

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "application.opensearchservice.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Effect": "Allow", "Principal": { "Service": "application.opensearchservice.amazonaws.com" }, "Action": "sts:SetContext", "Condition": { "ForAllValues:ArnEquals": { "sts:RequestContextProviders": "arn:aws:iam::source-account-id:oidc-provider/portal.sso.region.amazonaws.com/apl/application-id" } } } ] }
  2. 建立許可政策:

    { "Version": "2012-10-17", "Statement": [{ "Sid": "OpenSearchDomain", "Effect": "Allow", "Action": ["es:ESHttp*"], "Resource": "*" }] }
  3. 建立角色並連接政策:

    aws iam create-role \ --role-name NeoIdCAppRole \ --assume-role-policy-document file://neoidc-trust-policy.json aws iam put-role-policy \ --role-name NeoIdCAppRole \ --policy-name NeoIdCAppPermissions \ --policy-document file://neoidc-permissions-policy.json

步驟 6:使用 IAM Identity Center (來源帳戶) 建立 OpenSearch UI 應用程式

aws opensearch create-application \ --region region \ --name "cross-account-vpc-idc-app" \ --iam-identity-center-options '{ "enabled":true, "iamIdentityCenterInstanceArn":"arn:aws:sso:::instance/ssoins-instance-id", "iamRoleForIdentityCenterApplicationArn":"arn:aws:iam::source-account-id:role/NeoIdCAppRole" }' \ --data-sources '[{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/vpc-domain-name", "dataSourceDescription":"Cross-account VPC domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" }]' \ --app-configs '[{"key":"opensearchDashboards.dashboardAdmin.users","value":"[\"*\"]"}]'

步驟 7:建立和指派 IAM Identity Center 使用者和群組

建立 IAM Identity Center 使用者

執行下列命令。使用您的資訊取代預留位置的值

aws identitystore create-user \ --identity-store-id d-directory-id \ --user-name user-email \ --display-name "display-name" \ --name Formatted=string,FamilyName=last-name,GivenName=first-name \ --emails Value=user-email,Type=work,Primary=true
建立 IAM Identity Center 群組並新增使用者

執行下列命令:

aws identitystore create-group \ --identity-store-id d-directory-id \ --display-name "OpenSearchUsers" \ --description "Users with OpenSearch access" aws identitystore create-group-membership \ --identity-store-id d-directory-id \ --group-id group-id \ --member-id UserId=user-id
將使用者或群組指派給應用程式

執行以下命令:

aws sso-admin create-application-assignment \ --application-arn "arn:aws:sso:::source-account-id:application/ssoins-instance-id/apl-application-id" \ --principal-id user-id-or-group-id \ --principal-type USER
在目標網域上設定後端角色映射

將 IAM Identity Center 群組映射至目標網域上的 OpenSearch 安全角色:

curl -XPUT "https://domain-endpoint/_plugins/_security/api/rolesmapping/all_access" \ -u admin:master-password \ -H 'Content-Type: application/json' \ -d '{ "backend_roles": ["group-id"], "hosts": [], "users": [] }'

步驟 8:驗證和存取

aws opensearch get-application \ --region region \ --id application-id
  • 導覽至應用程式端點 URL。

  • 使用 IAM Identity Center 使用者憑證登入。

  • IAM Identity Center 使用者的資料請求會使用 IAM Identity Center 應用程式角色簽署,而不是跨帳戶角色。

  • 網域控制資料存取許可上的後端角色映射。

管理 應用程式

使用跨帳戶資料來源更新應用程式

執行下列命令。使用您的資訊取代預留位置的值

aws opensearch update-application \ --region region \ --id application-id \ --data-sources '[{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/domain-1", "dataSourceDescription":"First cross-account domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" },{ "dataSourceArn":"arn:aws:es:region:target-account-id:domain/domain-2", "dataSourceDescription":"Second cross-account domain", "iamRoleForDataSourceArn":"arn:aws:iam::target-account-id:role/OpenSearchUIAccessRole" }]'
重要

更新操作會取代整個資料來源陣列。包含您要保留的所有資料來源。

列出應用程式

執行以下命令:

aws opensearch list-applications \ --region region
刪除應用程式

執行以下命令:

aws opensearch delete-application \ --region region \ --id application-id
撤銷 VPC 端點存取

執行以下命令:

aws opensearch revoke-vpc-endpoint-access \ --domain-name vpc-domain-name \ --service "application.opensearchservice.amazonaws.com" \ --region region

快速參考

下表摘要說明網域類型和身分驗證方法之間的主要差異。

公有網域與 VPC 網域的比較
面向 公有網域 VPC 網域
VPC 端點授權 非必要 必要 – 必須授權 application.opensearchservice.amazonaws.com
網路設定 VPC、子網路、具有 HTTPS (443) 傳入的安全群組
IAM 存取政策 必要 必要
跨帳戶角色 跨帳戶的必要項目 跨帳戶的必要項目
IAM 使用者與 IAM Identity Center 使用者相比
面向 IAM 使用者 IAM Identity Center 使用者
資料平面登入資料 使用者自己的 IAM 登入資料 IAM Identity Center 應用程式角色
存取控制 網域存取政策 網域存取政策和後端角色映射
其他設定 IAM Identity Center 應用程式角色、使用者/群組建立、應用程式指派、後端角色映射
OpenSearch UI 應用程式組態 沒有 IAM Identity Center 選項 --iam-identity-center-options 必要

重要說明

  • iamRoleForDataSourceArn 必須與 位於相同的 帳戶中dataSourceArn

  • 只有跨帳戶資料來源iamRoleForDataSourceArn需要 。為相同帳戶資料來源省略它。

  • 跨帳戶角色只需要 es:DescribeDomain許可。它永遠不會用於資料平面存取。

  • 對於 VPC 網域,必須同時設定 IAM 政策和 VPC 端點授權。

  • 支援的引擎版本:OpenSearch 1.3 及更高版本。

  • 跨帳戶資料來源關聯需要在目標網域上啟用精細存取控制。

疑難排解

問題 Resolution
應用程式建立失敗,並顯示「無法存取網域」 確認跨帳戶角色具有 es:DescribeDomain許可,且信任政策允許來源帳戶。
VPC 網域關聯失敗 確定 VPC 端點已獲得 的授權application.opensearchservice.amazonaws.com
IAM 使用者的資料平面存取遭拒 檢查目標網域存取政策是否允許 IAM 使用者或角色主體。
IAM Identity Center 使用者的資料平面存取遭拒 確認後端角色映射包含 IAM Identity Center 群組 ID,且網域政策允許 IAM Identity Center 應用程式角色。
帳戶不相符錯誤 確定 iamRoleForDataSourceArn 位於與 中網域相同的 帳戶中dataSourceArn