instance_event_windows
Creates, updates, deletes, gets or lists an instance_event_windows resource.
Overview
| Name | instance_event_windows |
| Type | Resource |
| Id | aws.ec2.instance_event_windows |
Fields
The following fields are returned by SELECT queries:
- describe_instance_event_windows
| Name | Datatype | Description |
|---|---|---|
association_target | string | One or more targets associated with the event window. |
cron_expression | string | The cron expression defined for the event window. |
instance_event_window_id | string | The ID of the event window. |
name | string | The name of the event window. |
state | string | The current state of the event window. |
tags | string | The instance tags associated with the event window. |
time_ranges | string | One or more time ranges defined for the event window. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_instance_event_windows | select | region | DryRun, InstanceEventWindowId, Filter, MaxResults, NextToken | Describes the specified event windows or all event windows. If you specify event window IDs, the output includes information for only the specified event windows. If you specify filters, the output includes information for only those event windows that meet the filter criteria. If you do not specify event windows IDs or filters, the output includes information for all event windows, which can affect performance. We recommend that you use pagination to ensure that the operation returns quickly and successfully. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
create_instance_event_window | insert | region | DryRun, Name, TimeRange, CronExpression, TagSpecification | Creates an event window in which scheduled events for the associated Amazon EC2 instances can run. You can define either a set of time ranges or a cron expression when creating the event window, but not both. All event window times are in UTC. You can create up to 200 event windows per Amazon Web Services Region. When you create the event window, targets (instance IDs, Dedicated Host IDs, or tags) are not yet associated with it. To ensure that the event window can be used, you must associate one or more targets with it by using the AssociateInstanceEventWindow API. Event windows are applicable only for scheduled events that stop, reboot, or terminate instances. Event windows are not applicable for: Expedited scheduled events and network maintenance events. Unscheduled maintenance such as AutoRecovery and unplanned reboots. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
associate_instance_event_window | update | InstanceEventWindowId, AssociationTarget, region | DryRun | Associates one or more targets with an event window. Only one type of target (instance IDs, Dedicated Host IDs, or tags) can be specified with an event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
modify_instance_event_window | update | InstanceEventWindowId, region | DryRun, Name, TimeRange, CronExpression | Modifies the specified event window. You can define either a set of time ranges or a cron expression when modifying the event window, but not both. To modify the targets associated with the event window, use the AssociateInstanceEventWindow and DisassociateInstanceEventWindow API. If Amazon Web Services has already scheduled an event, modifying an event window won't change the time of the scheduled event. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
delete_instance_event_window | delete | InstanceEventWindowId, region | DryRun, ForceDelete | Deletes the specified event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
disassociate_instance_event_window | exec | InstanceEventWindowId, AssociationTarget, region | DryRun | Disassociates one or more targets from an event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide. |
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 |
|---|---|---|
AssociationTarget | object | One or more targets to disassociate from the specified event window. |
InstanceEventWindowId | string | The ID of the event window. |
region | string | AWS region (default: us-east-1) |
CronExpression | string | The cron expression of the event window, for example, * 0-4,20-23 * * 1,5. Constraints: Only hour and day of the week values are supported. For day of the week values, you can specify either integers 0 through 6, or alternative single values SUN through SAT. The minute, month, and year must be specified by *. The hour value must be one or a multiple range, for example, 0-4 or 0-4,20-23. Each hour range must be >= 2 hours, for example, 0-2 or 20-23. The event window must be >= 4 hours. The combined total time ranges in the event window must be >= 4 hours. For more information about cron expressions, see cron on the Wikipedia website. |
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 | One or more filters. dedicated-host-id - The event windows associated with the specified Dedicated Host ID. event-window-name - The event windows associated with the specified names. instance-id - The event windows associated with the specified instance ID. instance-tag - The event windows associated with the specified tag and value. instance-tag-key - The event windows associated with the specified tag key, regardless of the value. instance-tag-value - The event windows associated with the specified tag value, regardless of the key. tag:<key> - The key/value combination of a tag assigned to the event window. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value CMX, specify tag:Owner for the filter name and CMX for the filter value. tag-key - The key of a tag assigned to the event window. Use this filter to find all event windows that have a tag with a specific key, regardless of the tag value. tag-value - The value of a tag assigned to the event window. Use this filter to find all event windows that have a tag with a specific value, regardless of the tag key. |
ForceDelete | boolean | Specify true to force delete the event window. Use the force delete parameter if the event window is currently associated with targets. |
InstanceEventWindowId | array | The IDs of the event windows. |
MaxResults | 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. This value can be between 20 and 500. You cannot specify this parameter and the event window IDs parameter in the same call. |
Name | string | The name of the event window. |
NextToken | string | The token to request the next page of results. |
TagSpecification | array | The tags to apply to the event window. |
TimeRange | array | The time ranges of the event window. |
SELECT examples
- describe_instance_event_windows
Describes the specified event windows or all event windows. If you specify event window IDs, the output includes information for only the specified event windows. If you specify filters, the output includes information for only those event windows that meet the filter criteria. If you do not specify event windows IDs or filters, the output includes information for all event windows, which can affect performance. We recommend that you use pagination to ensure that the operation returns quickly and successfully. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
SELECT
association_target,
cron_expression,
instance_event_window_id,
name,
state,
tags,
time_ranges
FROM aws.ec2.instance_event_windows
WHERE region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND InstanceEventWindowId = '{{ InstanceEventWindowId }}'
AND Filter = '{{ Filter }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
;
INSERT examples
- create_instance_event_window
- Manifest
Creates an event window in which scheduled events for the associated Amazon EC2 instances can run. You can define either a set of time ranges or a cron expression when creating the event window, but not both. All event window times are in UTC. You can create up to 200 event windows per Amazon Web Services Region. When you create the event window, targets (instance IDs, Dedicated Host IDs, or tags) are not yet associated with it. To ensure that the event window can be used, you must associate one or more targets with it by using the AssociateInstanceEventWindow API. Event windows are applicable only for scheduled events that stop, reboot, or terminate instances. Event windows are not applicable for: Expedited scheduled events and network maintenance events. Unscheduled maintenance such as AutoRecovery and unplanned reboots. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
INSERT INTO aws.ec2.instance_event_windows (
region,
DryRun,
Name,
TimeRange,
CronExpression,
TagSpecification
)
SELECT
'{{ region }}',
'{{ DryRun }}',
'{{ Name }}',
'{{ TimeRange }}',
'{{ CronExpression }}',
'{{ TagSpecification }}'
RETURNING
association_target,
cron_expression,
instance_event_window_id,
name,
state,
tags,
time_ranges
;
# Description fields are for documentation purposes
- name: instance_event_windows
props:
- name: region
value: "{{ region }}"
description: Required parameter for the instance_event_windows resource.
- name: DryRun
value: {{ DryRun }}
description: 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.
description: 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.
- name: Name
value: "{{ Name }}"
description: The name of the event window.
description: The name of the event window.
- name: TimeRange
value: "{{ TimeRange }}"
description: The time range for the event window. If you specify a time range, you can't specify a cron expression.
description: The time range for the event window. If you specify a time range, you can't specify a cron expression.
- name: CronExpression
value: "{{ CronExpression }}"
description: The cron expression for the event window, for example, * 0-4,20-23 * * 1,5. If you specify a cron expression, you can't specify a time range. Constraints: Only hour and day of the week values are supported. For day of the week values, you can specify either integers 0 through 6, or alternative single values SUN through SAT. The minute, month, and year must be specified by *. The hour value must be one or a multiple range, for example, 0-4 or 0-4,20-23. Each hour range must be >= 2 hours, for example, 0-2 or 20-23. The event window must be >= 4 hours. The combined total time ranges in the event window must be >= 4 hours. For more information about cron expressions, see cron on the Wikipedia website.
description: The cron expression for the event window, for example, * 0-4,20-23 * * 1,5. If you specify a cron expression, you can't specify a time range. Constraints: Only hour and day of the week values are supported. For day of the week values, you can specify either integers 0 through 6, or alternative single values SUN through SAT. The minute, month, and year must be specified by *. The hour value must be one or a multiple range, for example, 0-4 or 0-4,20-23. Each hour range must be >= 2 hours, for example, 0-2 or 20-23. The event window must be >= 4 hours. The combined total time ranges in the event window must be >= 4 hours. For more information about cron expressions, see cron on the Wikipedia website.
- name: TagSpecification
value: "{{ TagSpecification }}"
description: The tags to apply to the event window.
description: The tags to apply to the event window.
UPDATE examples
- associate_instance_event_window
- modify_instance_event_window
Associates one or more targets with an event window. Only one type of target (instance IDs, Dedicated Host IDs, or tags) can be specified with an event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
UPDATE aws.ec2.instance_event_windows
SET
-- No updatable properties
WHERE
InstanceEventWindowId = '{{ InstanceEventWindowId }}' --required
AND AssociationTarget = '{{ AssociationTarget }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
RETURNING
association_target,
cron_expression,
instance_event_window_id,
name,
state,
tags,
time_ranges;
Modifies the specified event window. You can define either a set of time ranges or a cron expression when modifying the event window, but not both. To modify the targets associated with the event window, use the AssociateInstanceEventWindow and DisassociateInstanceEventWindow API. If Amazon Web Services has already scheduled an event, modifying an event window won't change the time of the scheduled event. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
UPDATE aws.ec2.instance_event_windows
SET
-- No updatable properties
WHERE
InstanceEventWindowId = '{{ InstanceEventWindowId }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
AND Name = '{{ Name}}'
AND TimeRange = '{{ TimeRange}}'
AND CronExpression = '{{ CronExpression}}'
RETURNING
association_target,
cron_expression,
instance_event_window_id,
name,
state,
tags,
time_ranges;
DELETE examples
- delete_instance_event_window
Deletes the specified event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
DELETE FROM aws.ec2.instance_event_windows
WHERE InstanceEventWindowId = '{{ InstanceEventWindowId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
AND ForceDelete = '{{ ForceDelete }}'
;
Lifecycle Methods
- disassociate_instance_event_window
Disassociates one or more targets from an event window. For more information, see Define event windows for scheduled events in the Amazon EC2 User Guide.
EXEC aws.ec2.instance_event_windows.disassociate_instance_event_window
@InstanceEventWindowId='{{ InstanceEventWindowId }}' --required,
@AssociationTarget='{{ AssociationTarget }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;