Skip to content

AWS EC2 Linux Cloud VM Setup

Max Wang edited this page Jun 24, 2021 · 3 revisions

Creating a Linux VM Instance

  • Login to AWS Management Console
  • Click on EC2 service
  • "Launch instance"
  • I choose "Amazon Linux 2 AMI (HVM), SSD Volume Type : 64-bit (x86). We don't need anything extra really.
  • I chose t3.medium. 4G RAM, 2 CPUs, EBS (Elastic Block Store) for persistent storage
  • On-demand pricing seems to be the cheapest
  • Extra storage: 64 gigs of general purpose SSD (gp2)
  • When creating the instance, make a keypair for SSH access
    • You need to change the pem file permissions: chmod 400 <pathtopemfile>
    • To SSH: ssh -i <pathtopemfile> ec2-user@<ipaddress>

Installing dependencies:

Docker

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

  • sudo yum update -y
  • sudo amazon-linux-extras install docker
  • sudo service docker start
  • sudo usermod -aG docker ec2-user
  • log out and then back in to check that docker is set up successfully
  • docker info

Docker-compose

  • sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • Change permissions so we can run it: sudo chmod +x /usr/local/bin/docker-compose

Git

  • If you didn't run the docker commands yet: sudo yum update -y
  • sudo yum install git -y

Clone repo and get running:

  • git clone https://github.com/NCATS-Gamma/qgraph.git
  • cd qgraph
  • docker-compose -f docker-compose.base.yml -f docker-compose.dev.yml up --build
  • Back in AWS, go to main instance page, click on the security tab, and click on the security groups list item
  • Down in inbound rules, click on "Edit inbound rules"
  • Click "Add rule" and choose "HTTP", source "Anywhere"
  • Click "Save rules"