Aadhithyan Suresh
Code with Aadhithyan

Code with Aadhithyan

Setup your own dev setup in cloud for FREE!

Setup your own dev setup in cloud for FREE!

Aadhithyan Suresh's photo
Aadhithyan Suresh

Published on Oct 22, 2021

2 min read

Listen to this article

There are just three steps

  • Setting up the VM on AWS
  • Setting up the subdomain
  • Setting up the VM for code-server

Setup cloud VM on AWS

  • Debian 10
  • t2.micro
  • Default instance settings
  • 8 GB ssd storage
  • tags ( optional )
  • SSH / 22 / ipv4 source
  • HTTP / 80 / ipv4 source
  • HTTPS / 443 / ipv4 source
  • Custom / 8080 / ipv4
  • Create a new private key
  • Launch

Setup subdomain

  • Setup A record to public IP of aws VM
  • TTL to 2 mins

Setup VM for code-server

  • connect to the vm via ssh
  • sudo apt update && sudo apt upgrade
  • curl -fOL https://github.com/cdr/code-server/releases/download/v3.12.0/code-server_3.12.0_amd64.deb
  • sudo dpkg -i code-server_3.12.0_amd64.deb
  • sudo systemctl enable --now code-server@$USER
  • sudo systemctl status code-server@admin.service
  • curl http://127.0.0.1:8080
  • sudo apt install -y nginx certbot python3-certbot-nginx
  • sudo vim /etc/nginx/sites-available/code-server

    server {
      listen 80;
      listen [::]:80;
      server_name mydomain.com;
    
      location / {
        proxy_pass http://localhost:8080/;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
      }
    }
    
  • sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server
  • sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m hello@mydomain.com
  • sudo systemctl restart nginx
  • vim ~/.config/code-server/config.yaml
  • change password to whatever you want
  • sudo systemctl restart code-server@admin.service

Visit your link and enjoy :)

 
Share this