Connecting to Linux instances
After you created your Linux instance, you can connect to it by completing these steps.
Locating floating IP address
If you haven’t associated a floating IP to your instance, follow Step 3 and Step 4 in Creating an instance by using the CLI to request a floating IP address to associate to your instance.
If you need to locate your floating IP address for the instance to which you want to connect, complete the following steps. If you already know your floating IP address, skip to Getting connected.
-
You need to identify your floating IP address. Run the following command to identify your floating IP address:
ibmcloud is instance-network-interfaces <INSTANCE_ID> <NETWORK_INTERFACE_ID> --json
For this example, you'd see a response similar to the following output:
"floating_ips": [ { "address": "123.45.678.90" "crn:v1:mydomain:public:vpc:us-south:a/c4cxxxc10xx54xxx9e2xxx59xxx3fa0f::floating_ip:12345x67-8901-234x-5678-9xx01xx23x4x", "href": "https://us-south.myaccount.cloud.ibm.com/v1/floating_ips/12345x67-8901-234x-5678-9xx01xx23x4x", "id": "0738-12345x67-8901-234x-5678-9xx01xx23x4x", "name": “my-instance” } ]
-
Now that you have your floating IP ID, you can locate your floating IP address by running the following command.
ibmcloud is ip <FLOATING_IP_ID>
For this example, you'd see a response similar to the following output:
ID 0738-12345x67-8901-234x-5678-9xx01xx23x4x Address 123.45.678.90 Name my-instance Target primary(1xx2x34x-.) Target Type intf Target IP 12.345.6.78 Created 1 week ago Status available Zone us-south-1 Resource Group - Tags -
Optionally, you can locate the floating IP address that is associated to the instance to which you want to connect through the IBM Cloud console.
Getting connected
-
To connect to your instance, use your private key and run the following command:
ssh -i <path to your private key file> root@<floating ip address>
The user login 'root' is disabled by default in Fedora Core OS. The user login 'core' can be used to log in to Fedora Core OS instances.
You receive a response similar to the following example. When prompted to continue connecting, type
yes
.The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established. ECDSA key fingerprint is SHA256:abcdef1Gh/aBCd1EFG1H8iJkLMnOP21qr1s/8a3a8aa. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
You are now accessing your server.
-
When you are ready to end your connection, run the following command:
exit