-
Notifications
You must be signed in to change notification settings - Fork 204
Setting up an AWS instance with the CBW AMI
This page has instructions for setting up an Amazon Web Services instance using the Amazon Machine Image created for the Canadian Bioinformatics Workshops (CBW) in 2024. You can see more information on these workshops on the CBW general pages for the Beginner and Advanced Microbiome Analysis workshops as well as the CBW tutorial pages for the Beginner and Advanced Microbiome Analysis workshops.
To start this, you will need an AWS account.
Please note before starting that using the AWS instances costs money. You can see the associated costs with different types of instances here (note that we are suggesting you use the t2.xlarge instance for this tutorial).
It is therefore really important that you Stop or Terminate the instance when you aren't using it.
Now, we will launch the image (these instructions are modified from here):
- Go to the EC2 console
- Choose EC2 Dashboard and then click "Launch Instance".
- Under Names and tags, for Name, enter a name for your instance, e.g. "CBW-2024-AMI" (note that it doesn't matter what this is as long as you can identify it)
- In Application and OS Images (Amazon Machine Image), search "CBW_MIC_240503". Click on "Select" when this comes up.
- In the instance type select "t2.xlarge" - this is the type of instance that we used in the workshop and has 4 vCPU and 16GB memory.
- Under Key pair (login), click on "Create new key pair".
- Add a name for your key pair (I went with "cbw-2024-ami").
- Keep the type as RSA and choose .pem or .ppk depending on where you plan to use this - typically, Mac users will use .pem and Windows users will use .ppk.
- Click "Create key pair". This should automatically download the created key pair file - move it to the location on your computer where you want to keep it.
- If you will use Mac/Linux then go to the Terminal, navigate to the location of your key pair file and enter the following command:
chmod 400 cbw-2024-ami.pem
(note: if you gave your key file name a different name, you'll need to modify it in the command) - Now you can choose your existing security group (see below instructions on how to create one).
- Now go to Configure storage. You will need to add enough storage here that you can store the CourseData here. For BMB, you should be fine with the default 40GB. As this storage costs money, I recommend first launching an image for BMB with lower storage, and then launching a different one with more storage for AMB. Keep gp3 for both of these.
- Now click "Launch instance".
- Choose View all instances to check the status of your instance. It may take a few minutes for the instance to launch. Please get in touch if you are unsure.
- When the instance has launched, the status will change from "Pending" or to "Running" and the Status check has changed to "2/2 checks passed". This may take a few minutes and you may need to refresh the page. Now you can log in to the instance (see below).
- Open the EC2 console.
- In the navigation pane, choose Network & Security > Security Groups.
- Choose "Create security group" (top right orange button).
- Enter a name for the security group. Amazon recommends that you add the region that you will use to this name. For example, I have been using the US East region and named my group the following: "RW_SG_useast1-cbw_2024-ami". Also add a description to this, e.g. "allow me to access with SSH"
- Select the default VPC.
- You now have to add some inbound rules so that you will be able to access an instance that you create with this security group. There is guidance on the suggested rules for different use cases here, but I used the following: i. Choose RDP from the drop down list. In source, choose "My IP". Click add rule. ii. Choose SSH from the drop down list. In source click "My IP" - this should automatically add your IP address. Click "Create security group".
Assuming that you have followed the above instructions to launch an instance, now you can log into it. This section is modified from the Connect to your Linux instance AWS instructions. We will use the ssh instructions here, but if you wish to do this a different way, please follow the AWS instructions at the link.
- Open a new terminal window.
- Log in with the following information:
ssh -i /path/key-pair-name.pem ubuntu@instance-public-dns-name
Your /path/key-pair-name.pem
should be the location of your key file and instance-public-dns-name
can be found under Public IPv4 DNS in the Instance details. For me, this command looked like this:
ssh -i cbw-2024-ami.pem [email protected]
- You may need to type "yes" to say that you want to continue connecting, and then you should see that you have been logged into the instance.
- View your active instances.
- Select the instance that you have been using and click "Instance state".
- Choose "Stop instance" or "Terminate instance" and click "Stop" or "Terminate", respectively.
When you choose to stop the instance, you can restart this at a later time. Note that you will still pay for any storage used, but you won't pay for the use of the instance itself. If you terminate the instance, you will need to go through the same steps as above to make a new instance if you want to come back to this again.
BMB:
rm CourseData
rm workspace
mkdir CourseData
mkdir workspace
cd CourseData
wget https://hpc4health.ca/cbw/2024/MIC/BMB.tar.gz --no-check-certificate
tar -xvf BMB.tar.gz
rm BMB.tar.gz
mv BMB_data/* .
Now you should be able to start working through the workshop materials, starting with Beginner Module 1.
- Please feel free to post a question on the Microbiome Helper google group if you have any issues.
- General comments or inquires about Microbiome Helper can be sent to [email protected].