Unable to get maximum spot price history result - US-EAST region

When I get the historical spot price for "us-east-f1" or any region in "us-east-1", the result is always less than 200, I need one type and one instance type. How to get a huge amount of results? EX:

ec2 = boto3.client('ec2')
t=datetime.datetime.now() - datetime.timedelta(0)
f=datetime.datetime.now() - datetime.timedelta(90)
response= ec2.describe_spot_price_history(InstanceTypes =['c3.4xlarge'],ProductDescriptions = ['Linux/UNIX'], AvailabilityZone = 'us-east-1a', StartTime= f, EndTime = t, MaxResults=1000)
response =response['SpotPriceHistory']

I mean for one region and instance type, I need the maximum result to be greater than this.

Edit:

I use paginator to get the whole result for all available pages:

paginator = ec2.get_paginator('describe_spot_price_history') 
page_iterator = paginator.paginate(StartTime= t, EndTime = f, MaxResults=2000 ) 
for page in page_iterator: 
   output = page['SpotPriceHistory'] 

However, I still get the same amount of results! When I get results in 90 days, do I still get the same number of results? How to get all the results or get the maximum price values?

0
2

, .

:

import boto3
import datetime

start_date = datetime.datetime.now() - datetime.timedelta(90)
end_date = datetime.datetime.now() - datetime.timedelta(0)

ec2 = boto3.client('ec2', region_name='us-east-1')
paginator = ec2.get_paginator('describe_spot_price_history') 
page_iterator = paginator.paginate(InstanceTypes =['c3.4xlarge'],ProductDescriptions = ['Linux/UNIX'], AvailabilityZone = 'us-east-1a', StartTime= start_date, EndTime = end_date, MaxResults=2000 ) 

for page in page_iterator: 
   print page['SpotPriceHistory'] 

, 122 .

2018-04-01:

{u'Timestamp': datetime.datetime(2018,
    4,
    1,
    4,
    40,
    44, tzinfo=tzutc()), u'AvailabilityZone': 'us-east-1a', u'InstanceType': 'c3.4xlarge', u'ProductDescription': 'Linux/UNIX', u'SpotPrice': '0.840000'
},

2018-01-02:

{u'Timestamp': datetime.datetime(2018,
    1,
    2,
    0,
    28,
    35, tzinfo=tzutc()), u'AvailabilityZone': 'us-east-1a', u'InstanceType': 'c3.4xlarge', u'ProductDescription': 'Linux/UNIX', u'SpotPrice': '0.840000'
}

90 .

+2

API , region_name:

ec2 = boto3.client('ec2', region_name='ap-southeast-2')

MaxResults , , , NextToken , NextToken .

+1

Source: https://habr.com/ru/post/1675511/


All Articles