Deployed My First App In AWS!

Want to deploy your application on the cloud?

Cloud computing!

Now imagine if you have an application that requires a lot of processing. What will you do? Will you buy a server that has a lot of processing power, put your application over there, and then see how your application is functioning? or if you have an option to rent a server from a cloud provider like AWS? You only pay for what you use!

Before sharing Crio’s way of #learnbydoing, let me just tell you what is AWS EC2 and its basic architecture.

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware upfront, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

So, this is the basic structure of AWS EC2, where EC2 stands for Elastic Compute Cloud. EC2 allows users to use virtual machines of different configurations as per their requirements. It allows various configuration options, mapping of an individual server, various pricing options, etc. Following is the diagrammatic representation of the architecture.

AWS EC2 Basic Architecture

In the above diagram, S3 stands for Simple Storage Service. It allows users to store and retrieve various types of data using API calls.

Create an EC2 instance

Elastic Compute Cloud (EC2) is the IaaS(Infrastructure as a Service) offering from AWS — you can rent out servers with customizable memory, storage, and bandwidth. These servers can then be used for purposes of hosting your applications, which is exactly what we’re going to do.

1)In the first step, create an AWS free account. Log in and search for EC2. After clicking you will see an EC2 dashboard. Click on the launch instance button.

EC2 dashboard

2)In the second step, Select Ubuntu 18 64 bit (x86). — this reflects the OS configuration of the server you’d be renting. Note: that if you select any other distribution, the instructions/user-name to log in, etc will be different.

Step 2

3)In the third step, Click on t2 micro (Free Tier) with 1 GiB memory. This reflects the storage setting. Make sure you select the free one — you’ll be charged otherwise. Click Next Configure Instance Details.

Step 3

4)In the 4th step, Choose the number of instances as 1 and click the default subnet in any available zone. Move to the next step, Click on Add storage.

Step 4

5) Leave this at default. Click on Add tags.

6)Sixth step is to Write Name in the Key and write anything in the value and that value will be your Instance name. Click on the configure security group.

Step 6

7). There should be three open ports, with the configurations as shown — Confirm that you fill them exactly like they’re given here

Click on review and launch. You should see something like this

8) Click on Create a new key pair. Give a key-pair name, download it in a place you’d remember. The PEM(Privacy Enhanced Mail) file is your credentials for you to be able to access your instance.

After that click on launch and wait for a few minutes to launch our instance.

9) After launching, you will see a screen like this. Click on View Instances to go to the Instances window.

10)If you want to stop/terminate/reboot your instance, you can do it anytime from the console.

Instance launched

Put the SSH into your instance

  1. Open cmd and run Powershell.
  2. Log in to your (ubuntu) server

syntax : ssh -i “crio-demo.pem” ubuntu@<your-ec2-url>

After running this command, you will enter the AWS instance terminal.

Install the Docker

APT is a packet manager in Linux. The following instructions are similar to installing an EXE file in windows or an app in Android.

Type the following instructions in the AWS instance terminal -

sudo apt-get updatesudo apt-get install wgetwget -qO- | shsudo usermod -aG docker $USER(in my case its 'ubuntu')sudo service docker startnewgrp docker

Install telnet

sudo apt install -y telnet

Run the docker container for the QEats app(your desired application) server.

You are exposing your server on port 8081 — so make sure your firewall rules allow incoming connections on this port.

sudo docker run -d -m 800m -v /var/log:/var/log:rw -p 8081:8081 criodo/qeats-server

The moment you run the above command, you will start seeing something like:

It will take a few minutes as it is downloading all the necessary images from Docker Hub — a public repository of docker images. You can think of Docker Hub as an App store for docker images.

Once your download finishes, your server will start serving data on port 8081!

Type telnet localhost 8081 from the same AWS instance and you should see the following output if everything worked fine -

You can press Ctrl + ] and then type quit to return back to the terminal.

Connect the Crio’s QEats Android app(your desired application) with your server!

Download the QEats Android App (APK) onto your phone and install it. If you don’t have an Android phone, you can use an online Android emulator also!

  1. Copy and paste the public IPv4 address from your “view instances dashboard” in the place of the host.
  2. Port will be by default 8081.
  3. Congratulations! You have successfully deployed your app server on AWS EC2 using Docker!

So, after completing the Crio Winter Of Doing Stage 1, this is what Crio’s hands-on sessions and activities helped me a lot to understand the concepts in a better way. It is a complete practical implementation and not just brush up things and learn definitions, it can definitely be called #LearnbyDoing. Their ideology of #LearnbyDoing is resonated very well through their #work-like Micro-Experiences.


#criodo #Shareyourlearning #cwod #stage1




Aspiring web developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Journey from Dockerfile to Docker compose

My thoughts on Basecamp new head of marketing position


Deprecating AWS CloudFormation stacks towards Terraform

Creating a website with Django and installing a template and passing data to the template from form…

Five Types of Dysfunctional Software Teams and How To Fix Them

D-code Portait: Quentin Le Brouster, CTO of Back Market

Epic Cash Mining Tutorial (Linux)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prasanti Mishra

Prasanti Mishra

Aspiring web developer.

More from Medium

Open Graph Tags and Twitter Cards — My Full Stack Journey

How to pass the AWS Cloud Practitioner Certification?

Control your incoming traffic on your website AWS

Top 5 programming languages to learn in 2022