This tutorial shows you how to deploy code-server
on an EC2 AWS instance.
If you're just starting out, we recommend installing code-server locally. It takes only a few minutes and lets you try out all of the features.
8443
and source set to "Anywhere"
Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only.
A key pair consists of a public key that AWS stores, and a private key file that you store. Together, they allow you to connect to your instance securely. For Windows AMIs, the private key file is required to obtain the password used to log into your instance. For Linux AMIs, the private key file allows you to securely SSH into your instance.
This is necessary before you proceed. A
.pem
file will be downloaded. make sure you store is in a safe location because it can't be retrieved once we move on.
First head to your EC2 dashboard and choose instances from the left panel
In the description of your EC2 instance copy the public DNS (iPv4) address using the copy to clipboard button
Open a terminal on your computer and use the following command to SSH into your EC2 instance
ssh -i "path/to/your/keypair.pem" ubuntu@(paste the public DNS here)
example:
ssh -i "/Users/John/Downloads/TestInstance.pem" ubuntu@ec2-3-45-678-910.compute-1.amazonaws.co
You should see a prompt for your EC2 instance like so
At this point it is time to download the code-server
binary. We will of course want the linux version.
Find the latest Linux release from this URL:
https://github.com/cdr/code-server/releases/latest
Replace {version} in the following command with the version found on the releases page and run it (or just copy the download URL from the releases page):
wget https://github.com/cdr/code-server/releases/download/{version}/code-server{version}-linux-x64.tar.gz
Extract the downloaded tar.gz file with this command, for example:
tar -xvzf code-server{version}-linux-x64.tar.gz
Navigate to extracted directory with this command:
cd code-server{version}-linux-x64
If you run into any permission errors, make the binary executable by running:
chmod +x code-server
To ensure the connection between you and your server is encrypted view our guide on securing your setup
Finally, run
./code-server
Open your browser and visit https://$public_ip:8443/
(where $public_ip
is your AWS instance's public IP address). You will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click "Advanced" then click "proceed anyway". In Firefox, click Advanced, then Add Exception, then finally Confirm Security Exception.
For instructions on how to keep the server running after you end your SSH session please checkout how to use systemd to start linux based services if they are killed
NOTE: If you get stuck or need help, file an issue, tweet (@coderhq) or email.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。