2016/01/15 - Amazon Elastic Compute Cloud - 4 new api methods
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.
Request Syntax
client.describe_scheduled_instance_availability( DryRun=True|False, Recurrence={ 'Frequency': 'string', 'Interval': 123, 'OccurrenceDays': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' }, FirstSlotStartTimeRange={ 'EarliestTime': datetime(2015, 1, 1), 'LatestTime': datetime(2015, 1, 1) }, MinSlotDurationInHours=123, MaxSlotDurationInHours=123, NextToken='string', MaxResults=123, Filters=[ { 'Name': 'string', 'Values': [ 'string', ] }, ] )
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 is UnauthorizedOperation .
dict
[REQUIRED]
The schedule recurrence.
Frequency (string) --
The frequency ( Daily , Weekly , or Monthly ).
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 or DayOfMonth ). This value is required for a monthly schedule. You can't specify DayOfWeek with a weekly schedule. You can't specify this value with a daily schedule.
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.
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.
integer
The maximum available duration, in hours. This value must be greater than MinSlotDurationInHours and less than 1,720.
string
The token for the next set of results.
integer
The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value.
list
One or more 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 or EC2-VPC ).
platform - The platform ( Linux/UNIX or Windows ).
(dict) --
A filter name and value pair that is used to return a more specific list of results. Filters can be used to match a set of resources by various criteria, such as tags, attributes, or IDs.
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
One or more filter values. Filter values are case-sensitive.
(string) --
dict
Response Syntax
{ 'NextToken': 'string', 'ScheduledInstanceAvailabilitySet': [ { 'InstanceType': 'string', 'Platform': 'string', 'NetworkPlatform': 'string', 'AvailabilityZone': 'string', 'PurchaseToken': 'string', 'SlotDurationInHours': 123, 'Recurrence': { 'Frequency': 'string', 'Interval': 123, 'OccurrenceDaySet': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' }, 'FirstSlotStartTime': datetime(2015, 1, 1), 'HourlyPrice': 'string', 'TotalScheduledInstanceHours': 123, 'AvailableInstanceCount': 123, 'MinTermDurationInDays': 123, 'MaxTermDurationInDays': 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.
InstanceType (string) --
The instance type. You can specify one of the C3, C4, M4, or R3 instance types.
Platform (string) --
The platform ( Linux/UNIX or Windows ).
NetworkPlatform (string) --
The network platform ( EC2-Classic or EC2-VPC ).
AvailabilityZone (string) --
The Availability Zone.
PurchaseToken (string) --
The purchase token. This token expires in two hours.
SlotDurationInHours (integer) --
The number of hours in the schedule.
Recurrence (dict) --
The schedule recurrence.
Frequency (string) --
The frequency ( Daily , Weekly , or Monthly ).
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 or DayOfMonth ).
FirstSlotStartTime (datetime) --
The time period for the first schedule to start.
HourlyPrice (string) --
The hourly price for a single instance.
TotalScheduledInstanceHours (integer) --
The total number of hours for a single instance for the entire term.
AvailableInstanceCount (integer) --
The number of available instances.
MinTermDurationInDays (integer) --
The minimum term. The only possible value is 365 days.
MaxTermDurationInDays (integer) --
The maximum term. The only possible value is 365 days.
Purchases one or more Scheduled Instances with the specified schedule.
Scheduled Instances enable you to purchase Amazon EC2 compute capacity by the hour for a one-year term. Before you can purchase a Scheduled Instance, you must call DescribeScheduledInstanceAvailability to check for available schedules and obtain a purchase token.
Request Syntax
client.purchase_scheduled_instances( DryRun=True|False, ClientToken='string', PurchaseRequests=[ { 'PurchaseToken': 'string', 'InstanceCount': 123 }, ] )
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 is UnauthorizedOperation .
string
Unique, case-sensitive identifier that ensures the idempotency of the request. For more information, see Ensuring Idempotency.
list
[REQUIRED]
One or more purchase requests.
(dict) --
Describes a request to purchase Scheduled Instances.
PurchaseToken (string) --
The purchase token.
InstanceCount (integer) --
The number of instances.
dict
Response Syntax
{ 'ScheduledInstanceSet': [ { 'ScheduledInstanceId': 'string', 'InstanceType': 'string', 'Platform': 'string', 'NetworkPlatform': 'string', 'AvailabilityZone': 'string', 'SlotDurationInHours': 123, 'Recurrence': { 'Frequency': 'string', 'Interval': 123, 'OccurrenceDaySet': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' }, 'PreviousSlotEndTime': datetime(2015, 1, 1), 'NextSlotStartTime': datetime(2015, 1, 1), 'HourlyPrice': 'string', 'TotalScheduledInstanceHours': 123, 'InstanceCount': 123, 'TermStartDate': datetime(2015, 1, 1), 'TermEndDate': datetime(2015, 1, 1), 'CreateDate': datetime(2015, 1, 1) }, ] }
Response Structure
(dict) --
Contains the output of PurchaseScheduledInstances.
ScheduledInstanceSet (list) --
Information about the Scheduled Instances.
(dict) --
Describes a Scheduled Instance.
ScheduledInstanceId (string) --
The Scheduled Instance ID.
InstanceType (string) --
The instance type.
Platform (string) --
The platform ( Linux/UNIX or Windows ).
NetworkPlatform (string) --
The network platform ( EC2-Classic or EC2-VPC ).
AvailabilityZone (string) --
The Availability Zone.
SlotDurationInHours (integer) --
The number of hours in the schedule.
Recurrence (dict) --
The schedule recurrence.
Frequency (string) --
The frequency ( Daily , Weekly , or Monthly ).
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 or DayOfMonth ).
PreviousSlotEndTime (datetime) --
The time that the previous schedule ended or will end.
NextSlotStartTime (datetime) --
The time for the next schedule to start.
HourlyPrice (string) --
The hourly price for a single instance.
TotalScheduledInstanceHours (integer) --
The total number of hours for a single instance for the entire term.
InstanceCount (integer) --
The number of instances.
TermStartDate (datetime) --
The start date for the Scheduled Instance.
TermEndDate (datetime) --
The end date for the Scheduled Instance.
CreateDate (datetime) --
The date when the Scheduled Instance was purchased.
Launches the specified Scheduled Instances.
Before you can launch a Scheduled Instance, you must purchase it and obtain an identifier using PurchaseScheduledInstances.
You must launch a Scheduled Instance during its scheduled time period. You can't stop or reboot a Scheduled Instance, but you can terminate it as needed. If you terminate a Scheduled Instance before the current scheduled time period ends, you can launch it again after a few minutes.
Request Syntax
client.run_scheduled_instances( DryRun=True|False, ClientToken='string', InstanceCount=123, ScheduledInstanceId='string', LaunchSpecification={ 'ImageId': 'string', 'KeyName': 'string', 'SecurityGroupIds': [ 'string', ], 'UserData': 'string', 'Placement': { 'AvailabilityZone': 'string', 'GroupName': 'string' }, 'KernelId': 'string', 'InstanceType': 'string', 'RamdiskId': 'string', 'BlockDeviceMappings': [ { 'DeviceName': 'string', 'NoDevice': 'string', 'VirtualName': 'string', 'Ebs': { 'SnapshotId': 'string', 'VolumeSize': 123, 'DeleteOnTermination': True|False, 'VolumeType': 'string', 'Iops': 123, 'Encrypted': True|False } }, ], 'Monitoring': { 'Enabled': True|False }, 'SubnetId': 'string', 'NetworkInterfaces': [ { 'NetworkInterfaceId': 'string', 'DeviceIndex': 123, 'SubnetId': 'string', 'Description': 'string', 'PrivateIpAddress': 'string', 'PrivateIpAddressConfigs': [ { 'PrivateIpAddress': 'string', 'Primary': True|False }, ], 'SecondaryPrivateIpAddressCount': 123, 'AssociatePublicIpAddress': True|False, 'Groups': [ 'string', ], 'DeleteOnTermination': True|False }, ], 'IamInstanceProfile': { 'Arn': 'string', 'Name': 'string' }, 'EbsOptimized': True|False } )
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 is UnauthorizedOperation .
string
Unique, case-sensitive identifier that ensures the idempotency of the request. For more information, see Ensuring Idempotency.
integer
The number of instances.
Default: 1
string
[REQUIRED]
The Scheduled Instance ID.
dict
[REQUIRED]
The launch specification.
ImageId (string) -- [REQUIRED]
The ID of the Amazon Machine Image (AMI).
KeyName (string) --
The name of the key pair.
SecurityGroupIds (list) --
The IDs of one or more security groups.
(string) --
UserData (string) --
The base64-encoded MIME user data.
Placement (dict) --
The placement information.
AvailabilityZone (string) --
The Availability Zone.
GroupName (string) --
The name of the placement group.
KernelId (string) --
The ID of the kernel.
InstanceType (string) --
The instance type.
RamdiskId (string) --
The ID of the RAM disk.
BlockDeviceMappings (list) --
One or more block device mapping entries.
(dict) --
Describes a block device mapping for a Scheduled Instance.
DeviceName (string) --
The device name exposed to the instance (for example, /dev/sdh or xvdh ).
NoDevice (string) --
Suppresses the specified device included in the block device mapping of the AMI.
VirtualName (string) --
The virtual device name ( ephemeral N). Instance store volumes are numbered starting from 0. An instance type with two available instance store volumes can specify mappings for ephemeral0 and ephemeral1 .The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.
Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.
Ebs (dict) --
Parameters used to set up EBS volumes automatically when the instance is launched.
SnapshotId (string) --
The ID of the snapshot.
VolumeSize (integer) --
The size of the volume, in GiB.
Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
DeleteOnTermination (boolean) --
Indicates whether the volume is deleted on instance termination.
VolumeType (string) --
The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.
Default: standard
Iops (integer) --
The number of I/O operations per second (IOPS) that the volume supports. For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that are provisioned for the volume. For General Purpose (SSD) volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose (SSD) baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .
Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and 3 to 10000 for General Purpose (SSD) volumes.
Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create standard or gp2 volumes.
Encrypted (boolean) --
Indicates whether the volume is encrypted. You can attached encrypted volumes only to instances that support them.
Monitoring (dict) --
Enable or disable monitoring for the instances.
Enabled (boolean) --
Indicates whether monitoring is enabled.
SubnetId (string) --
The ID of the subnet in which to launch the instances.
NetworkInterfaces (list) --
One or more network interfaces.
(dict) --
Describes a network interface for a Scheduled Instance.
NetworkInterfaceId (string) --
The ID of the network interface.
DeviceIndex (integer) --
The index of the device for the network interface attachment.
SubnetId (string) --
The ID of the subnet.
Description (string) --
The description.
PrivateIpAddress (string) --
The IP address of the network interface within the subnet.
PrivateIpAddressConfigs (list) --
The private IP addresses.
(dict) --
Describes a private IP address for a Scheduled Instance.
PrivateIpAddress (string) --
The IP address.
Primary (boolean) --
Indicates whether this is a primary IP address. Otherwise, this is a secondary IP address.
SecondaryPrivateIpAddressCount (integer) --
The number of secondary private IP addresses.
AssociatePublicIpAddress (boolean) --
Indicates whether to assign a public IP address to instances launched in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true .
Groups (list) --
The IDs of one or more security groups.
(string) --
DeleteOnTermination (boolean) --
Indicates whether to delete the interface when the instance is terminated.
IamInstanceProfile (dict) --
The IAM instance profile.
Arn (string) --
The Amazon Resource Name (ARN).
Name (string) --
The name.
EbsOptimized (boolean) --
Indicates whether the instances are optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.
Default: false
dict
Response Syntax
{ 'InstanceIdSet': [ 'string', ] }
Response Structure
(dict) --
Contains the output of RunScheduledInstances.
InstanceIdSet (list) --
The IDs of the newly launched instances.
(string) --
Describes one or more of your Scheduled Instances.
Request Syntax
client.describe_scheduled_instances( DryRun=True|False, ScheduledInstanceIds=[ 'string', ], SlotStartTimeRange={ 'EarliestTime': datetime(2015, 1, 1), 'LatestTime': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123, Filters=[ { 'Name': 'string', 'Values': [ 'string', ] }, ] )
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 is UnauthorizedOperation .
list
One or more Scheduled Instance IDs.
(string) --
dict
The time period for the first schedule to start.
EarliestTime (datetime) --
The earliest date and time, in UTC, for the Scheduled Instance to start.
LatestTime (datetime) --
The latest date and time, in UTC, for the Scheduled Instance to start.
string
The token for the next set of results.
integer
The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value.
list
One or more 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 or EC2-VPC ).
platform - The platform ( Linux/UNIX or Windows ).
(dict) --
A filter name and value pair that is used to return a more specific list of results. Filters can be used to match a set of resources by various criteria, such as tags, attributes, or IDs.
Name (string) --
The name of the filter. Filter names are case-sensitive.
Values (list) --
One or more filter values. Filter values are case-sensitive.
(string) --
dict
Response Syntax
{ 'NextToken': 'string', 'ScheduledInstanceSet': [ { 'ScheduledInstanceId': 'string', 'InstanceType': 'string', 'Platform': 'string', 'NetworkPlatform': 'string', 'AvailabilityZone': 'string', 'SlotDurationInHours': 123, 'Recurrence': { 'Frequency': 'string', 'Interval': 123, 'OccurrenceDaySet': [ 123, ], 'OccurrenceRelativeToEnd': True|False, 'OccurrenceUnit': 'string' }, 'PreviousSlotEndTime': datetime(2015, 1, 1), 'NextSlotStartTime': datetime(2015, 1, 1), 'HourlyPrice': 'string', 'TotalScheduledInstanceHours': 123, 'InstanceCount': 123, 'TermStartDate': datetime(2015, 1, 1), 'TermEndDate': datetime(2015, 1, 1), 'CreateDate': datetime(2015, 1, 1) }, ] }
Response Structure
(dict) --
Contains the output of DescribeScheduledInstances.
NextToken (string) --
The token required to retrieve the next set of results. This value is null when there are no more results to return.
ScheduledInstanceSet (list) --
Information about the Scheduled Instances.
(dict) --
Describes a Scheduled Instance.
ScheduledInstanceId (string) --
The Scheduled Instance ID.
InstanceType (string) --
The instance type.
Platform (string) --
The platform ( Linux/UNIX or Windows ).
NetworkPlatform (string) --
The network platform ( EC2-Classic or EC2-VPC ).
AvailabilityZone (string) --
The Availability Zone.
SlotDurationInHours (integer) --
The number of hours in the schedule.
Recurrence (dict) --
The schedule recurrence.
Frequency (string) --
The frequency ( Daily , Weekly , or Monthly ).
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 or DayOfMonth ).
PreviousSlotEndTime (datetime) --
The time that the previous schedule ended or will end.
NextSlotStartTime (datetime) --
The time for the next schedule to start.
HourlyPrice (string) --
The hourly price for a single instance.
TotalScheduledInstanceHours (integer) --
The total number of hours for a single instance for the entire term.
InstanceCount (integer) --
The number of instances.
TermStartDate (datetime) --
The start date for the Scheduled Instance.
TermEndDate (datetime) --
The end date for the Scheduled Instance.
CreateDate (datetime) --
The date when the Scheduled Instance was purchased.