AWS Cloud 9 tutorial for Ruby on Rails

15 Jul 2019
0 Comments
AWS Cloud 9 tutorial for Ruby on Rails

Every developer looks for the tools and technology that helps to manage the coding and debugging more flexible. There are many tools available for globally accessing the development work. Here globally accessing development means work in term of our code will be on cloud storage and the user can work from any machine if the internet is available.

There are many options available in the cloud but I would be discussing about AWS(Cloud9).

 

 

Amazon Web Services (AWS)

 

Amazon Web Services (AWS) is a cloud platform provides services and infrastructure from the data center globally.

Millions of customers use AWS to power their infrastructure to become more agile and at effective cost. Customer trust it as it is a more secure cloud computing environment.


 

AWS Cloud9


 

AWS Cloud9 is an integrated development environment (IDE) which is cloud-based. It provides the environment to write, run, and debug code from any machine with just a browser. Support software and tools for multiple programming languages like Ruby, PHP, Go, etc.

This reduces the time to setup program in a local development machine. Has sudo privileges and a pre-authenticated AWS CLI while running Cloud9 development environment on AWS EC2 instance. Cloud9 also integrates with AWS CodeStar, providing the tools required to deploy applications to AWS. We can easily access the AWS Cloud9 IDE through a web browser with a built-in terminal.


 

AWS Cloud9 feature:

 

1. Fully-featured Editor

It provides a browser-based editor that makes it easy to write, run, and debug your projects. We can select themes for the editor.

 

2. Broad Selection of Run Configurations

As it supports multiple languages and application type, can set up the custom configuration accordingly environment.

 

3. Integrated Debugger:

It contains the integrated panel debugger that helps to breakpoint, steps through code, check variables state.

 

4. Integrated Tools for Serverless Development

Tools like Serverless Application Model (SAM) SAM use as templates in Cloud9 to provide a simplified way of defining resources for your serverless applications.

5. Built-in Terminal

Enables to run commands, like push code changes to git, compiling your code, or displaying command output from servers.


6. Collaborative Editing and Chat

This platform helps to share development environment with a team member. This makes it easy for multiple developers to work in the same code and file too at a time and everyone can view the changes. Cloud9 allows you to use the built-in chat capability to communicate with your team without having to leave the IDE.

 

How to create and deploy Ruby on Rails application on AWS cloud9

 

Cloud9 platform is acquired by Amazon Web services. To start with Ruby on Rails application development on Cloud9 required some configuration of AWS account and Cloud9 setting.

 

Steps to Configure Cloud9 Environment:

 

1] Create or sign in to the AWS console https://console.aws.amazon.com/.

2] Configure IAM Groups and Users
a)Create two IAM Groups, Cloud9Admins, and Cloud9Users
b)Cloud9Admins can create new Cloud9 environments and should be assigned to the Cloud9Users group.

c)Sign-in to your AWS console as a Cloud9Admins user.
d)Open Cloud9 from the Services menu.
e)Select Create environment.
f)Enter the Name environment
g)Go to “Configure settings”, Create a new EC2 instance for the environment.
h)Select “next step”
i)Click “Create environment”


 

Configuration is ready now
Opening the Cloud9 IDE:
1]Open Cloud9 from the Services options.
2]Then click on the Cloud9 environment created. After that will open the AWS cloud9 environment.

 

Setup Rails Development

 

Here we can follow the general approach used to build the Rails application. When we select the EC2 instance default configuration added to our cloud9 environment.

In Cloud9 environment, we can create the new rails application as well as can install already built application.

To create a new rails app:

1]Go to the cloud9 terminal

2]mkdir rails_app

3]cd rails_app

4]rvm use ruby-2.6.3@rails_app --ruby-version –create

5] rails new. -T

Above commands will create the rails application.

 

 

Run the rails application

 

AWS Cloud9 contain tools to run a Rails server and preview the application in a browser.

1]Right-click Run available, then select New Run.

2]Run Config Name field and enter rails app name, then start rails s from the Command field of the terminal.

3]Select CWD and choose rails app folder from the given multiple lists.

4]Click on the “Run” button and launch the rails server. Rails server can be started or stop anytime by clicking on the “Run” button.

 

Preview in Browser

From the main menu, choose Preview => Preview Running Application.

New browser tab will open, click on the pop-out into a new window.

Here you will get the rails application URL opened in a new window.




Leave a comment: