Good To Know

General things good to know before doing any Workbench management related tasks.

Connecting through ssh

Terminal command to connect to an instance:

ssh -i <key pem file> ubuntu@<instance public IP v4 DNS>

Example:

ssh -i RStudio_Workbench.pem ubuntu@ec2-35-173-234-97.compute-1.amazonaws.com

Instance public IP v4 DNS can be found at the instance page under the network tab.

You may encounter a message which looks like this:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for 'RStudio_Workbench.pem' are too open.

to fix it, give this file more restricting access permissions:

chmod 400 RStudio_Workbench.pem

File Editors

To edit files through ssh, you’ll have to rely on not-so-fancy command line file editors. If you find vim counterintuive (like me), try out nano. Simply run sudo nano <file name> to start editing a file. Commands are listed at the bottom. ^ means Ctrl button. So e.g. to save edits, press Ctrl + O.

Disk Usage

In the current setup we use Amazon FSx Lustre for home directory and shared library storage. It can be scaled up or down although scaling does not happen automatically like e.g. for EFS. So we need to check disk usage from time to time to be ready for it. To check free space left, you can use the standard df command. ncdu is a useful command to inspect disk usage by folder. duf command displays disk usage information in a pretty tabular format. ncdu and duf do not come with the Ubuntu system by default and need to be installed.

Effective Bulk File Transfers

When transferring multiple files between locations, it is recommended to use the rsync command instead of cp. rsync offers several advantages over cp, such as incremental file transfers, which only copy the differences between source and destination files, leading to faster and more efficient transfers. Additionally, rsync provides options for preserving file attributes and permissions, as well as progress reporting and error handling.