

# MediaConnect flow maintenance
<a name="maintenance"></a>

AWS Elemental MediaConnect routinely performs maintenance on underlying systems for security, reliability, and operational performance. The maintenance activities include actions such as patching the operating system, updating drivers, or installing software and patches.

**Note**  
 As part of the maintenance process, your flow must be restarted.

 You can select the day and time that maintenance events occur. This is called a *maintenance window* and is used every time a maintenance event is required. If you need to change the day and time, you can edit the maintenance window.

When maintenance is required for your flow, AWS will assign your flow a **Required by** date. If you do not have a maintenance window configured for the flow, visit [Setting maintenance windows](setting-flow-maintenance.md). You can view the flows that require maintenance on the MediaConnect console or by using the AWS CLI, visit [Viewing flows that require maintenance](viewing-flows-maintenance.md). When a **Required by** date has been assigned to your flow, you can select a specific date for that maintenance to occur. The selected **Maintenance date** will only apply to the next maintenance event.

If you do not configure a maintenance window, AWS selects a maintenance window for you—automatically. We recommend that you set a maintenance window for each flow and allow MediaConnect to perform the restart automatically during that window. Allowing MediaConnect to perform the restart results in less downtime for your flow. If a flow requires maintenance and you choose to manually restart the flow, the status of that flow's maintenance will change to **Canceled**. The manually restarted flow will still apply the required updates, but you will not receive the **Completed successfully** status. Since you performed the restart manually, the maintenance is considered **Canceled** because MediaConnect no longer requires updates for that flow. 

The duration of the maintenance window is two hours. 

**Important**  
The two hour window duration does not mean the flow will be affected for two hours. The flow will perform a normal stop and start at some point within the two hour window.

Example: If you configure a flow's maintenance window **Start hour** to be 02:00, the flow will restart at some point between 02:00 and 04:00.

In the event that maintenance does not occur at the scheduled date and time, MediaConnect will reschedule it to occur in the following week’s maintenance window, or automatically set a new window if you don't have one configured.

**Topics**
+ [

# Viewing MediaConnect flows that require maintenance
](viewing-flows-maintenance.md)
+ [

# Setting maintenance windows
](setting-flow-maintenance.md)

# Viewing MediaConnect flows that require maintenance
<a name="viewing-flows-maintenance"></a>

You can view flows that require maintenance in the MediaConnect console or by using the AWS CLI.

**Note**  
If your flow does not have a **Required by date** (console) or a **MaintenanceDeadline** (AWS CLI), maintenance is not currently required for that flow.

**To view the flows that require maintenance (console)**

