Skip to main content

scheduled_instances

Creates, updates, deletes, gets or lists a scheduled_instances resource.

Overview

Namescheduled_instances
TypeResource
Idaws.ec2.scheduled_instances

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
availability_zonestringThe Availability Zone.
create_datestringThe date when the Scheduled Instance was purchased.
hourly_pricestringThe hourly price for a single instance.
instance_countintegerThe number of instances.
instance_typestringThe instance type.
network_platformstringThe network platform.
next_slot_start_timestringThe time for the next schedule to start.
platformstringThe platform (Linux/UNIX or Windows).
previous_slot_end_timestringThe time that the previous schedule ended or will end.
recurrencestringThe schedule recurrence.
scheduled_instance_idstringThe Scheduled Instance ID.
slot_duration_in_hoursintegerThe number of hours in the schedule.
term_end_datestringThe end date for the Scheduled Instance.
term_start_datestringThe start date for the Scheduled Instance.
total_scheduled_instance_hoursintegerThe total number of hours for a single instance for the entire term.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_scheduled_instancesselectregionDryRun, Filter, MaxResults, NextToken, ScheduledInstanceId, SlotStartTimeRangeDescribes the specified Scheduled Instances or all your Scheduled Instances.
purchase_scheduled_instancesexecPurchaseRequest, regionClientToken, DryRunYou can no longer purchase Scheduled Instances. Purchases the 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. After you purchase a Scheduled Instance, you must call RunScheduledInstances during each scheduled time period. After you purchase a Scheduled Instance, you can't cancel, modify, or resell your purchase.
run_scheduled_instancesexecLaunchSpecification, ScheduledInstanceId, regionClientToken, DryRun, InstanceCountLaunches 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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
LaunchSpecificationobjectThe launch specification. You must match the instance type, Availability Zone, network, and platform of the schedule that you purchased.
PurchaseRequestarrayThe purchase requests.
ScheduledInstanceIdstringThe Scheduled Instance ID.
regionstringAWS region (default: us-east-1)
ClientTokenstringUnique, case-sensitive identifier that ensures the idempotency of the request. For more information, see Ensuring Idempotency.
DryRunbooleanChecks 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.
FilterarrayThe filters. availability-zone - The Availability Zone (for example, us-west-2a). instance-type - The instance type (for example, c4.large). platform - The platform (Linux/UNIX or Windows).
InstanceCountintegerThe number of instances. Default: 1
MaxResultsintegerThe maximum number of results to return in a single call. This value can be between 5 and 300. The default value is 100. To retrieve the remaining results, make another call with the returned NextToken value.
NextTokenstringThe token for the next set of results.
ScheduledInstanceIdarrayThe Scheduled Instance IDs.
SlotStartTimeRangeobjectThe time period for the first schedule to start.

SELECT examples

Describes the specified Scheduled Instances or all your Scheduled Instances.

SELECT
availability_zone,
create_date,
hourly_price,
instance_count,
instance_type,
network_platform,
next_slot_start_time,
platform,
previous_slot_end_time,
recurrence,
scheduled_instance_id,
slot_duration_in_hours,
term_end_date,
term_start_date,
total_scheduled_instance_hours
FROM aws.ec2.scheduled_instances
WHERE region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND Filter = '{{ Filter }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
AND ScheduledInstanceId = '{{ ScheduledInstanceId }}'
AND SlotStartTimeRange = '{{ SlotStartTimeRange }}'
;

Lifecycle Methods

You can no longer purchase Scheduled Instances. Purchases the 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. After you purchase a Scheduled Instance, you must call RunScheduledInstances during each scheduled time period. After you purchase a Scheduled Instance, you can't cancel, modify, or resell your purchase.

EXEC aws.ec2.scheduled_instances.purchase_scheduled_instances
@PurchaseRequest='{{ PurchaseRequest }}' --required,
@region='{{ region }}' --required,
@ClientToken='{{ ClientToken }}',
@DryRun={{ DryRun }}
;