DEV Community

Doctorx
Doctorx

Posted on

How to update Elasticsearch Version on AWS

In the AWS Elasticsearch documentation part of CloudFormation nothing writes about how to update the Elasticsearch version. First glance it is simple. Only change version number ElasticsearchVersion.

If you update ElasticsearchVersion in the Elasticsearch template, You would catch exception AWS::Elasticsearch::Domain UPDATE_FAILED CloudFormation cannot update a stack when a custom-named resource requires replacing

How to fix it. You need to add new section UpdatePolicy to your CloudFormation template like this:

  ElasticsearchDomain:
    Type: "AWS::Elasticsearch::Domain"
    Properties:
      ElasticsearchVersion: 7.4 #New version for example 7.1 -> 7.4
    UpdatePolicy:
      EnableVersionUpgrade: true

Other way. You can use AWS API call

curl --location --request POST 'https://es.us-east-1.amazonaws.com/2015-01-01/es/upgradeDomain' \
--data-raw '{
  "DomainName": "test-es",
  "TargetVersion": "7.4",
  "PerformCheckOnly": true # If `true` AWS run only check-update
}'

I use the Postman with AWS Signature. Take AccessKey, SecretKey and Session Token from aws sts assume-role or aws sts get-session-token.

Documentation links

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay