

# FailoverVolumes

Initiates a failover for a single Multi-Availability Zone (Multi-AZ) EBS volume, or fails over all Multi-AZ volumes that are attached to an instance and have their active replica in the instance's Availability Zone. During a failover, EBS promotes the standby replica to the active replica. After the failover, the volume's active and standby Availability Zones are swapped.

Specify either a `VolumeId` or an `InstanceId`:
+  `VolumeId`: Fails over the specified volume.
+  `InstanceId`: Fails over all Multi-AZ volumes that are attached to the instance and have their active replica in the instance's Availability Zone. The following attached volumes are not failed over:
  + Volumes that are not Multi-AZ volumes.
  + Multi-AZ volumes whose standby replica is in the instance's Availability Zone.

  When you specify `InstanceId`, all of the volumes fail over together, and the failover is crash-consistent across all of the volumes. The failover is atomic: either all of the volumes fail over, or none of them do.

## Request Parameters
<a name="API_FailoverVolumes_RequestParameters"></a>

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see [Common Query Parameters](CommonParameters.md).

 **DryRun**   
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`.  
Type: Boolean  
Required: No

 **InstanceId**   
The ID of the instance. The instance must be in the Availability Zone specified by `SourceActiveAvailabilityZone` or `SourceActiveAvailabilityZoneId`. EBS fails over all Multi-AZ volumes that are attached to the instance and have their active replica in the specified Availability Zone.  
Either `VolumeId` or `InstanceId` must be specified, but not both.  
Type: String  
Required: No

 **SourceActiveAvailabilityZone**   
The name of the Availability Zone that the volume's active replica is in, or that the instance is in. For example, `us-east-1a`.  
Either `SourceActiveAvailabilityZone` or `SourceActiveAvailabilityZoneId` must be specified, but not both.  
Type: String  
Required: No

 **SourceActiveAvailabilityZoneId**   
The ID of the Availability Zone that the volume's active replica is in, or that the instance is in. For example, `use1-az1`.  
Either `SourceActiveAvailabilityZone` or `SourceActiveAvailabilityZoneId` must be specified, but not both.  
Type: String  
Required: No

 **VolumeId**   
The ID of the Multi-AZ volume to fail over. The Multi-AZ volume's active replica must be in the Availability Zone specified by `SourceActiveAvailabilityZone` or `SourceActiveAvailabilityZoneId`.  
Either `VolumeId` or `InstanceId` must be specified, but not both.  
Type: String  
Required: No

## Response Elements
<a name="API_FailoverVolumes_ResponseElements"></a>

The following elements are returned by the service.

 **requestId**   
The ID of the request.  
Type: String

 **volumeFailoverSet**   
The failover details for each volume that was failed over, including its volume ID and the Availability Zones that it failed over from and to.  
Type: Array of [VolumeFailoverInfo](API_VolumeFailoverInfo.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 64 items.

## Errors
<a name="API_FailoverVolumes_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_FailoverVolumes_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/ec2-2016-11-15/FailoverVolumes) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/ec2-2016-11-15/FailoverVolumes) 