EC2 / Client / failover_volumes

failover_volumes

EC2.Client.failover_volumes(**kwargs)

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.

See also: AWS API Documentation

Request Syntax

response = client.failover_volumes(
    VolumeId='string',
    InstanceId='string',
    SourceActiveAvailabilityZone='string',
    SourceActiveAvailabilityZoneId='string',
    DryRun=True|False
)
Parameters:
  • VolumeId (string) –

    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.

  • InstanceId (string) –

    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.

  • SourceActiveAvailabilityZone (string) –

    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.

  • SourceActiveAvailabilityZoneId (string) –

    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.

  • 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.

Return type:

dict

Returns:

Response Syntax

{
    'VolumeFailovers': [
        {
            'VolumeId': 'string',
            'SourceActiveAvailabilityZone': 'string',
            'SourceActiveAvailabilityZoneId': 'string',
            'SourceStandbyAvailabilityZones': [
                {
                    'AvailabilityZone': 'string',
                    'AvailabilityZoneId': 'string'
                },
            ],
            'TargetActiveAvailabilityZone': 'string',
            'TargetActiveAvailabilityZoneId': 'string',
            'TargetStandbyAvailabilityZones': [
                {
                    'AvailabilityZone': 'string',
                    'AvailabilityZoneId': 'string'
                },
            ]
        },
    ]
}

Response Structure

  • (dict) –

    • VolumeFailovers (list) –

      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.

      • (dict) –

        Describes a single volume that was failed over, including its active and standby Availability Zones before and after the failover.

        • VolumeId (string) –

          The ID of the volume.

        • SourceActiveAvailabilityZone (string) –

          The name of the Availability Zone that was active before the failover.

        • SourceActiveAvailabilityZoneId (string) –

          The ID of the Availability Zone that was active before the failover.

        • SourceStandbyAvailabilityZones (list) –

          The Availability Zone that was standby before the failover. Each entry includes the Availability Zone name and ID.

          • (dict) –

            Describes an Availability Zone by both its name and ID.

            • AvailabilityZone (string) –

              The name of the Availability Zone.

            • AvailabilityZoneId (string) –

              The ID of the Availability Zone.

        • TargetActiveAvailabilityZone (string) –

          The name of the Availability Zone that will become active after the failover.

        • TargetActiveAvailabilityZoneId (string) –

          The ID of the Availability Zone that will become active after the failover.

        • TargetStandbyAvailabilityZones (list) –

          The Availability Zone that will become standby after the failover. Each entry includes the Availability Zone name and ID.

          • (dict) –

            Describes an Availability Zone by both its name and ID.

            • AvailabilityZone (string) –

              The name of the Availability Zone.

            • AvailabilityZoneId (string) –

              The ID of the Availability Zone.