File size: 3,985 Bytes
2d9b2d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
**Example 1: To associate one or more instances with an event window**

The following ``associate-instance-event-window`` example associates one or more instances with an event window. ::

    aws ec2 associate-instance-event-window \
        --region us-east-1 \
        --instance-event-window-id iew-0abcdef1234567890 \
        --association-target "InstanceIds=i-1234567890abcdef0,i-0598c7d356eba48d7"

Output::

    {
        "InstanceEventWindow": {
            "InstanceEventWindowId": "iew-0abcdef1234567890",
            "Name": "myEventWindowName",
            "CronExpression": "* 21-23 * * 2,3",
            "AssociationTarget": {
                "InstanceIds": [
                    "i-1234567890abcdef0",
                    "i-0598c7d356eba48d7"
                ],
                "Tags": [],
                "DedicatedHostIds": []
            },
            "State": "creating"
        }
    }

For event window constraints, see `Considerations <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html#event-windows-considerations>`__ in the Scheduled Events section of the *Amazon EC2 User Guide*.

**Example 2: To associate instance tags with an event window**

The following ``associate-instance-event-window`` example associates instance tags with an event window. Enter an ``instance-event-window-id`` parameter to specify the event window. To associate instance tags, specify the ``association-target`` parameter, and for the parameter value, specify one or more tags. ::

    aws ec2 associate-instance-event-window \
        --region us-east-1 \
        --instance-event-window-id iew-0abcdef1234567890 \
        --association-target "InstanceTags=[{Key=k2,Value=v2},{Key=k1,Value=v1}]"

Output::

    {
        "InstanceEventWindow": {
            "InstanceEventWindowId": "iew-0abcdef1234567890",
            "Name": "myEventWindowName",
            "CronExpression": "* 21-23 * * 2,3",
            "AssociationTarget": {
                "InstanceIds": [],
                "Tags": [
                    {
                        "Key": "k2",
                        "Value": "v2"
                    },
                    {
                        "Key": "k1",
                        "Value": "v1"
                    }
                ],
                "DedicatedHostIds": []
            },
            "State": "creating"
        }
    }

For event window constraints, see `Considerations <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html#event-windows-considerations>`__ in the Scheduled Events section of the *Amazon EC2 User Guide*.

**Example 3: To associate a Dedicated Host with an event window**

The following ``associate-instance-event-window`` example associates a Dedicated Host with an event window. Enter an ``instance-event-window-id`` parameter to specify the event window. To associate a Dedicated Host, specify the ``--association-target`` parameter, and for the parameter values, specify one of more Dedicated Host IDs. ::

    aws ec2 associate-instance-event-window \
        --region us-east-1 \
        --instance-event-window-id iew-0abcdef1234567890 \
        --association-target "DedicatedHostIds=h-029fa35a02b99801d"

Output::

    {
        "InstanceEventWindow": {
            "InstanceEventWindowId": "iew-0abcdef1234567890",
            "Name": "myEventWindowName",
            "CronExpression": "* 21-23 * * 2,3",
            "AssociationTarget": {
                "InstanceIds": [],
                "Tags": [],
                "DedicatedHostIds": [
                    "h-029fa35a02b99801d"
                ]
            },
            "State": "creating"
        }
    }

For event window constraints, see `Considerations <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html#event-windows-considerations>`__ in the Scheduled Events section of the *Amazon EC2 User Guide*.