1

We have two spring boot applications which is accessing dax cluster using the software.amazon.dax:amazon-dax-client java client.

This is how I am building the dax client. Using the cluster URL. I have created the dax cluster through cloudformation. After the cluster is created, I get the dax endpoint and update it in the code.

ClusterDaxClient.builder().overrideConfiguration(
    Configuration.builder().region(Region.EU_CENTRAL_1)
    .URL("dax://datatesting-proc.infqpgtest.dax-clusters.eu-central-1.amazonaws.com").build()
).build();

If I change the node type of the cluster in cloud formation, the endpoint gets changed. Then I need to update the hard-coded endpoint across all the apps accessing DAX.

Initially, I had added the cluster name in cloud formation. But it's not possible to change the node type with this configuration.

  1. Is there any way I can update the node type of DAX without affecting the applications? The ideal way would've been when I update the node type in cloudformation, AWS creates a new node with the same endpoint, and deletes the old dax cluster. However, this is clearly not the case.

  2. Also, how do I make the DAX work without hardcoding the URL? Is there any parameter that I can set both in cloud formation file and my application code?

Prajwal
  • 563
  • 7
  • 22

1 Answers1

1
  1. Is there any way I can update the node type of DAX without affecting the applications? The ideal way would've been when I update the node type in cloudformation, AWS creates a new node with the same endpoint, and deletes the old dax cluster. However, this is clearly not the case.

No you cannot update node types in DAX. DAX is only horizontally scalable, meaning you can only add more nodes of the same type, you cannot scale vertically, which changing the node type.

  1. Also, how do I make the DAX work without hardcoding the URL? Is there any parameter that I can set both in cloud formation file and my application code?

You can get the endpoint from the CFN template and store that value as an Environment variable, or pass it to your code:

{ "Fn::GetAtt": ["MyDAXCluster", "ClusterDiscoveryEndpoint"] }

Ref

Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31
  • Thanks. I can't use env variable because I don't want to restart the application or poll for changes often.. Is it possible to set some field in cloudformation template which I can use in all the applications. E.g if I set the name field like "MyDaxCluster" and use this name as reference in my apps to get a reference to this cluster? – Prajwal Mar 01 '23 at 22:23
  • Yes it's possible: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-crossstackref.html – Leeroy Hannigan Mar 01 '23 at 22:48