According to the response of the AWS command to Unable to retrieve cache nodes from the ElastiCache cluster , you will need to use the optional ShowDetails flag to get CacheNodes Information through the DescribeCacheClustersRequest class parameter of the method to describe CacheClusters () . If you look closer, the ShowDetails checkbox is missing, despite the fact that it is actually documented for this class:
The optional ShowDetails flag can be used to retrieve detailed information about the cache nodes associated with the cache cluster. Details include the DNS address and port for the Cache Node endpoint.
Presumably, this actually targets setShowCacheNodeInfo () , which is an optional flag that can be included in a DescribeCacheCluster request to get information about cache nodes.
Thus, the response from the AWS command seems inaccurate and does not really solve the question of why the getCacheNodes () method from Class CacheCluster does not return this information, and this is rather unusual for such messages.
In any case, you can simply try the getCacheNodes () method from the CacheCluster class returned by the getCacheClusters () method from the DescribeCacheClustersResult class , I hope it works as advertised (i.e. I have not tried it myself).
Good luck
Update
Here is the code that Sander has successfully used to achieve its goal, confirming the approach described above:
AmazonElastiCacheClient client = new AmazonElastiCacheClient(credentials); DescribeCacheClustersRequest dccRequest = new DescribeCacheClustersRequest(); dccRequest.setShowCacheNodeInfo(true); DescribeCacheClustersResult clusterResult = client.describeCacheClusters(dccRequest);
The missing fragments should be similar to its initial solution, for example:
List<CacheCluster> cacheClusters = clusterResult.getCacheClusters(); for (CacheCluster cacheCluster : cacheClusters) { List<CacheNode> cacheNodes = cacheCluster.getCacheNodes(); System.out.println("List size: " + cacheNodes.size()); }
source share