Creating and launching an ElasticSearch cluster

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, ...

Get Effective DevOps with AWS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.