I first started using Cloud9 when they were independently owned, but then they sold to AWS and the pricing was kind of unclear especially since you have to have an EC2 instance running.
It’s been some time since I’ve looked at the settings to get Cloud9 up and running, and I now see that they have a way to automatically stop an instance after 30 minutes of inactivity. Previously, this is where a lot of the cost came in. If you forgot to turn off the EC2 instance, you could be hit with a larger than expected bill. This new setting is quite nice!
I discovered the updates when doing a google search, and was quite happy with how much the estimate for a month would be. AWS estimates that if you were to run a t2.micro Linux EC2 instance for 4 hours a day, you would end up with about $2.05 in fees for the month (with storage fees in there). Not bad at all!
This guide is loosely based on Chris Oliver’s video from GoRails on YouTube. I’ve included updated information for 2022 and included some errors that I ran into and how I fixed them.
So, let’s get into the steps to create and start a Cloud9 environment on AWS.
Create a Cloud9 Environment in AWS
Unsurprisingly, if you’re going to create a Cloud9 instance on AWS, you’ll first need an AWS account. If you are a new AWS user, you get a lot of free tier services for a year. These are great when you’re first starting out and want to try everything.

Navigate to the Cloud9 services page and click the orange Create environment button.
Give the Cloud9 environment a name and description (optional)

Select the environment type, instance type, and platform like the screenshot below. Note that the Cost-saving setting is defaulted to “After 30 minutes (default)“. For this setup, I chose Ubuntu Server for the Platform selection.

The last step to spin up a new Cloud9 environment is to review your selections and click the Create environment button.

Your Cloud9 environment will be configured on your newly created EC2 instance. It doesn’t take too long. When it’s ready you will be presented with the Cloud9 IDE.
Cloud9 Environment Configuration
AWS provides you with some base setup for your Cloud9 environment, but in order to get up and running with Rails 7, you’ll need to update and install a few things:
- Update RVM by running
rvm get stable
- Install ruby version –
rvm install 3.1.1
- Set default version in RVM –
rvm --default use 3.1.1
- Update/install bundler –
gem install bundler
- Update/install rails –
gem install rails
- The original version of rails on my Cloud9 environment was Rails 5.
- Add your keys to GitHub using the instructions in this guide from GitHub.
- https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
- To copy your public key from Cloud9, use
nano ~/.ssh/id_ed25519.pub
orcat ~/.ssh/id_ed25519.pub
and copy the key out and paste it to GitHub.
- To copy your public key from Cloud9, use
- Test that your key was added to GitHub by running
ssh -T git@github.com
in the terminal
- https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
- Fix Postgres user name. Postgres will throw a fit because the role “ubuntu” does not exist.
- Run
sudo su postgres
- Run
create user --interactive
to create a user for the Postgres database that our application will use.- Enter a role name (remember this)
- when prompted, allow this newly created user to be a superuser by entering “y” and pressing enter.
- After you have created a Rails application, you’ll need to uncomment a line (for me, line 33) in the
config/database.yml
file and enter the role name you created. If you created a password for this role, you’ll uncomment the password line (line 36 for me) and enter it there. Note: DO NOT paste plaintext passwords into this file. Add them to Rails Credentials and use the conventions to access the password. DO NOT STORE RAW PASSWORDS HERE!
- Run

- One of the last things you’ll have to do after creating a new rails app is to add the config.hosts… text to the environment file so that Cloud9 can serve up the rails server pages.
- After running
rails s
in the terminal and firing up the preview, you will be presented with an error about adding a host to your environment file (config/environments/development.rb
). - Copy the text and add it to the file above.
- Restart the server and voila, you’ll be presented with the Rails welcome page.
- After running
Fixing Some Errors (that you might run into… who knows).
I ran into some errors when getting everything up and running. You may or may not run into these issues. Hopefully these will be the only ones you run into. If not, drop me a comment below and let me know what errors you saw.
Error: fixing git configuration for templates that use insecure connection methods
If you are using a template hosted on GitHub, you might need to set a git configuration first. Run the following command in a terminal window on Cloud9: git config --global url."git@github.com:".insteadOf git://github.com/
Error: Fixing the Yarn version installed on Ubuntu
Depending on your CSS preference, you might run into a yarn error when generating a new rails application. I saw these three errors when using the css flag to install tailwind (-c tailwind
)
ERROR: [Errno 2] No such file or directory: 'install'
ERROR: [Errno 2] No such file or directory: 'add'
ERROR: [Errno 2] No such file or directory: 'run'
The StackOverflow user, Guss, had a fantastic solution and explanation for these errors:
With kudos to all the answers that correctly suggest removing the Ubuntu
yarn
package and installing Yarn through NPM, here is a detailed answer with explanation (and, be warned, opinions):The reason for the
No such file or directory
error fromyarn install
is that you are not using the “correct” Yarn: the software you get when you installyarn
using the Ubuntu software sources is the “yarn” scenario testing tool from the cmdtest blackbox testing suite. This is likely not what you meant as Yarn is also a popular development lifecycle tool for Javascript application (similar to Make, Maven and friends).The Javascript Yarn tool is not available from Ubuntu software sources but can be installed by NPM (which is another development lifecycle tool that Yarn aims to replace – so that’s awkward…).
To make Yarn available in Ubuntu, start by removing
cmdtest
and its tools:
$ sudo apt purge cmdtest
Then make sure NPM is installed:
$ sudo apt install npm
Then use NPM to install Yarn:
$ npm install -g yarn
Note: using
Stackoverflow user Gussnpm install -g
will install a Javascript package for your current user account, which should be fine for most purposes. If you want to install Yarn for all users, you can usesudo
for the NPM command, but that is not recommended: NPM packages are rarely audited for security in the context of a multi-user operating system and installing some packages might even break when installing them as “root”. NPM used to warn against running it withsudo
and the main reason it is not doing so today is that it annoys people that use sandboxed “root-like” environments (such as Docker) for building and deploying Javascript applications for single-user servers.
Error: the foreman gem was not installed
When I tried to run the bin/dev command from the terminal, I received the following error:
ubuntu:~/environment/quote-editor (main) $ bin/dev
/home/ubuntu/.rvm/gems/ruby-3.1.1/bin/foreman: 6: exec: /home/ubuntu/.rvm/gems/ruby-3.1.1/bin/ruby: not found
I’m still not quite sure why the foreman gem was not installed, but a quick gem install foreman
in the terminal fixes this issue.