Skip to main content

IBM Cloud Fail Over Functions

Overview

IBM Cloud Fail Over is a Python module designed to automate failover processes for applications hosted on IBM Cloud. This module provides essential functions to manage failover scenarios effectively, ensuring high availability and reliability.

Features

  • Automated Failover: Seamlessly switch to backup resources when primary resources are unavailable.
  • Resource Management: Manage critical resources like Virtual IPs and Floating IPs with ease.

Installation

You can install the IBM Cloud Fail Over module using pip. Run the following command:

pip install ibm_cloud_fail_over

Usage

Main Functions

fail_over_cr_vip

This function manages the failover of a Cloud Resource Virtual IP (CR VIP).

Usage:

from ibm_cloud_fail_over import fail_over_cr_vip

# Example usage
active_ip = fail_over_cr_vip(vpc_url='IBM Cloud VPC regional URL",
                           primary_vip='your_primary_vip',
                           secondary_vip='your_secondary_vip',
                           api_key="Optional: API key" )
print(active_ip)

Parameters:

Parameter Type Description
vpc_url str IBM Cloud VPC regional URL.
primary_vip str The primary Virtual IP to monitor.
secondary_vip str The secondary Virtual IP to switch to.
api_key str Optional needed only if you are not using trusted profile, IBM cloud api acsess key

Returns:

  • The Active ip post failover operation.

fail_over_floating_ip_start

This function manages the failover of a Floating IP Attach to the caller Endpoint (VSI/BM)

Usage:

from ibm_cloud_fail_over import fail_over_floating_ip_start

# Example usage
result = fail_over_floating_ip_start(vpc_url='IBM Cloud VPC regional URL",
                                master_vni_id="Virtual network inetface uuid for new active",
                                passive_vni_id="Virtual network inetface uuid for new passive" ,
                                fip_id="the floating ip uuid",
                                api_key="Optional: API key" ))
print(result)

Parameters:

Parameter Type Description
vpc_url str(url) IBM Cloud VPC regional URL.
master_vni_id str(uuid) Virtual network inetface uuid for new active.
passive_vni_id str(uuid) Virtual network inetface uuid for new active.
fip_id str(uuid) Floating IP uuid to move.
api_key str Optional needed only if you are not using trusted profile, IBM cloud api acsess key
Returns:
  • A confirmation message indicating the success or failure of the failover operation.

fail_over_floating_ip_stop

This function manages the failover of a Floating IP Detach to the caller Endpoint (VSI/BM)

Usage:

from ibm_cloud_fail_over import fail_over_floating_ip_stop

# Example usage
result = fail_over_floating_ip_stop(vpc_url='IBM Cloud VPC regional URL",
                                master_vni_id="Virtual network inetface uuid for new active",
                                passive_vni_id="Virtual network inetface uuid for new passive" ,
                                fip_id="the floating ip uuid",
                                api_key="Optional: API key" ))
print(result)

Parameters:

Parameter Type Description
vpc_url str(url) IBM Cloud VPC regional URL.
master_vni_id str(uuid) Virtual network inetface uuid for new active.
passive_vni_id str(uuid) Virtual network inetface uuid for new active.
fip_id str(uuid) Floating IP uuid to move.
api_key str Optional needed only if you are not using trusted profile, IBM cloud api acsess key
Returns:
  • A confirmation message indicating the success or failure of the failover operation.

fail_over_get_attached_fip

This function manages the failover of a Floating IP Detach to the caller Endpoint (VSI/BM)

Usage:

from ibm_cloud_fail_over import fail_over_get_attached_fip

# Example usage
api_key = ""
attached_fip_id, attached_fip_ip = fail_over_get_attached_fip(api_key)

print(attached_fip_ip)
print(attached_fip_id)

Parameters: None

Returns: attached_fip_id, attached_fip_ip

fail_over_public_address_range

This function manages the failover of a public address range by updating its target zone to match the VSI's local availability zone.

Usage:

from ibm_cloud_fail_over import fail_over_public_address_range

# Example usage
result = fail_over_public_address_range(
    range_id="public_address_range_uuid",
    vpc_url="IBM Cloud VPC regional URL",
    api_key="Optional: API key",
    api_version="2026-06-01",  # Optional: API version
    maturity=None,             # Optional: API maturity level (None for GA APIs)
    generation="2"             # Optional: API generation
)
print(result)

