Amazon Web Services - ncbi/fcs GitHub Wiki

Setting up an instance on Amazon Web Services (AWS)

Amazon Elastic Compute Cloud (EC2) is the Amazon web service used to create and run virtual machines (VMs) in the cloud. AWS refers to these VMs as "instances." Both FCS-adaptor and FCS-GX can run in an AWS instance.

Overview

The purpose of this guide is to show you how to set up a basic AWS instance to run FCS tools, and to provide helpful tips and troubleshooting suggestions.

Signing in and entering the AWS console

Log in to your organization's AWS console at https://aws.amazon.com/
Select a role based on the account to which you have access, and click on the Sign In button.

Creating an AWS instance

To start an instance, click on Services at the top left of the webpage. Then select Compute followed by EC2.

Launching an AWS instance:

Click on Launch Instance.

Name and tags:

Fill out a name for the instance.
Tip: try selecting a name you can easily remember (e.g., one that includes your username).

Application and OS images:

Select Amazon Linux.
Under "Architecture," select 64bit (x86).

Instance type:

Select one of the free instances to start.

  • To run FCS-adaptor, select t2.micro.
  • To run FCS-GX, select r6i.16xlarge (64 vCPU, 512 GiB memory).

Key pair (login):

Select your key pair credentials from the drop-down list. Make sure your selection is the same as the one you previously created.
Note: The first time you log in to AWS to create a VM, you will be required to download a .pem file to the local terminal directory from which you wish to connect to the AWS instance. To do so, please follow these steps:

  • Click on Create new key pair.
  • Enter a key pair name that you can easily remember (e.g., one that includes your username).
  • For Key pair type select "RSA," and for Private key file format select ".pem."
  • Click on Create key pair.
  • Your .pem file will download to your computer.
  • Place the .pem file in a folder in the terminal from which you wish to connect to the AWS instance.

Network settings:

Use default settings (do not make any changes).

Configure storage:

For Storage, select 10GiB for "test-only" GX index.
Note: If you wish to save a copy of the "all" GX index on disk, you will need at least 470GB of storage.

Advanced details:

Use default settings (do not make any changes).

Save configuration and launch instance

Select Launch instance in the right column.
You should see a page that says "Success."

Connecting to your instance

Click on View all instances at the bottom of your screen. You should see a list of instances.

  • Select the box to the left of your instance.
  • When your instance is ready, you should see the word "Running" next to it, and the Connect tab at the top of the screen should be clickable (i.e., it should not be greyed out).
  • Click on the Connect tab once it is ready (this may take a few minutes).
  • Proceed to the SSH client tab that provides instructions on how to use SSH to connect to your AWS instance.
  • This includes the following steps:
    • Open an SSH client
    • Locate your .pem file. The key used to launch this instance is xyz.pem
    • Your key should not be publicly viewable:
      chmod 400 xyz.pem
    • Connect to your instance using its Public DNS:
      ssh -i "xyz.pem" [email protected]
  • You should now be logged in to your instance.

Installing Docker

To run FCS tools on your VM, please ensure Docker is installed in your AWS instance. For further information on Docker setup and integration with your AWS instance, please see Amazon's container image help guide.

Use the following commands for your Docker AWS integration:

docker info   
sudo amazon-linux-extras install docker   
sudo service docker start   
sudo usermod -a -G docker ec2-user   

Log out and log back in to pick up the new Docker group permissions:

docker info

Running FCS tools

To run FCS tools on your VM, please follow the instructions under FCS-adaptor or FCS-GX. For FCS-GX, we recommend copying the database with s5cmd to minimize VM setup time.
Once you are done, please copy your files to your AWS bucket or to your local directory.

Copying files

To copy files from your local directory to your AWS instance, run the following command on your local terminal:

scp -i _path_/youraws.pem example.txt [email protected]:example.txt

To copy files from your AWS instance to your local directory, run the following command on your local terminal:

scp -i _path_/youraws.pem  [email protected]:example.example.txt ./examplefromVM.txt

Terminating your instance:

To terminate your instance, go to the list of instances on your AWS console.

  • Select the box to the left of your instance.
  • Click on the Instance state tab on the top right of your screen and click on Terminate instance.

Troubleshooting Docker-related issues

You may see an error saying Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
To troubleshoot this issue, please try the following (from Docker Community Forums):

  • Check the Docker status by running:
    sudo service docker status
  • If Docker still isn't working, try running:
    sudo service docker start
  • To auto-start after a reboot, run:
    sudo systemctl enable docker
  • Don’t forget to add your ec2-user to the Docker group by running:
    sudo usermod -aG docker ec2-user
  • Reboot (or just log out and log back in) by running:
    sudo reboot

After rebooting (this may take a few minutes), please reconnect to your AWS instance from your terminal.