Terraform module to provision an Elasticsearch
cluster with built-in integrations with Kibana and Logstash.
This project is part of our comprehensive "SweetOps" approach towards DevOps.
It's 100% Open Source and licensed under the APACHE2.
This module will create:
- Elasticsearch cluster with the specified node count in the provided subnets in a VPC
- Elasticsearch domain policy that accepts a list of IAM role ARNs from which to permit management traffic to the cluster
- Security Group to control access to the Elasticsearch domain (inputs to the Security Group are other Security Groups or CIDRs blocks to be allowed to connect to the cluster)
- DNS hostname record for Elasticsearch cluster (if DNS Zone ID is provided)
- DNS hostname record for Kibana (if DNS Zone ID is provided)
NOTE: To enable zone awareness to deploy Elasticsearch nodes into two different Availability Zones, you need to set zone_awareness_enabled
to true
and provide two different subnets in subnet_ids
.
If you enable zone awareness for your domain, Amazon ES places an endpoint into two subnets.
The subnets must be in different Availability Zones in the same region.
If you don't enable zone awareness, Amazon ES places an endpoint into only one subnet
Basic example
module "elasticsearch" {
source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=master"
namespace = "eg"
stage = "dev"
name = "es"
dns_zone_id = "Z14EN2YD427LRQ"
security_groups = ["sg-XXXXXXXXX", "sg-YYYYYYYY"]
vpc_id = "vpc-XXXXXXXXX"
subnet_ids = ["subnet-XXXXXXXXX", "subnet-YYYYYYYY"]
zone_awareness_enabled = "true"
elasticsearch_version = "6.2"
instance_type = "t2.small.elasticsearch"
instance_count = 4
iam_role_arns = ["arn:aws:iam::XXXXXXXXX:role/ops", "arn:aws:iam::XXXXXXXXX:role/dev"]
iam_actions = ["es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost"]
encrypt_at_rest_enabled = "true"
kibana_subdomain_name = "kibana-es"
advanced_options {
"rest.action.multi.allow_explicit_index" = "true"
}
}
Available targets:
help This help screen
help/all Display help for all targets
lint Lint terraform code
Name | Description | Type | Default | Required |
---|---|---|---|---|
advanced_options | Key-value string pairs to specify advanced configuration options | map | <map> |
no |
allowed_cidr_blocks | List of CIDR blocks to be allowed to connect to the cluster | list | <list> |
no |
attributes | Additional attributes (e.g. 1 ) |
list | <list> |
no |
automated_snapshot_start_hour | Hour at which automated snapshots are taken, in UTC | string | 0 |
no |
dedicated_master_count | Number of dedicated master nodes in the cluster | string | 0 |
no |
dedicated_master_enabled | Indicates whether dedicated master nodes are enabled for the cluster | string | false |
no |
dedicated_master_type | Instance type of the dedicated master nodes in the cluster | string | t2.small.elasticsearch |
no |
delimiter | Delimiter to be used between namespace , stage , name and attributes |
string | - |
no |
dns_zone_id | Route53 DNS Zone ID to add hostname records for Elasticsearch domain and Kibana | string | `` | no |
ebs_iops | The baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable only for the Provisioned IOPS EBS volume type | string | 0 |
no |
ebs_volume_size | Optionally use EBS volumes for data storage by specifying volume size in GB | string | 0 |
no |
ebs_volume_type | Storage type of EBS volumes | string | gp2 |
no |
elasticsearch_version | Version of Elasticsearch to deploy | string | 6.2 |
no |
enabled | Set to false to prevent the module from creating any resources | string | true |
no |
encrypt_at_rest_enabled | Whether to enable encryption at rest | string | true |
no |
encrypt_at_rest_kms_key_id | The KMS key id to encrypt the Elasticsearch domain with. If not specified, then it defaults to using the AWS/Elasticsearch service KMS key | string | `` | no |
iam_actions | List of actions to allow for the IAM roles, e.g. es:ESHttpGet , es:ESHttpPut , es:ESHttpPost |
list | <list> |
no |
iam_role_arns | List of IAM role ARNs to permit access to the Elasticsearch domain | list | <list> |
no |
instance_count | Number of data nodes in the cluster | string | 4 |
no |
instance_type | Elasticsearch instance type for data nodes in the cluster | string | t2.small.elasticsearch |
no |
kibana_subdomain_name | The name of the subdomain for Kibana in the DNS zone (e.g. kibana , ui , ui-es , search-ui , kibana.elasticsearch ) |
string | kibana |
no |
log_publishing_cloudwatch_log_group_arn | ARN of the Cloudwatch log group to which log needs to be published | string | `` | no |
log_publishing_enabled | Specifies whether log publishing option is enabled or not | string | false |
no |
log_publishing_log_type | A type of Elasticsearch log. Valid values: INDEX_SLOW_LOGS, SEARCH_SLOW_LOGS | string | SEARCH_SLOW_LOGS |
no |
name | Name of the application | string | - | yes |
namespace | Namespace (e.g. eg or cp ) |
string | - | yes |
security_groups | List of security group IDs to be allowed to connect to the cluster | list | <list> |
no |
stage | Stage (e.g. prod , dev , staging ) |
string | - | yes |
subnet_ids | Subnet ids | list | - | yes |
tags | Additional tags (e.g. map(BusinessUnit ,XYZ ) |
map | <map> |
no |
vpc_id | VPC ID | string | - | yes |
zone_awareness_enabled | Enable zone awareness for Elasticsearch cluster | string | true |
no |
Name | Description |
---|---|
domain_arn | ARN of the Elasticsearch domain |
domain_endpoint | Domain-specific endpoint used to submit index, search, and data upload requests |
domain_hostname | Elasticsearch domain hostname to submit index, search, and data upload requests |
domain_id | Unique identifier for the Elasticsearch domain |
kibana_endpoint | Domain-specific endpoint for Kibana without https scheme |
kibana_hostname | Kibana hostname |
security_group_id | Security Group ID to control access to the Elasticsearch domain |
For additional context, refer to some of these links.
- What is Amazon Elasticsearch Service - Complete description of Amazon Elasticsearch Service
- Amazon Elasticsearch Service Access Control - Describes several ways of controlling access to Elasticsearch domains
- VPC Support for Amazon Elasticsearch Service Domains - Describes Elasticsearch Service VPC Support and VPC architectures with and without zone awareness
- Creating and Configuring Amazon Elasticsearch Service Domains - Provides a complete description on how to create and configure Amazon Elasticsearch Service (Amazon ES) domains
- Kibana and Logstash - Describes some considerations for using Kibana and Logstash with Amazon Elasticsearch Service
- Amazon Cognito Authentication for Kibana - Amazon Elasticsearch Service uses Amazon Cognito to offer user name and password protection for Kibana
- Control Access to Amazon Elasticsearch Service Domain - Describes how to Control Access to Amazon Elasticsearch Service Domain
- elasticsearch_domain - Terraform reference documentation for the
elasticsearch_domain
resource - elasticsearch_domain_policy - Terraform reference documentation for the
elasticsearch_domain_policy
resource
Got a question?
File a GitHub issue, send us an email or join our Slack Community.
Work directly with our team of DevOps experts via email, slack, and video conferencing.
We provide commercial support for all of our Open Source projects. As a Dedicated Support customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer.
- Questions. We'll use a Shared Slack channel between your team and ours.
- Troubleshooting. We'll help you triage why things aren't working.
- Code Reviews. We'll review your Pull Requests and provide constructive feedback.
- Bug Fixes. We'll rapidly work to fix any bugs in our projects.
- Build New Terraform Modules. We'll develop original modules to provision infrastructure.
- Cloud Architecture. We'll assist with your cloud strategy and design.
- Implementation. We'll provide hands-on support to implement our reference architectures.
Get access to our Open Source Community Forum on Slack. It's FREE to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build sweet infrastructure.
Please use the issue tracker to report any bugs or file feature requests.
If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!
Copyright © 2017-2018 Cloud Posse, LLC
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
All other trademarks referenced herein are the property of their respective owners.
This project is maintained and funded by Cloud Posse, LLC. Like it? Please let us know at [email protected]
We're a DevOps Professional Services company based in Los Angeles, CA. We love Open Source Software!
We offer paid support on all of our projects.
Check out our other projects, apply for a job, or hire us to help with your cloud strategy and implementation.
Erik Osterman |
Andriy Knysh |
Igor Rodionov |
Sarkis Varozian |
---|