Using CLOUD9 for build and deploy simple flask App

What is Cloud9 ?

Cloud9 is a Cloud/online based Integrated Development Environment (IDE).Just like other IDEs cloud9 helps to write, run and debug your code. It is integrated with code editor, debugger and terminal. It supports multiple programming language including c , c++, PHP, Ruby, Perl, Python, javascript and Node.js and Go.

Most of Code for Cloud9 is written in Javascript where it uses Node.js as back-end.Due to the Cloud-based IDE developer can write their code from anywhere either from office , home or from anywhere using internet-connection. It also helps to easily define resources , debug as well as switch between local and remote execution of serverless applications.One of the interesting features for any developer can be sharing the development environment with teams and also track the individual input’s in real time. Initially it was published as  open source but later it was acquired by Amazon in July 2016. New users should have Aws account to use Cloud9 service.

Let dive for practical

Step 1

From search bar type cloud9 or under the service category select developer tool and click cloud9

Step 2

Click Create environment

Step 3

Give the name of the  environment, in my case i have give the name “Demo-app”.In the description Section it is optional you can add description about your application. In the Environment type if you have any existing EC2 machine you can choose or create new Instance and for the instance type you can choose on your requirements for now i have choose t2.micro

Step 4

In the platform section I have chosen the recommended platform amazon linux 2023 or you can choose on your requirements. In the timeout section I have chosen 30 minutes, Cloud9 will be inactive or hibernated if the user is inactive for 30 minutes. Under the Network setting for the connection i have chosen AWS systems Manager(SSM) or for the secure shell connection you can choose Secure Shell(SSH).In the VPC section i choose default VPC if you need any custom you can create your own VPC and select. To manage all this setting IAM resources will be created automatically by AWS. 

Now you can Click Create

Step 5

Finally create environment, our cloud9 will create a ec2 instinct also creating role for that specific ec2

Now cloud9 is running on ec2 you can see on the EC2 service

Step 6

Accessing the Cloud9 terminal go to Demo-app and Click  open in cloud9

After that  IDE  opens in new tab

Step 7

Now first updating our EC2 instance using our first command

Type “sudo yum update”

As you can see our system is up to date.

Step 8

Since  it is a new machine it doesn’t have any python install

To Check  python version type “Python  – -version”

To install python 

Type “Pip install –upgrade pip”

Step 9

Now you need to project to work on, for that i am cloning my flask app into cloud9

Type git clone “https://github.com/dharmendrakarki/cloud9-flask.git”

.Now you see the file in the right hand side

Step 10

You can now access to the project and since the app is flask based you need to install flask package using CLI. Now to install flask package change the directory to your project directory then

Type “pip install flask”

Now the flask package is installed

Step 11

Since our app is exposed through port 3000 so you need to add the port 3000 to your security group. Now go to the EC2 security group and edit inbound rule then add port 3000

Step 12

Finally go the the Cloud9 and type command “python3 app.py “ to start the project

Step 13

Finally you can see the project in the browser

Leave a Comment

Your email address will not be published. Required fields are marked *