As mentioned, AWS has a managed service for ElasticSearch. We will use it to create our cluster.
Create a new file and call it elasticsearch-cf-template.py. Our script will start almost like the nodeserver-cf-template.py file, but with a number of imports, including some for the elasticsearch service:
"""Generating CloudFormation template.""" from ipaddress import ip_network from ipify import get_ip from troposphere import ( GetAtt, Join, Output, Export, Parameter, Ref, Template, ) from troposphere.elasticsearch import ( Domain, EBSOptions, ElasticsearchClusterConfig, )
We will continue the script with the creation of the template and the extraction of the IP address. In the context of ElasticSearch, ...