CLI Tutorial Public IPs External Addresses Swap

The operation of public IPs swap can come in handy for routing of the incoming requests to the required environment or application. It may be especially useful when, for example, switching testing and production environments.

The appropriate SwapExtIps CLI method gives you the ability to exchange external IP addresses between two containers. It can swap either all public IPs assigned to nodes or just two specific IPs.

Tip: Alternatively, you can use the MoveExtIp method, if you need to reassign an external IP addresses from one node to another.

As usual, the operation requires just a single line of code for being executed:

1
~/jelastic/environment/binder/swapextips --envName {envName} --sourceNodeId {sourceNodeId} --targetNodeId {targetNodeId} [--sourceIp {sourceIp} --targetIp {targetIp}]

Here, the following parameters should be specified:

  • {envName} – name of the source environment, where the transferred external IP is attached
  • {sourceNodeId} – identifier of the node from the stated environment with at least one public IP
  • {targetNodeId} – ID of the target node (can belong to any environment on the same account and within the same region as the source one)
  • {sourceIp} and {targetIp} – optional pair of parameters to swap two specific IP addresses between nodes with multiple public IPs; if not specified, all external IPs from source node are transferred to the target and vice versa
CLI swap external IP

Notes:

  • Before using the SwapExtIps CLI method, please make sure that the source and destination nodes (environments) are running and belong to the same region.
  • The process may cause short-term unavailability of the corresponding public IP address(es) (up to 10 seconds).
  • The following node types will be automatically restarted to start listening on the new addresses after the operation: GlassFish, Apache PHP, Apache Ruby, NGINX PHP, NGINX Ruby.
  • Based on the comprized services, a manual restart may be required for the Elastic VPS and custom Docker containers to adapt for the IP address change.
  • We recommend rechecking the Access via SLB state for both nodes after swapping IPs.
  • If you need swap more than one (but not all) external IP addresses or swap unequal number of IPs between two nodes, you can use the the MoveExtIp method two times with the list of required IPs.

In a few minutes, your IPs will be exchanged between the specified nodes, and the details will be provided in the operation response.

Now, as you caught the idea on how to work with our CLI, you can proceed to the environment management automation. For example, by creating corresponding scripts for the frequently used operations’ chains.
The full information on all of the available commands and methods can be found within the platform API documentation.

Share this:
FacebookXWhatsAppTelegramLinkedInGmailCopy Link
Updated on March 11, 2026
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support