Swap Public IPs
CLI Tutorial: Public IPs (External Addresses) Swap
The Public IP swap operation can redirect incoming requests to another environment or application node without changing DNS records. It is useful for switching between testing and production versions, blue-green deployments, and controlled failover.
On this page
How Public IP Swap Works
The SwapExtIps CLI method exchanges external IP addresses between two containers. When only one of the nodes has a Public IP, the address is moved to the second node instead of being exchanged.
Testing to Production
Move live traffic to a tested application version with one CLI operation.
Blue-Green Cutover
Exchange addresses between two prepared application environments.
Controlled Failover
Reassign the public entry point from a primary node to a standby node.
The source and destination nodes can belong to the same environment or to different environments, but both must belong to the same platform account.
Before You Begin
- Confirm the name of the environment where the source Public IP is currently attached.
- Identify the node ID of the source container.
- Identify the node ID of the destination container.
- Ensure both source and destination nodes are running.
- Plan for a short period of Public IP unavailability during the operation.
Run the Swap Command
Execute the following command through the platform CLI:
~/jelastic/environment/control/swapextips \
--envName {env_name} \
--srcnodeid {source_node_id} \
--dstnodeid {target_node_id}
Depending on the CLI or platform API version, the source and target options may also appear as sourceNodeId and targetNodeId.
Command Parameters
{env_name}
Name of the environment where the transferred Public IP is currently attached.
{source_node_id}
ID of the node whose Public IP should be moved or exchanged.
{target_node_id}
ID of the destination node. It can belong to another environment in the same account.
Swap and Move Behaviour
- If both nodes have Public IP addresses, the addresses are exchanged.
- If only the source node has a Public IP, that address is moved to the destination node.
- The operation can be used across different environments and different service types within one account.
Multiple Public IPs: When both nodes contain several Public IP addresses and only a specific pair must be exchanged, additional source and target IP parameters or hosting-provider support may be required.
Availability and Restart Notes
The Public IP address or addresses may be unavailable for up to approximately 10 seconds while the reassignment is processed.
The following managed node types are automatically restarted so their services begin listening on the new addresses:
- GlassFish
- Apache PHP
- Apache Ruby
- NGINX PHP
- NGINX Ruby
VPS and custom containers: For VPS or Docker-based containers, restart the relevant service or instance manually when required. The platform does not restart them automatically because the necessary action depends on the software running inside.
Verify the Result
- Review the CLI response and confirm that the operation completed successfully.
- Check the Public IP assignments for both nodes in the dashboard.
- Test the application through the transferred address.
- Confirm that the required services are listening on the new Public IP.
- Restart VPS or custom-container services manually when necessary.
A successful swap allows incoming traffic to reach the destination node through the same Public IP that was previously attached to the source node.
