Once the cluster has successfully launched, we can create a direct connection to the cluster through our AWS CloudShell terminal. A direct connection is useful if a user does not need any graphical display during their session. For details on interactive sessions with graphical capability, see the next section.
To create a direct connection, use the command below (using your specific cluster name if it differs from cfd).
pcluster ssh cfd -i KEY_NAME.pem
This will open a direct, non-graphical connection in the CloudShell terminal. To exit the remote terminal session, use the standard Linux command “exit”. You would follow a similar process if you had installed the AWS CLI tools on your own local machine as the cluster head node has a public IP and is therefore accessible from outside of your account (if you have the correct SSH key).
Once the cluster has successfully launched, we can use “pcluster” to launch an interactive connection using a web browser. This interactive session works by connecting to the dcv session running on the master instance. This connection is authenticated using the key we created previously . The command below will print a URL which will be used for making the connection to the DCV session. This URL will be valid for 30 seconds and should be copy and pasted into a new tab of your web browser. If the URL does not work, or you close your tab, you can re-run the command to get a new URL at any time. You may want to check your browser security settings and we typically recommend Firefox.
pcluster dcv connect cfd --key-path cfd_ireland.pem --show-url
The authenticity of host 'xx.xx.xx.xx (xxxx)' can't be established. ECDSA key fingerprint is SHA256:6U/VYwS4xbTIOiSnbe9ffffH0nCfffPSTGTsssshfk. ECDSA key fingerprint is MD5:51:89:eg:99:31:7g:39:2t:0r:81:0b:ae:d7:a1:2e:e4. Are you sure you want to continue connecting (yes/no)? yes Please use the following one-time URL in your browser within 30 seconds: [ URL link to DCV session will be shown here ]
Depending on your internet browser, you may need to add and confirm the security exception to log onto the instance.
Once you’re logged in, you’ll be brought to your Amazon Linux 2 Desktop. To open a terminal, click activities and select Terminal from the drop-down menu.
You may wish to use the desktop DCV client (available for Mac, Windows and Linux here). For this you need to set a password and edit a couple of files.
Firstly log on to the cluster (via SSH) and type:
sudo passwd ec2-user
Please set a suitably secure password.
Next you need to edit the DCV configuration file to change it from allowing access from a web browser to the client
sudo vi /etc/dcv/dcv.conf
Next comment out the line (i.e add a # symbol at the start of the line) starting:
Then, change the following line from:
We can then save the file and then restart the DCV server
sudo systemctl restart dcvserver
Finally, we create a DCV session that we can then log on with:
dcv create-session cfd
Now you can launch the DCV client and enter the public IP of the Master node of the cluster. You can find this in the EC2 console and look for the Master instance and then note down it’s public IP. It will then ask you enter the username, which is ‘ec2-user’ and the password you set. You can now use it in the same way you used it through the web browser.