Issue
I use the start time and end time examples from the output of:
aws ec2 describe-spot-price-history help
The problem I experience is that I get also some results that are not within the time boundaries I set. The environment and AWS CLI I use is:
ws-cli/2.7.2 Python/3.9.11 Linux/5.4.72-microsoft-standard-WSL2 exe/x86_64.debian.11 prompt/off
My command that follows the examples is:
aws ec2 describe-spot-price-history --availability-zone eu-central-1b --instance-types p3.8xlarge p3.16xlarge --start-time 2023-12-26T09:00:00 --end-time 2023-12-26T10:00:00
Aside from what I expect to get within the time bounds set I get records like:
{
"AvailabilityZone": "eu-central-1b",
"InstanceType": "p3.16xlarge",
"ProductDescription": "Red Hat Enterprise Linux",
"SpotPrice": "4.569300",
"Timestamp": "2023-12-26T05:01:40+00:00"
},
{
"AvailabilityZone": "eu-central-1b",
"InstanceType": "p3.16xlarge",
"ProductDescription": "SUSE Linux",
"SpotPrice": "4.539300",
"Timestamp": "2023-12-26T05:01:40+00:00"
}
and even I do get some records from 2023-12-25.
The examples in the help show only perfect time interval match yet it is not what happens to me. What am I doing wrong? How to limit the output only to the time bounds set by the respective options?
Solution
The describe-spot-price-history — AWS CLI Command Reference says:
When you specify a start and end time, the operation returns the prices of the instance types within that time range. It also returns the last price change before the start time, which is the effective price as of the start time.
It would appear that it is returning details of whenever the spot price changes rather than what it is at each second or minute.
Also, it is likely that the price you received for the previous day related to the 'last price change before the start time'.
Answered By - John Rotenstein Answer Checked By - David Goodson (WPSolving Volunteer)