Elasticsearch (ES) は、PrivateLink 経由で VPC を通じて Kibana またはクラスターにアクセスする場合、Beats シッパーを管理する場合、または手動スナップショットを操作する場合に、サービスリンクロール (SLR) を使用して他の Alibaba Cloud サービスにアクセスします。これらのロールが存在しない場合、ES は自動的に作成します。このトピックでは、ES の SLR とその削除方法について説明します。
シナリオ
ES は、次のサービスリンクロールを使用します。
-
AliyunServiceRoleForElasticsearch:クラウドネイティブコントロールアーキテクチャにデプロイされた ES クラスターの Kibana またはノードに VPC 経由でアクセスするために必要です。
-
AliyunServiceRoleForElasticsearchCollector:Beats シッパーを作成および管理するために必要です。
-
AliyunServiceRoleForElasticsearchOSS:手動スナップショットを作成または復元するために必要です。ES に OSS バケットへのアクセス権限を付与します。
「サービスリンクロール」のトピックでは、SLR の仕組みについて説明しています。
ロールの詳細
AliyunServiceRoleForElasticsearch
クラウドネイティブコントロールアーキテクチャにデプロイされた ES クラスターの Kibana またはノードに VPC 経由でアクセスすると、この SLR が存在しない場合、ES は自動的に作成します。その後、ES はこのロールを引き受けて PrivateLink および ECS の API を呼び出し、VPC アクセス用のエンドポイントとネットワーク設定を作成します。
-
ロール名:AliyunServiceRoleForElasticsearch
-
ポリシー名:AliyunServiceRolePolicyForElasticsearch
-
ポリシードキュメント (以下のポリシーは、中国 (北京)、中国 (上海)、中国 (杭州)、中国 (深圳)、中国 (張家口)、および中国 (青島) のリージョンに適用されます。その他のリージョンは、元のポリシーのままです):
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:AssignIpv6Addresses",
"ecs:AssignPrivateIpAddresses",
"ecs:AttachNetworkInterface",
"ecs:AuthorizeSecurityGroup",
"ecs:AuthorizeSecurityGroupEgress",
"ecs:CreateNetworkInterface",
"ecs:CreateNetworkInterfacePermission",
"ecs:CreateSecurityGroup",
"ecs:DeleteNetworkInterface",
"ecs:DeleteSecurityGroup",
"ecs:DescribeInstanceAttribute",
"ecs:DescribeInstances",
"ecs:DescribeNetworkInterfaceAttribute",
"ecs:DescribeNetworkInterfaces",
"ecs:DescribeSecurityGroupAttribute",
"ecs:DescribeSecurityGroupReferences",
"ecs:DescribeSecurityGroups",
"ecs:DetachNetworkInterface",
"ecs:JoinSecurityGroup",
"ecs:LeaveSecurityGroup",
"ecs:ModifyNetworkInterfaceAttribute",
"ecs:ModifySecurityGroupAttribute",
"ecs:ModifySecurityGroupEgressRule",
"ecs:ModifySecurityGroupPolicy",
"ecs:ModifySecurityGroupRule",
"ecs:RevokeSecurityGroup",
"ecs:RevokeSecurityGroupEgress",
"ecs:UnassignIpv6Addresses",
"ecs:UnassignPrivateIpAddresses"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"elasticsearch:ListInstance",
"elasticsearch:DescribeInstance",
"elasticsearch:RunEsDiagnosticCommand"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"pvtz:AddZone",
"pvtz:AddZoneRecord",
"pvtz:DeleteZone",
"pvtz:DeleteZoneRecord",
"pvtz:DescribeZoneRecords",
"pvtz:UpdateZoneRecord"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"vpc:DescribeVSwitches"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"privatelink:CreateVpcEndpoint",
"privatelink:ListVpcEndpoints",
"privatelink:UpdateVpcEndpointAttribute",
"privatelink:GetVpcEndpointAttribute",
"privatelink:ListVpcEndpointSecurityGroups",
"privatelink:AttachSecurityGroupToVpcEndpoint",
"privatelink:DetachSecurityGroupFromVpcEndpoint",
"privatelink:AddZoneToVpcEndpoint",
"privatelink:RemoveZoneFromVpcEndpoint",
"privatelink:ListVpcEndpointZones",
"privatelink:OpenPrivateLinkService",
"privatelink:CheckProductOpen",
"privatelink:DeleteVpcEndpoint"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"cms:DescribeAlertLogCount",
"cms:DescribeAlertLogList",
"cms:DescribeAlertLogHistogram",
"cms:DescribeSubscriptionList",
"cms:DescribeContactListByContactGroup",
"cms:DescribeContactGroupList",
"cms:DescribeContactList",
"cms:PutContact",
"cms:PutContactGroup",
"cms:DescribeSystemEventHistogram",
"cms:DescribeSystemEventMetaList",
"cms:DescribeSystemEventAttribute",
"cms:DescribeSystemEventCount",
"cms:DescribeMetricList",
"cms:DescribeMetricLast",
"cms:DescribeMetricMetaList",
"cms:DescribeConsoleViews",
"cms:QueryMetricLast",
"cms:QueryMetricList",
"cms:DescribeMetricListFromProxy",
"cms:DescribeMetricLastFromProxy"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": "ram:CreateServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "privatelink.aliyuncs.com"
}
}
},
{
"Action": "ram:DeleteServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "elasticsearch.aliyuncs.com"
}
}
}
]
}
他のリージョンのポリシーと比較して、これらのリージョンのポリシーには次の機能が追加されています:
-
ES インスタンスのクエリと診断:ES インスタンスのクエリと診断のため、
elasticsearchの権限 (ListInstance、DescribeInstance、および RunEsDiagnosticCommand) が追加されています。 -
PrivateLink サービスのアクティベーション:PrivateLink をアクティベートし、製品のアクティベーションステータスを確認するため、
privatelinkの権限 (OpenPrivateLinkService および CheckProductOpen) が追加されています。 -
CloudMonitor:アラートログのクエリ、連絡先と連絡先グループの管理、システムイベントのクエリ、およびメトリックデータのクエリのため、
cmsの権限 (合計 21 アクション) が追加されています。
以下のポリシーは、他のリージョンに適用されます:
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:AssignIpv6Addresses",
"ecs:AssignPrivateIpAddresses",
"ecs:AttachNetworkInterface",
"ecs:AuthorizeSecurityGroup",
"ecs:AuthorizeSecurityGroupEgress",
"ecs:CreateNetworkInterface",
"ecs:CreateNetworkInterfacePermission",
"ecs:CreateSecurityGroup",
"ecs:DeleteNetworkInterface",
"ecs:DeleteSecurityGroup",
"ecs:DescribeInstanceAttribute",
"ecs:DescribeInstances",
"ecs:DescribeNetworkInterfaceAttribute",
"ecs:DescribeNetworkInterfaces",
"ecs:DescribeSecurityGroupAttribute",
"ecs:DescribeSecurityGroupReferences",
"ecs:DescribeSecurityGroups",
"ecs:DetachNetworkInterface",
"ecs:JoinSecurityGroup",
"ecs:LeaveSecurityGroup",
"ecs:ModifyNetworkInterfaceAttribute",
"ecs:ModifySecurityGroupAttribute",
"ecs:ModifySecurityGroupEgressRule",
"ecs:ModifySecurityGroupPolicy",
"ecs:ModifySecurityGroupRule",
"ecs:RevokeSecurityGroup",
"ecs:RevokeSecurityGroupEgress",
"ecs:UnassignIpv6Addresses",
"ecs:UnassignPrivateIpAddresses"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"pvtz:AddZone",
"pvtz:AddZoneRecord",
"pvtz:DeleteZone",
"pvtz:DeleteZoneRecord",
"pvtz:DescribeZoneRecords",
"pvtz:UpdateZoneRecord"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"vpc:DescribeVSwitches"
],
"Resource": [
"*"
],
"Effect": "Allow"
},
{
"Action": [
"privatelink:CreateVpcEndpoint",
"privatelink:ListVpcEndpoints",
"privatelink:UpdateVpcEndpointAttribute",
"privatelink:GetVpcEndpointAttribute",
"privatelink:ListVpcEndpointSecurityGroups",
"privatelink:AttachSecurityGroupToVpcEndpoint",
"privatelink:DetachSecurityGroupFromVpcEndpoint",
"privatelink:AddZoneToVpcEndpoint",
"privatelink:RemoveZoneFromVpcEndpoint",
"privatelink:ListVpcEndpointZones",
"privatelink:DeleteVpcEndpoint"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": "ram:CreateServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "privatelink.aliyuncs.com"
}
}
},
{
"Action": "ram:DeleteServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "elasticsearch.aliyuncs.com"
}
}
}
]
}
サービス名:elasticsearch.aliyuncs.com
ロールの作成に必要な権限:ram:CreateServiceLinkedRole
AliyunServiceRoleForElasticsearchCollector
Beats シッパーを作成または管理すると、この SLR が存在しない場合、ES は自動的に作成します。その後、ES はこのロールを引き受けて、ECS インスタンスまたは Container Service for Kubernetes (ACK) クラスターからの Beats データ収集を有効にします。
-
ロール名:AliyunServiceRoleForElasticsearchCollector
-
ポリシー名:AliyunServiceRolePolicyForElasticsearchCollector
-
ポリシードキュメント:
{ "Version": "1", "Statement": [ { "Action": [ "oos:CancelExecution", "oos:DeleteExecutions", "oos:GenerateExecutionPolicy", "oos:GetExecutionTemplate", "oos:ListExecutionLogs", "oos:ListExecutions", "oos:ListTaskExecutions", "oos:NotifyExecution", "oos:StartExecution", "oos:ListTagResources", "oos:TagResources", "oos:UntagResources", "oos:CreateTemplate", "oos:DeleteTemplate", "oos:GetTemplate", "oos:ListExecutionRiskyTasks", "oos:ListTemplates", "oos:UpdateTemplate" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "ecs:DescribeInstances", "ecs:DescribeCloudAssistantStatus" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "cs:GetUserConfig", "cs:GetClusters", "cs:GetClusterById" ], "Resource": "*", "Effect": "Allow" }, { "Action": "ram:DeleteServiceLinkedRole", "Resource": "*", "Effect": "Allow", "Condition": { "StringEquals": { "ram:ServiceName": "collector.elasticsearch.aliyuncs.com" } } }, { "Effect": "Allow", "Action": "ram:PassRole", "Resource": "acs:ram:*:*:role/aliyunoosaccessingecs4esrole", "Condition": { "StringEquals": { "acs:Service": "oos.aliyuncs.com" } } } ] } -
サービス名:collector.elasticsearch.aliyuncs.com
-
ロールの作成に必要な権限:
ram:CreateServiceLinkedRole
AliyunServiceRoleForElasticsearchOSS
手動スナップショットを作成または復元すると、この SLR が存在しない場合、ES は自動的に作成します。その後、ES はこのロールを引き受けて、お使いの OSS バケットにアクセスします。
-
ロール名:AliyunServiceRoleForElasticsearchOSS
-
ポリシー名:AliyunServiceRolePolicyForElasticsearchOSS
-
ポリシードキュメント:
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"oss:ListObjects",
"oss:GetObject",
"oss:GetObjectVersion",
"oss:GetObjectVersionTagging",
"oss:GetObjectMeta",
"oss:DeleteObject",
"oss:PutObject",
"oss:GetBucketVersioning",
"oss:GetBucketInfo",
"oss:GetBucketAcl"
],
"Resource": [
"acs:oss:*:*:es-alicloud-*/*",
"acs:oss:*:*:es-alicloud-*",
"acs:oss:*:*:*/*es-alicloud*/*"
]
},
{
"Effect": "Allow",
"Action": [
"oss:ListObjects",
"oss:GetObject",
"oss:GetObjectMeta",
"oss:GetObjectVersion",
"oss:GetObjectVersionTagging",
"oss:DeleteObject",
"oss:PutObject",
"oss:GetBucketVersioning",
"oss:GetBucketInfo",
"oss:GetBucketAcl"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"oss:BucketTag/es-alicloud": [
"es-alicloud"
]
}
}
},
{
"Action": "ram:DeleteServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "oss.elasticsearch.aliyuncs.com"
}
}
}
]
}
サービス名:oss.elasticsearch.aliyuncs.com
ロールの作成に必要な権限:ram:CreateServiceLinkedRole
サービスリンクロールの削除
SLR を削除する前に、そのロールに依存するすべてのタスクまたはデバイスを削除してください。「SLR の削除」をご参照ください。
よくある質問
Q:RAM ユーザーを使用して ES のサービスリンクロールを作成できないのはなぜですか。
A:Alibaba Cloud アカウントおよび `CreateServiceLinkedRole` 権限を持つ RAM ユーザーのみが SLR を作成または削除できます。RAM ユーザーに次のポリシーをアタッチしてください (「RAM ユーザーへの権限付与」をご参照ください):
{
"Version": "1",
"Statement": [
{
"Action": "elasticsearch:InitializeOperationRole",
"Resource": "acs:ram:*:133071096032****:role/*",
"Effect": "Allow"
},
{
"Action": "ram:CreateServiceLinkedRole",
"Resource": "acs:ram:*:133071096032****:role/*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": [
"XXX.aliyuncs.com"
]
}
}
}
]
}
-
Resource 要素の
133071096032****をお使いの Alibaba Cloud アカウント ID に置き換えます。アカウント ID を見つけるには、コンソールの右上隅にあるプロフィール写真にポインターを合わせ、アカウントID を確認します。
-
ram:ServiceName の
XXX.aliyuncs.comをターゲット SLR のサービス名に置き換えます:-
AliyunServiceRoleForElasticsearch:elasticsearch.aliyuncs.com
-
AliyunServiceRoleForElasticsearchCollector:collector.elasticsearch.aliyuncs.com
-
AliyunServiceRoleForElasticsearchOSS:oss.elasticsearch.aliyuncs.com
-