AWS Spot Price usage history for the last 90 days must be available. Using the Java SDK, you can create a query to get some history, but since this list is so long that it laid out it. Using the token, you can get the next part of the list, en until you get the whole list.
The problem is that using this token, I still could not get more than the first part of the list. When searching the Internet, it became clear that my understanding of this token is right.
// Create the AmazonEC2Client object so we can call various APIs. AmazonEC2 ec2 = new AmazonEC2Client(credentials); // Get the spot price history DescribeSpotPriceHistoryResult result = ec2.describeSpotPriceHistory(); // Print first part of list for (int i = 0; i < result.getSpotPriceHistory().size(); i++) { System.out.println(result.getSpotPriceHistory().get(i)); } result = result.withNextToken(result.getNextToken()); // Print second part of list for (int i = 0; i < result.getSpotPriceHistory().size(); i++) { System.out.println(result.getSpotPriceHistory().get(i)); }
"nextToken" of the result does not change. Any ideas what I'm doing wrong? Is there an error in the SDK? I installed it through Eclipse.
Thanks in advance!
source share