Elasticsearch は、PrivateLink 経由で VPC から Kibana やクラスターにアクセスする場合、Beats シッパーを管理する場合、手動スナップショットを操作する場合に、他の Alibaba Cloud サービスにアクセスするためにサービスリンクロール (SLR) を使用します。これらのロールが存在しない場合、Elasticsearch は自動的に作成します。本トピックでは、Elasticsearch の SLR とその削除方法について説明します。
シナリオ
Elasticsearch は以下のサービスリンクロールを使用します。
-
AliyunServiceRoleForElasticsearch:クラウドネイティブコントロールアーキテクチャにデプロイされた Elasticsearch クラスターの Kibana またはノードに VPC 経由でアクセスする際に必要です。
-
AliyunServiceRoleForElasticsearchCollector:Beats シッパーの作成と管理に必要です。
-
AliyunServiceRoleForElasticsearchOSS:手動スナップショットの作成または復元に必要です。Elasticsearch に OSS バケットへのアクセス権限を付与します。
サービスリンクロールのトピックでは、SLR の仕組みについて説明しています。
ロールの詳細
AliyunServiceRoleForElasticsearch
クラウドネイティブコントロールアーキテクチャにデプロイされた Elasticsearch クラスターの Kibana またはノードに VPC 経由でアクセスする際に、この SLR が存在しない場合、Elasticsearch は自動的に作成します。その後、Elasticsearch はこのロールを引き受けて 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": [
"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 が存在しない場合、Elasticsearch は自動的に作成します。その後、Elasticsearch はこのロールを引き受けて、ECS インスタンスまたは 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 が存在しない場合、Elasticsearch は自動的に作成します。その後、Elasticsearch はこのロールを引き受けて、お客様の 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 ユーザーを使用して Elasticsearch サービスリンクロールを作成できないのはなぜですか?
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
-