elasticsearch - 用于预置 Elastic Search 的 AWS Cloud Formation 模板
问题描述
我想通过cloudformation模板配置一个ES域。
我有一个服务将使用这个 ES 域,所以每当该服务部署到 ECS 时,我想首先创建一个 ES 域并在我的服务中使用 ES 端点。
这个模板有帮助吗?
另外,我将如何通过模板设置在 SSM 中新创建的 ES 端点?
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"taskRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ecs-tasks.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"Path": "/",
"Policies": [
{
"PolicyName": "taskRole",
"PolicyDocument": {
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParametersByPath",
"ssm:GetParameter"
],
"Resource": "arn:aws:ssm:*:*:parameter/*"
}
]
}
}
]
}
},
"ElasticsearchDomain": {
"Type": "AWS::Elasticsearch::Domain",
"Properties": {
"DomainName": "Test-ES-Domain",
"ElasticsearchClusterConfig": {
"DedicatedMasterEnabled": "true",
"InstanceCount": "2",
"ZoneAwarenessEnabled": "true",
"InstanceType": "m3.medium.elasticsearch",
"DedicatedMasterType": "m3.medium.elasticsearch",
"DedicatedMasterCount": "3"
},
"EBSOptions": {
"EBSEnabled": true,
"Iops": 0,
"VolumeSize": 20,
"VolumeType": "gp2"
},
"SnapshotOptions": {
"AutomatedSnapshotStartHour": "0"
},
"AccessPolicies": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:user/es-user"
},
"Action": "es:*",
"Resource": "arn:aws:es:us-east-1:123456789012:domain/test/*"
}
]
},
"AdvancedOptions": {
"rest.action.multi.allow_explicit_index": "true"
}
}
}
},
"Outputs": {
"serviceRole": {
"Description": "Task role with permission to read configurations from AWS parameter store",
"Value": { "Fn::GetAtt": [ "taskRole", "Arn" ] }
}
}
}
解决方案
这是我的 ES CloudFormation 模板:https ://github.com/Talderon/AWS_CloudFormation/tree/master/ElasticSearch
随意通过然后将它们分开。
对于您要问的 SSM 部分,我将不得不对此进行一些研究。:P
推荐阅读
- javascript - reactjs中的页面路由时无法访问会话存储
- qt - 在 scoolview qml 中将 qml 中的网格居中
- flutter - 我可以更改 AnimatedContainer 中的边距吗?
- sql - 如何从四个表中选择信息?
- html - 溢出隐藏不起作用,我的标题被内容覆盖
- html - 如何在按钮 HTML 中添加边距文本
- php - PHP:在子目录中找不到类
- linux - 错误:未知指令“rtmp_stat”(使用 NOALBS .conf 文件时 NGNIX 失败)
- windows - 没有管理员的win10上的localhost web服务器
- regex - 替换第 3 次以上的出现