This article will walk you though how to connect to your CPM instance using SSH, these steps can also be used to connect to any Linux instance in AWS including a CPM worker instance. The same process and key is used for an SSH connection to CPM or a CPM Worker, the only difference being the IP address that you are connecting to, and the username used to connect. The CPM Worker instance uses the username "ubuntu" while the CPM server instance uses the username "cpmuser". More will be explained about this in the steps below.
This process of using SSH to connect to the CPM instance or a CPM Worker Instance will be needed sometimes in order to troubleshoot your CPM instance or a CPM Worker.
In order to use SSH to connect to a Linux instance within AWS you will need to do the following:
- Obtain the IP address and Private Key for the Instance
- Use Putty to convert the private key to use for an SSH connection
- Configure putty to connect to the instance using the newly converted key
- Use Putty to connect to the instance and performs any actions needed
1. Obtain the IP address and Private Key for the Instance
First you will need to obtain the IP address of the CPM instance or Worker instance and connect to it
using SSH/Putty. If you already have this information, skip ahead to the next section.
The IP address is found in the details of the
CPM Instance or worker instance in your EC2 console. Login to your AWS account and then go to Services > EC2. Locate the instance you need the IP from. The IP address may be in the right column, or click on the instance in the list, then view the details in the lower pane, you will see the IP address listed there and several other places noted below.
Next you will need your .pem key that you created or used when you created the EC2 instance. For our purposes this would be the CPM instance .pem
You should have this .pem file saved someplace safe already. If you need to check the name of the key/.pem in use on the CPM instance, you can
check it in the EC2 instance details within AWS. See below. You can right click on the instance in the EC2 dashboard and choose "Connect" and you will see the following information.
The above will give you the .pem file name in use, the DNS host name you can use to connect to the instance via SSH, and the username for SSH access. Make a note of this information, it will be needed in the following steps. However please note that the username used for SSH access for a CPM instance is not root, it is cpmuser. if you need root access you would need to use the sudo su command once you have connected using cpmuser.
2. Use Putty to convert the private key to use for an SSH connection
Once you have your .pem file for the instance you will need to download and install
PuTTy and PuTTygen. PuTTygen is included and installed as part of with PuTTy and it is used to convert the .pem to a .ppk file that can be used to configure PuTTY for SSH connections.
You can download the PuTTy suite here - PuTTy
To convert your private key/,pem file to a .ppk follow the steps below.
Open Puttygen.exe , in the first screen choose RSA for Type of key to generate. leave 2048 for "Number of bits in a generated key" and then click the load button. In the explorer window that opens, change the file type to All files (*.*) and then locate and choose your .pem file and click open.
You will see the following screen after opening your .pem file with PuTTygen. Click Ok on the Notice.
Then click Save Private key as seen in the image below. You will get a warning about not including a passphrase, click OK and then in the explorer window that comes up, give your newly converted .ppk file a name and save it someplace safe.
Once it is saved you can close the PuTTygen window. You now have a PuTTy Private key file that can be used to configure PuTTy to connect to your CPM instance or Worker instance.
3. Configure putty to connect to the instance using the newly converted key
Open Putty.exe. In the Category pane, choose Session. In the session details enter the hostname or ip address of the CPM instance or the worker instance you want to connect to. Enter 22 for the port and choose SSH for the connection type.
Then click Connection in the category section on the left, expand and choose SSH, expand again and choose Auth. Here you can use the browse button to locate and choose the .ppk file you created and saved in the previous section.
Once you have completed the above information, go back to the category navigation on the left and choose Session again. You can save these settings for future use by entering a name and clicking Save. After clicking Save, the configuration should show up in the list and will be available to load on future uses.
4. Use Putty to connect to the instance and perform any actions needed
After configuring PuTTy in the previous section, click the Open button (shown in the illustration above) to open a connection to the instance you have configured.
You will see the login prompt similar to the below. If you are logging into CPM enter "cpmuser" for the username, if you are logging into a CPM Worker instance, enter "ubuntu" for the username.
You will now be logged into the instance using SSH and can begin entering commands.
If you need to make any changes that require root access you will need to switch to root using the following command
Thanks for reading this KB,
N2WS Support Team.