Cloud9 is a web-based IDE that allows you to write and run code anywhere with just your browser. You can install it on your EC2 instances to edit code and configuration files directly, instead of using a CLI text editor.
What is Cloud9?
You are probably at least a little familiar with the core text editor if you've ever done any work with Lambda functions ̵
Cloud9 will by default launch a new development environment on a new EC2 instance. This instance is stopped and started when you start or close Cloud9. Because you don't have to worry about installing dependencies locally such as
git your Cloud9 environment will work the same whether you're connecting from your desktop or from a Chromebook on the couch.
While that's great, it might be more convenient to install Cloud9 on an existing EC2 instance. Connects via SSH, allowing you to edit the configuration and code on the instance itself, effectively replacing a CLI text editor such as
vim . You have full access to the underlying image through the integrated console and can access any file in the directory where you want to set up your environment.
Cloud9 is not limited to EC2 instances – because it connects via SSH; as long as your server is somehow accessible via SSH, you can connect to non-AWS servers in the same way.
Cloud9 requires a few dependencies, which we must install before setting it up. The first is Python 2.7 – specifically this version. You can install Python from apt, or your distro's package manager:
sudo apt install python2.7 python-pip
Next is NodeJS. You can install a version manually, but it is better to use Node Version Manager (
nvm ) to handle updates. Install it with the following command:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
bashrc to add it to your PATH,
. ~ / .bashrc
And install the latest version of Node via
nvm install node
Now you can download and install Cloud9 on your server:
curl -L https : //raw.githubusercontent.com/c9/install/master/install.sh | bash
It takes a few minutes to locate everything.
In the meantime, you must go to the IAM Management Console to create a new IAM user to access Cloud9, since AWS recommends not using your root account to create and access environments. If you already have an Administrator IAM user that you can use just fine, log into that account and skip this step.
Create a new user:
Give it management console access, set a password and add the
AWSCloud9Administrator consent policy.
Once the user is created, click the "Security credentials" tab and assign an MFA device. This could be an authenticator app on your phone or a hardware keychain, but you definitely want to set this up or your servers will be accessible with just a password.
 Now when you start Cloud9, you will be asked to log into your IAM account and enter your MFA credentials, making it quite secure.
Connecting to your server
Log in to the desired IAM account to use for Cloud9, then go to the Cloud9 Management Console. Create a new environment and indicate that you want to connect to a remote server via SSH.
There are a few options here. The first is the user account you use to log in. AWS recommends using an account with administrator access, so if you plan to do most of your work in your home directory, go with your standard user (
ec2 user or
ubuntu ). If you want to edit configuration files anywhere on your server, such as
/ etc / nginx / you need to connect as root.
Connecting as root is not recommended even for SSH, but Cloud9 does not leave an open internet connection on the device itself. All communication from Cloud9 to your server is via SSH and you cannot even access the Cloud9 console without authenticating as your IAM user. Either way, make sure you have MFA set up for your IAM user as you are still connecting as a user with administrator rights, root or not.
Next you want the host address and port. This should be accessible from the open internet, but you can use a VPN to forward the connection.
Finally your environment path. This is a newly created folder by default, only for Cloud9, which is good if you use it as a standalone IDE. But if you want to edit your files, you have to set this to something else. You should probably set it to
~ / if you're using a normal user, or to
/ if you're using root. Everything outside of your environment path is not accessible (at least by the primary editor), although you can always change this in the settings or create multiple environments with different profiles.
Before creating the environment, you need to copy the SSH public key and add it to the
~ / .ssh / authorizedkeys file of the user you are connecting to. This will verify AWS and enable the connection.
Click on "Create Environment" and after a few seconds you will be taken to your environment where you are free to edit files as you like.
If you have set your environment to
/ you definitely want to use the "Favorites" function for frequently used folders, such as browsing the
/ etc / map to find
nginx in the long drop-down list is tedious to say the least.
Install Cloud9 as an "app"
Cloud9 is still 100% a web app; however, you can make it function like a regular app by creating a shortcut from Chrome. From the Chrome Settings menu, select More tools> Create shortcut.