CmdID

CmdID / aws / aws ec2

aws ec2 create-instance-event-window

Creates an event window in which scheduled events for the associated Amazon EC2 instances can run. AWS CLI reference

2 examples 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create an event window with a time range

The following create-instance-event-window example creates an event window with a time range. You can't also specify the cron-expression parameter.

aws ec2 create-instance-event-window --time-ranges StartWeekDay=monday,StartHour=2,EndWeekDay=wednesday,EndHour=8 --tag-specifications "ResourceType=instance-event-window,Tags=[{Key=K1,Value=V1}]" --name myEventWindowNameIdentify
--time-rangesThe time range for the event window.
--tag-specificationsThe tags to apply to the event window.
--nameThe name of the event window.
Its output
{
    "InstanceEventWindow": {
        "InstanceEventWindowId": "iew-0abcdef1234567890",
        "TimeRanges": [
            {
                "StartWeekDay": "monday",
                "StartHour": 2,
                "EndWeekDay": "wednesday",
                "EndHour": 8
            }
        ],
        "Name": "myEventWindowName",
        "State": "creating",
        "Tags": [
            {
                "Key": "K1",
                "Value": "V1"
            }
        ]
    }
}

For event window constraints, see Considerations in the Amazon EC2 User Guide.

Example 2: To create an event window with a cron expression

The following create-instance-event-window example creates an event window with a cron expression. You can't also specify the time-range parameter.

aws ec2 create-instance-event-window --cron-expression "* 21-23 * * 2,3" --tag-specifications "ResourceType=instance-event-window,Tags=[{Key=K1,Value=V1}]" --name myEventWindowNameIdentify
--cron-expressionThe cron expression for the event window, for example, * 0-4,20-23 * * 1,5.
--tag-specificationsThe tags to apply to the event window.
--nameThe name of the event window.
Its output
{
    "InstanceEventWindow": {
        "InstanceEventWindowId": "iew-0abcdef1234567890",
        "Name": "myEventWindowName",
        "CronExpression": "* 21-23 * * 2,3",
        "State": "creating",
        "Tags": [
            {
                "Key": "K1",
                "Value": "V1"
            }
        ]
    }
}

For event window constraints, see Considerations in the Amazon EC2 User Guide.

Options

5 in the AWS CLI reference
--cron-expressionThe cron expression for the event window, for example, * 0-4,20-23 * * 1,5.
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.
--nameThe name of the event window.
--tag-specificationsThe tags to apply to the event window.
--time-rangesThe time range for the event window.