1. Open the MediaConnect console at [https://console.aws.amazon.com/mediaconnect/](https://console.aws.amazon.com/mediaconnect/).

1. In the navigation pane, choose **Flows**.

1. In the **Maintenance window** column, you can view the **Required by date**. Alternatively, you can view the **Required by date** on an individual flows **Details** page.

1. All listed flows must be restarted by the date shown.

**To view the flows that require maintenance (AWS CLI)**
+ In the AWS CLI, you can use the `list-flows` command to view all flows and their maintenance statuses. Additionally, you can view a specific flows maintenance status by using the `describe-flow` command:

  ```
  aws mediaconnect list-flows
  ```

  or

  ```
  aws mediaconnect describe-flow --flow-arn arn:aws:mediaconnect:us-east-1:111122223333:flow:1-23aBC45dEF67hiJ8-12AbC34DE5fG:BasketballGame
  ```

  The following example shows the return value of `list-flows`. The return value for `describe-flow` uses a similar structure.

  In this example, the Flow named *BasketballGame* has a **MaintenanceDay** and **MaintenanceStartHour** set for recurring maintenance. The Flow named *AwardsShow* has the **MaintenanceDay** and **MaintenanceStartHour** set, but also a **MaintenanceDeadline**. The **MaintenanceDeadline** is the required due date for maintenance restarts on this flow. The *AwardsShow* flow has also scheduled a specific date for the maintenance restarts to occur, seen in the **MaintenanceScheduledDate** value. The **MaintenanceScheduledDate** must occur before the **MaintenanceDeadline**:

  ```
  {
      "Flows": [
          {
              "AvailabilityZone": "us-west-2d",
              "Description": "Example flow description",
              "FlowArn": "arn:aws:mediaconnect:us-east-1:111122223333:flow:1-23aBC45dEF67hiJ8-12AbC34DE5fG:BasketballGame",
              "Name": "BasketballGame",
              "SourceType": "OWNED",
              "Status": "STANDBY",
              "Maintenance": {
                  "MaintenanceDay": "Monday",
                  "MaintenanceStartHour": "08:00"}
          },
          {
              "AvailabilityZone": "us-west-2b",
              "Description": "Example flow description",
              "FlowArn": "arn:aws:mediaconnect:us-east-1:111122223333:flow:2-3aBC45dEF67hiJ8k-2AbC34DE5fGa6:AwardsShow",
              "Name": "AwardsShow",
              "SourceType": "OWNED",
              "Status": "ACTIVE",
              "Maintenance": {
                  "MaintenanceDay": "Saturday",
                  "MaintenanceDeadline": "2021-10-25T22:15:56Z",
                  "MaintenanceScheduledDate": "2021-10-23",
                  "MaintenanceStartHour": "23:00"}
           }
      ]
  }
  ```

# Setting maintenance windows
<a name="setting-flow-maintenance"></a>

You can select the day and time that maintenance events occur. This is called a *maintenance window*. These windows help minimize maintenance impact on your production.

A maintenance window is used every time a maintenance event is required. You can set a maintenance window while creating a flow, or add the window to an existing flow. To change the day and time of a maintenance window, you can use the MediaConnect console or the AWS CLI. Also, if maintenance is required, you can set a specific date for the maintenance to occur. The date you select must be before the required maintenance date.

If you don't set a maintenance window, MediaConnect restarts the flows for you. We recommend that you set a maintenance window for each flow that requires maintenance.

**To set a maintenance window (console)**

1. Open the MediaConnect console at [https://console.aws.amazon.com/mediaconnect/](https://console.aws.amazon.com/mediaconnect/).

1. In the navigation pane, choose **Flows**. When a flow requires maintenance, it will display a **Required by** date under the **Maintenance window** column.

1. Select the flow or flows. You can set a unique maintenance window for each flow. Alternatively, you can set maintenance windows in bulk by selecting multiple flows.

1. Under the **Flow actions** drop-down menu, select **Edit flow maintenance window**.

1. 
   + Select the day of the week maintenance will occur in the **Start day** field.
   + Select the time maintenance will occur in the **Start hour** field. Time is presented in UTC.
   + If maintenance is required, you have the option to select a specific date in the **Maintenance window date** field. The selected date must occur before the required maintenance date and time.
   + Select **Update**.

1. You can verify the window by viewing the **Maintenance window** column on the **Flows** dashboard.

**To set a maintenance window (AWS CLI)**

1. In the AWS CLI, use the `update-flow` command with the `--maintenance` option. You will also need to use the `--flow-arn` option to specify which flow you are working with. 

   The `--maintenance` option accepts the following arguments:
   + `MaintenanceDay`
   + `MaintenanceStartHour`
   + `MaintenanceScheduleDate` - This argument is only accepted when there is a required maintenance date assigned by AWS.

1. Use the following command to update the reoccurring maintenance day and time. The maintenance day and time can be configured at any time, regardless of required maintenance status.

   ```
   aws mediaconnect update-flow --flow-arn arn:aws:mediaconnect:us-east-1:111122223333:flow:1-23aBC45dEF67hiJ8-12AbC34DE5fG:BasketballGame --maintenance MaintenanceDay='Tuesday',MaintenanceStartHour='10:00'
   ```

   The following example shows the return value when only setting the **MaintenanceDay** and **MaintenanceStartHour**:

   ```
   {
       "Flows": [
           {
               "AvailabilityZone": "us-west-2d",
               "Description": "Example flow description",
               "FlowArn": "arn:aws:mediaconnect:us-east-1:111122223333:flow:1-23aBC45dEF67hiJ8-12AbC34DE5fG:BasketballGame",
               "Name": "BasketballGame",
               "SourceType": "OWNED",
               "Status": "STANDBY",
               "Maintenance": {
                   "MaintenanceDay": "Tuesday",
                   "MaintenanceStartHour": "10:00"}
           }
       ]
   }
   ```

1. Use the following command to set a specific maintenance date, in addition to setting the reoccurring maintenance day and time. The maintenance scheduled date can only be set when AWS requires maintenance on the flow.

   ```
   aws mediaconnect update-flow --flow-arn arn:aws:mediaconnect:us-east-1:111122223333:flow:2-3aBC45dEF67hiJ8k-2AbC34DE5fGa6:AwardsShow --maintenance MaintenanceDay='Saturday',MaintenanceStartHour='23:00',MaintenanceScheduledDate='2021-10-23'
   ```

   The following example shows the return value when setting the **MaintenanceDay**, **MaintenanceStartHour**, and **MaintenanceScheduledDate**:

   ```
   {
       "Flows": [
           {
               "AvailabilityZone": "us-west-2b",
               "Description": "Example flow description",
               "FlowArn": "arn:aws:mediaconnect:us-east-1:111122223333:flow:2-3aBC45dEF67hiJ8k-2AbC34DE5fGa6:AwardsShow",
               "Name": "AwardsShow",
               "SourceType": "OWNED",
               "Status": "ACTIVE",
               "Maintenance": {
                   "MaintenanceDay": "Saturday",
                   "MaintenanceDeadline": "2021-10-25T22:15:56Z",
                   "MaintenanceScheduledDate": "2021-10-23",
                   "MaintenanceStartHour": "23:00"}
            }
       ]
   }
   ```

The selected day and time are used for all future recurring maintenance events on that flow. Repeat these steps to add or edit additional maintenance windows. After maintenance is complete, the **Maintenance status** column on the **Flows** dashboard will display **No maintenance required**.