ec2.asciidoc 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [[modules-discovery-ec2]]
  2. === EC2 Discovery
  3. EC2 discovery allows to use the EC2 APIs to perform automatic discovery
  4. (similar to multicast in non hostile multicast environments). Here is a
  5. simple sample configuration:
  6. [source,js]
  7. --------------------------------------------------
  8. cloud:
  9. aws:
  10. access_key: AKVAIQBF2RECL7FJWGJQ
  11. secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
  12. discovery:
  13. type: ec2
  14. --------------------------------------------------
  15. You'll need to install the `cloud-aws` plugin. Please check the
  16. https://github.com/elasticsearch/elasticsearch-cloud-aws[plugin website]
  17. to find the most up-to-date version to install before (re)starting
  18. elasticsearch.
  19. The following are a list of settings (prefixed with `discovery.ec2`)
  20. that can further control the discovery:
  21. [cols="<,<",options="header",]
  22. |=======================================================================
  23. |Setting |Description
  24. |`groups` |Either a comma separated list or array based list of
  25. (security) groups. Only instances with the provided security groups will
  26. be used in the cluster discovery.
  27. |`host_type` |The type of host type to use to communicate with other
  28. instances. Can be one of `private_ip`, `public_ip`, `private_dns`,
  29. `public_dns`. Defaults to `private_ip`.
  30. |`availability_zones` |Either a comma separated list or array based list
  31. of availability zones. Only instances within the provided availability
  32. zones will be used in the cluster discovery.
  33. |`any_group` |If set to `false`, will require all security groups to be
  34. present for the instance to be used for the discovery. Defaults to
  35. `true`.
  36. |`ping_timeout` |How long to wait for existing EC2 nodes to reply during
  37. discovery. Defaults to 3s.
  38. |=======================================================================
  39. [float]
  40. ==== Filtering by Tags
  41. EC2 discovery can also filter machines to include in the cluster based
  42. on tags (and not just groups). The settings to use include the
  43. `discovery.ec2.tag.` prefix. For example, setting
  44. `discovery.ec2.tag.stage` to `dev` will only filter instances with a tag
  45. key set to `stage`, and a value of `dev`. Several tags set will require
  46. all of those tags to be set for the instance to be included.
  47. One practical use for tag filtering is when an EC2 cluster contains many
  48. nodes that are not running elasticsearch. In this case (particularly
  49. with high `ping_timeout` values) there is a risk that a new node's
  50. discovery phase will end before it has found the cluster (which will
  51. result in it declaring itself master of a new cluster with the same name
  52. - highly undesirable). Tagging elasticsearch EC2 nodes and then
  53. filtering by that tag will resolve this issue.
  54. [float]
  55. ==== Region
  56. The `cloud.aws.region` can be set to a region and will automatically use
  57. the relevant settings for both `ec2` and `s3`. The available values are:
  58. `us-east-1`, `us-west-1`, `ap-southeast-1`, `eu-west-1`.
  59. [float]
  60. ==== Automatic Node Attributes
  61. Though not dependent on actually using `ec2` as discovery (but still
  62. requires the cloud aws plugin installed), the plugin can automatically
  63. add node attributes relating to EC2 (for example, availability zone,
  64. that can be used with the awareness allocation feature). In order to
  65. enable it, set `cloud.node.auto_attributes` to `true` in the settings.