Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elasticsearch service get NodeId (Instance ID)

I provision AWS Elasticsearch service with Terraform and want to setup CloudWatch alarms for some metrics like CPU Usage etc. also by using Terraform.

In order to do it I have to put NodeId to aws_cloudwatch_metric_alarm resource: enter image description here

The problem is that aws_elasticsearch_domain resource doesn't have suitable Attributes Reference

And I also haven't found anything suitable in aws es cli https://docs.aws.amazon.com/cli/latest/reference/es/index.html

Any ideas how to get this NodeId to use in Terraform?

like image 319
kagarlickij Avatar asked Nov 06 '22 22:11

kagarlickij


1 Answers

You can get the nodeId from elasticsearch api instead of relying on aws sdk/cli.

Specifically, you can query the cat/nodes api.

Link for reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html

like image 155
Dhiresh Jain Avatar answered Dec 07 '22 04:12

Dhiresh Jain