I'm trying to describe my cache cluster nodes in AWS Elasticache. I am using the example from Finding AWS ElastiCache endpoints with Java (the solution code).
I use the code:
DescribeCacheClustersRequest dccRequest = new DescribeCacheClustersRequest();
dccRequest.setShowCacheNodeInfo(true);
elasticache.setEndpoint("ec2.us-west-1.amazonaws.com");
DescribeCacheClustersResult clusterResult = elasticache.describeCacheClusters(dccRequest);
System.out.println("cache cluster node fleet size: " + clusterResult.getCacheClusters().size());
for (CacheCluster cacheCluster : clusterResult.getCacheClusters()) {
List<CacheNode> cacheNodes = cacheCluster.getCacheNodes();
System.out.println("cache cluster size: " + cacheNodes.size());
}
When I run this code I get the error:
Exception in thread "main" Status Code: 400, AWS Service: AmazonElastiCache, AWS Request ID: null, AWS Error Code: null, AWS Error Message: null
If I remove the setEndpoint code, the code doesn't error out, but no nodes are returned and printed. The reason I am guessing is because the US-EAST region is queried by default.
Does anyone know how I can circumvent this error?