EC2 / Client / describe_scheduled_instance_availability
describe_scheduled_instance_availability#
- EC2.Client.describe_scheduled_instance_availability(**kwargs)#
Finds available schedules that meet the specified criteria.
You can search for an available schedule no more than 3 months in advance. You must meet the minimum required duration of 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.
After you find a schedule that meets your needs, call PurchaseScheduledInstances to purchase Scheduled Instances with that schedule.
See also: AWS API Documentation
Request Syntax
response = client.describe_scheduled_instance_availability( DryRun=True|False, Filters=[ { 'Name': 'string', 'Values': [ 'string', ] }, ], FirstSlotStartTimeRange={ 'EarliestTime': datetime(2015, 1, 1), 'LatestTime': datetime(2015, 1, 1) }, MaxResults=123, MaxSlotDurationInHours=123, MinSlotDurationInHours=123, NextToken='string', Recurrence={ 'Frequency': 'string', 'Interval': 123, 'OccurrenceDays': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' } )
- Parameters:
DryRun (boolean) – Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation
. Otherwise, it isUnauthorizedOperation
.Filters (list) –
The filters.
availability-zone
- The Availability Zone (for example,us-west-2a
).instance-type
- The instance type (for example,c4.large
).network-platform
- The network platform (EC2-Classic
orEC2-VPC
).platform
- The platform (Linux/UNIX
orWindows
).
(dict) –
A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.
If you specify multiple filters, the filters are joined with an
AND
, and the request returns only results that match all of the specified filters.Name (string) –
The name of the filter. Filter names are case-sensitive.
Values (list) –
The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an
OR
, and the request returns all results that match any of the specified values.(string) –
FirstSlotStartTimeRange (dict) –
[REQUIRED]
The time period for the first schedule to start.
EarliestTime (datetime) – [REQUIRED]
The earliest date and time, in UTC, for the Scheduled Instance to start.
LatestTime (datetime) – [REQUIRED]
The latest date and time, in UTC, for the Scheduled Instance to start. This value must be later than or equal to the earliest date and at most three months in the future.
MaxResults (integer) – The maximum number of results to return in a single call. This value can be between 5 and 300. The default value is 300. To retrieve the remaining results, make another call with the returned
NextToken
value.MaxSlotDurationInHours (integer) – The maximum available duration, in hours. This value must be greater than
MinSlotDurationInHours
and less than 1,720.MinSlotDurationInHours (integer) – The minimum available duration, in hours. The minimum required duration is 1,200 hours per year. For example, the minimum daily schedule is 4 hours, the minimum weekly schedule is 24 hours, and the minimum monthly schedule is 100 hours.
NextToken (string) – The token for the next set of results.
Recurrence (dict) –
[REQUIRED]
The schedule recurrence.
Frequency (string) –
The frequency (
Daily
,Weekly
, orMonthly
).Interval (integer) –
The interval quantity. The interval unit depends on the value of
Frequency
. For example, every 2 weeks or every 2 months.OccurrenceDays (list) –
The days. For a monthly schedule, this is one or more days of the month (1-31). For a weekly schedule, this is one or more days of the week (1-7, where 1 is Sunday). You can’t specify this value with a daily schedule. If the occurrence is relative to the end of the month, you can specify only a single day.
(integer) –
OccurrenceRelativeToEnd (boolean) –
Indicates whether the occurrence is relative to the end of the specified week or month. You can’t specify this value with a daily schedule.
OccurrenceUnit (string) –
The unit for
OccurrenceDays
(DayOfWeek
orDayOfMonth
). This value is required for a monthly schedule. You can’t specifyDayOfWeek
with a weekly schedule. You can’t specify this value with a daily schedule.
- Return type:
dict
- Returns:
Response Syntax
{ 'NextToken': 'string', 'ScheduledInstanceAvailabilitySet': [ { 'AvailabilityZone': 'string', 'AvailableInstanceCount': 123, 'FirstSlotStartTime': datetime(2015, 1, 1), 'HourlyPrice': 'string', 'InstanceType': 'string', 'MaxTermDurationInDays': 123, 'MinTermDurationInDays': 123, 'NetworkPlatform': 'string', 'Platform': 'string', 'PurchaseToken': 'string', 'Recurrence': { 'Frequency': 'string', 'Interval': 123, 'OccurrenceDaySet': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' }, 'SlotDurationInHours': 123, 'TotalScheduledInstanceHours': 123 }, ] }
Response Structure
(dict) –
Contains the output of DescribeScheduledInstanceAvailability.
NextToken (string) –
The token required to retrieve the next set of results. This value is
null
when there are no more results to return.ScheduledInstanceAvailabilitySet (list) –
Information about the available Scheduled Instances.
(dict) –
Describes a schedule that is available for your Scheduled Instances.
AvailabilityZone (string) –
The Availability Zone.
AvailableInstanceCount (integer) –
The number of available instances.
FirstSlotStartTime (datetime) –
The time period for the first schedule to start.
HourlyPrice (string) –
The hourly price for a single instance.
InstanceType (string) –
The instance type. You can specify one of the C3, C4, M4, or R3 instance types.
MaxTermDurationInDays (integer) –
The maximum term. The only possible value is 365 days.
MinTermDurationInDays (integer) –
The minimum term. The only possible value is 365 days.
NetworkPlatform (string) –
The network platform (
EC2-Classic
orEC2-VPC
).Platform (string) –
The platform (
Linux/UNIX
orWindows
).PurchaseToken (string) –
The purchase token. This token expires in two hours.
Recurrence (dict) –
The schedule recurrence.
Frequency (string) –
The frequency (
Daily
,Weekly
, orMonthly
).Interval (integer) –
The interval quantity. The interval unit depends on the value of
frequency
. For example, every 2 weeks or every 2 months.OccurrenceDaySet (list) –
The days. For a monthly schedule, this is one or more days of the month (1-31). For a weekly schedule, this is one or more days of the week (1-7, where 1 is Sunday).
(integer) –
OccurrenceRelativeToEnd (boolean) –
Indicates whether the occurrence is relative to the end of the specified week or month.
OccurrenceUnit (string) –
The unit for
occurrenceDaySet
(DayOfWeek
orDayOfMonth
).
SlotDurationInHours (integer) –
The number of hours in the schedule.
TotalScheduledInstanceHours (integer) –
The total number of hours for a single instance for the entire term.
Examples
This example describes a schedule that occurs every week on Sunday, starting on the specified date. Note that the output contains a single schedule as an example.
response = client.describe_scheduled_instance_availability( FirstSlotStartTimeRange={ 'EarliestTime': datetime(2016, 1, 31, 0, 0, 0, 6, 31, 0), 'LatestTime': datetime(2016, 1, 31, 4, 0, 0, 6, 31, 0), }, Recurrence={ 'Frequency': 'Weekly', 'Interval': 1, 'OccurrenceDays': [ 1, ], }, ) print(response)
Expected Output:
{ 'ScheduledInstanceAvailabilitySet': [ { 'AvailabilityZone': 'us-west-2b', 'AvailableInstanceCount': 20, 'FirstSlotStartTime': datetime(2016, 1, 31, 0, 0, 0, 6, 31, 0), 'HourlyPrice': '0.095', 'InstanceType': 'c4.large', 'MaxTermDurationInDays': 366, 'MinTermDurationInDays': 366, 'NetworkPlatform': 'EC2-VPC', 'Platform': 'Linux/UNIX', 'PurchaseToken': 'eyJ2IjoiMSIsInMiOjEsImMiOi...', 'Recurrence': { 'Frequency': 'Weekly', 'Interval': 1, 'OccurrenceDaySet': [ 1, ], 'OccurrenceRelativeToEnd': False, }, 'SlotDurationInHours': 23, 'TotalScheduledInstanceHours': 1219, }, ], 'ResponseMetadata': { '...': '...', }, }