scheduled_instances
Creates, updates, deletes, gets or lists a scheduled_instances resource.
Overview
| Name | scheduled_instances |
| Type | Resource |
| Id | aws.ec2.scheduled_instances |
Fields
The following fields are returned by SELECT queries:
- describe_scheduled_instances
| Name | Datatype | Description |
|---|---|---|
availability_zone | string | The Availability Zone. |
create_date | string | The date when the Scheduled Instance was purchased. |
hourly_price | string | The hourly price for a single instance. |
instance_count | integer | The number of instances. |
instance_type | string | The instance type. |
network_platform | string | The network platform. |
next_slot_start_time | string | The time for the next schedule to start. |
platform | string | The platform (Linux/UNIX or Windows). |
previous_slot_end_time | string | The time that the previous schedule ended or will end. |
recurrence | string | The schedule recurrence. |
scheduled_instance_id | string | The Scheduled Instance ID. |
slot_duration_in_hours | integer | The number of hours in the schedule. |
term_end_date | string | The end date for the Scheduled Instance. |
term_start_date | string | The start date for the Scheduled Instance. |
total_scheduled_instance_hours | integer | The total number of hours for a single instance for the entire term. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_scheduled_instances | select | region | DryRun, Filter, MaxResults, NextToken, ScheduledInstanceId, SlotStartTimeRange | Describes the specified Scheduled Instances or all your Scheduled Instances. |
purchase_scheduled_instances | exec | PurchaseRequest, region | ClientToken, DryRun | 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. |
run_scheduled_instances | exec | LaunchSpecification, ScheduledInstanceId, region | ClientToken, DryRun, InstanceCount | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
LaunchSpecification | object | The launch specification. You must match the instance type, Availability Zone, network, and platform of the schedule that you purchased. |
PurchaseRequest | array | The purchase requests. |
ScheduledInstanceId | string | The Scheduled Instance ID. |
region | string | AWS region (default: us-east-1) |
ClientToken | string | Unique, case-sensitive identifier that ensures the idempotency of the request. For more information, see Ensuring Idempotency. |
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 is UnauthorizedOperation. |
Filter | array | The 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). |
InstanceCount | integer | The number of instances. Default: 1 |
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 100. To retrieve the remaining results, make another call with the returned NextToken value. |
NextToken | string | The token for the next set of results. |
ScheduledInstanceId | array | The Scheduled Instance IDs. |
SlotStartTimeRange | object | The time period for the first schedule to start. |
SELECT examples
- describe_scheduled_instances
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
- purchase_scheduled_instances
- run_scheduled_instances
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 }}
;
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.
EXEC aws.ec2.scheduled_instances.run_scheduled_instances
@LaunchSpecification='{{ LaunchSpecification }}' --required,
@ScheduledInstanceId='{{ ScheduledInstanceId }}' --required,
@region='{{ region }}' --required,
@ClientToken='{{ ClientToken }}',
@DryRun={{ DryRun }},
@InstanceCount='{{ InstanceCount }}'
;