Parameters:

Parameter Type Description
range_id str(uuid) The ID of the public address range to update
vpc_url str(url) IBM Cloud VPC regional URL
api_key str Optional: IBM Cloud API key (needed only if not using trusted profile)
api_version str Optional: API version (defaults to "2026-06-01")
maturity str Optional: API maturity level (defaults to None, omitted for GA APIs)
generation str Optional: API generation (defaults to "2")

Returns:

  • The updated public address range information if an update was needed
  • None if no update was needed (range already in correct zone)

Note:

  • The function automatically detects the VSI's local availability zone
  • The range is only updated if its current zone differs from the VSI's local zone
  • Requires the same instance metadata service and trusted profile setup as other functions

fail_over_check_par_zone_compatibility

This function checks if a public address range and the VSI are in the same availability zone.

Usage:

from ibm_cloud_fail_over import fail_over_check_par_zone_compatibility

# Example usage
zones_match, current_zone = fail_over_check_par_zone_compatibility(
    range_id="public_address_range_uuid",
    vpc_url="IBM Cloud VPC regional URL",
    api_key="Optional: API key",
    api_version="2026-06-01",  # Optional: API version
    maturity=None,             # Optional: API maturity level (None for GA APIs)
    generation="2"             # Optional: API generation
)

if zones_match:
    print(f"PAR and VSI are in the same zone: {current_zone}")
else:
    print(f"PAR and VSI are in different zones. PAR zone: {current_zone}")

Parameters:

Parameter Type Description
range_id str(uuid) The ID of the public address range to check
vpc_url str(url) IBM Cloud VPC regional URL
api_key str Optional: IBM Cloud API key (needed only if not using trusted profile)
api_version str Optional: API version (defaults to "2026-06-01")
maturity str Optional: API maturity level (defaults to None, omitted for GA APIs)
generation str Optional: API generation (defaults to "2")

Returns:

  • A tuple containing:
    • bool: True if the public address range and VSI are in the same zone, False otherwise
    • str: The current zone name of the public address range

Note:

  • The function automatically detects the VSI's local availability zone
  • Requires the same instance metadata service and trusted profile setup as other functions
  • Useful for checking zone compatibility before performing failover operations

Troubleshooting

If you encounter issues while using the module, consider the following:

  • Invalid IP Addresses: Ensure that the IP addresses provided for primary and secondary resources are valid and reachable.
  • Network Issues: Check your network connectivity to the IBM Cloud resources.
  • Permissions: Ensure that your IBM Cloud account has the necessary permissions to manage the specified resources.
  • Required dependencies: Enable Instance Metada Service on Both Enpoints
  • Optional dependencies: Enable Trusted profile to avoid using and api access key

For further assistance, please check the GitHub Issues page or contact the project maintainer.

Contributing

We welcome contributions! To contribute to the project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes and commit them (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For questions or support, please open an issue on GitHub or contact the project maintainer at dev@gampel.net.


### TOOD:
 

Metadata

Release files for ibm-cloud-fail-over 1.0.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ibm-cloud-fail-over 1.0.25
File Size Uploaded Provenance
ibm_cloud_fail_over-1.0.25.tar.gz 18.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ibm-cloud-fail-over 1.0.25
File Interpreter ABI Platform
ibm_cloud_fail_over-1.0.25-py3-none-any.whl Python 3 none any Details

Total release size: 35.6 kB

Release files / ibm_cloud_fail_over-1.0.25.tar.gz

Download URL ibm_cloud_fail_over-1.0.25.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
36d2754c3f22f6e9ea6a8177292788ed8da6de72d8192da8eb4ccdab5113b31a
BLAKE2b-256 checksum
How to use checksums
1d0f31344a01c27aad2996602c3a49b5350ead5452a19cb3e52de3674b50c4ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Release files / ibm_cloud_fail_over-1.0.25-py3-none-any.whl

Download URL ibm_cloud_fail_over-1.0.25-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98a23d18754f0979b6ccc4f29212612fe3b2962d24c08f160cf3dd5a6bb06ff4
BLAKE2b-256 checksum
How to use checksums
5c7b11d92987138d2a874bdd90b84f4bcd6ffe6945fded07b66cdbb7d7bf76bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Security for ibm-cloud-fail-over 1.0.25

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ibm_cloud_fail_over-1.0.25.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page