AWS and Unix intro for CAN
Connecting and properly using a cloud computing cluster at the CBW
by Jose Hector Galvez, Zhibin Lu & Rob Syme
Schedule
Today’s schedule can be found here
Contents:
1. Logging into AWS
Description of the lab:
This section will show students how to login to AWS and create an instance.
2. Introduction to the command line
Description of the lab:
This section will show students the basics of the command line, with a focus on navigation.
Exercise: Exploring the filesystem
- Connect to your AWS instance
- Type the
ls
command, what do you see?
Solution (click here)
```bash ls CourseData R cvmfs_cache workspace ``` The `ls` command lists the contents of a working directory.- After following the tutorial, can you answer what these commands (
cd
,pwd
) do?
Solution (click here)
The `cd` command is used to *change directories*. Without arguments, it will move to the home directory (`~`) The `pwd` command shows the absolute *path to the working directory*.3. File manipulation
Description of the lab:
This section will show students how to manipulate files, including reading, editing, and renaming text files.
Exercise: Reading text files
- What do the commands
cat
,head
, andtail
do? What do they have in common?
Solution (click here)
All three of these commands ouptut the contents of a text file to *standard out*: - `cat` outputs the *full* contents of the file - `head` outputs the *first* 10 lines of a file - `tail` outputs the *last* 10 lines of a file- What does the command
less
do? How is it different fromcat
?
Solution (click here)
`less` opens a text file for viewing. Unlike `cat`, it will display it in a separate file viewer.- How can you know the number of lines in a file?
Solution (click here)
The command `wc -l` will display the number of lines in a file. `wc` (word count) displays the number of words, lines, and bytes in a file. The `-l` option, limits the output to lines.Exercise: Editing text files
- Write “Hello world” into a file called
helloworld.txt
usingnano
. Save and then exit.
Solution (click here)
First, use the `nano` command to open a file called `helloworld.txt` ``` $ nano helloworld.txt ``` Inside the nano editor, write "Hello world" and then use the `^O` option to write the changes and then `^X` to exit.- Create a subdirectory called
test
. Then, move thehelloworld.txt
file into the directory.
Solution (click here)
First, use the command `mkdir` to create this new directory. Then, use `mv` to move `helloworld.txt` into this directory. ``` $ mkdir test $ mv helloworld.txt test/ ```- Create a copy of the
helloworld.txt
file calledhelloworld2.txt
, inside thetest
directory.
Solution (click here)
First, change the working directory using `cd`, then use the `cp` command to create the copy. ``` $ cd test $ cp helloworld.txt helloworld2.txt ```4. Searching and sorting files
Description of the lab:
This section will show students how to search for files and in files.
Workshop notes and quiz questions here.
5. Putting it all together
Description of the lab:
This section will show students how the basic concepts fit together and in the context of bioinformatics.
Workshop notes and quiz questions here.
6. AWS Machine Image (AMI)
Starting the AWS AMI after the workshop is over:
An updated AWS Machine Image (AMI) will be be prepred by Zhibin at the end of this CBW workshop: It will have the same software used in the workshop, but it will not contain any of the data. To get such an image started, you will need to set up your own AWS account with your own credit card, and then, the same as you did in this workshop, look for the CBW
Let us know on the slack channel or at course_info@bioinformatics.ca if you are experiencing any problems with this.