This Gistdicated to all those beginners and learners who are seeking to learn and explore Cloud Computing. Cloud Computing seems to be a complicated term, but believe me it not. Especially, when you're working on AWS Cloud Computing platform. So, without wasting more time lets begin.
Hey Readers! This Blog is to acknowledge one of the most widely used Cloud Computing services provided by Amazon under AWS cloud computing services. That is, EC2 or Elastic Cloud Computing. It is widely used and easy to learn and explore. We all know the fact that in cloud computing no other company or service can even be compared with AWS, not even Google's Cloud Computing. It is because AWS provides-
- better and easy to use UI/UX to the users.
- Consistency & Reliability.
- Flexibility, Scalability, and high-performance
- Pay-As-You-Go Pricing (cost-effective)
- a lot of customization.
- Security as its prior concern
- Learning platforms and Tutorials, and never lasting documentation.
- And most of all, incomparable customer care support.
Meanwhile, Check out the free-tier services first provided by AWS, visit: https://aws.amazon.com/free/ for the same.
Coming to the main focus of this writing, we're going to cover below-mentioned topics in this blog:
- About EC2
- Setup EC2 Instance
- Stepwise installation.
- Setup SSH Key
- Connect and clone Git repo
- install Node.js, NPM modules, and learn how to launch a website.
1. About AWS EC2
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. Read more…
2. Setup EC2 Instance
Sign up on AWS at https://aws.amazon.com/ and make an account. You will need to enter your billing and credit card information. However, you'll be charged few dollars or less just to get confirm it's a legit account and the deducted amount will get refunded later on.
Note: You should delete instances you no longer need to ignore any additional billing unknowingly.
Find and Select Amazon EC2 from listed products and services.
Click the button: "
Now, adhere to the steps mentioned below to get started and for a successful installation.
Choose an Amazon Machine Image (AMI): This is the operating system your virtual machine in the cloud will be. As Ubuntu is popular, open-sourced, easy to use, and included in free tier eligibility.
Step 2: Choose an Instance Type: Leave it at "
General purpose t2.micro free tier eligible". Click "
Next: Configure Instance Details."
Step 3: Configure Instance Details: Leave the default settings. Click "
Next: Add Storage"
Step 4: Add Storage: Leave the default settings. Click "
Next: Add Tags"
Step 5: Add Tags: Create a key and value. I named mine
Step 6: Configure Security Group: Check the radio button labeled "
create a new security group" and give it a name and description. Make sure there is an SSH type listed and add HTTP and HTTPS. Click "
Review and Launch"
Step 7: Review Instance Launch: Click "
Launch" The following window should appear. Select "Create a new key pair" and type in a name. Click "Download." Make sure you save this file!!! Click "
launch instance" You should be redirected to a page where you can click "view instances" to see all your instances. Your new EC2 instance should appear and may take a few moments to initialize.
I hope, by now. you must have successfully launched an EC2 in your AWS console. But If you get stuck somewhere and unable to solve any problem, write me back in anytime. Connection links are listed in end. As we're going to setup ssh connections further we need EC2 instance up and running.
4. Set up ssh connection
On your local machine, move the download file (tutorial.pem) to your project's root folder and open terminal in the root directory of your project.
'chmod 400 tutorial.pem' to change required permissions.
Go back to your AWS Console and open
EC2 dashboard> Running instances and click on '
connect'. Here you'll find more details to access your SSH instance. Now, copy example there and type in similar command in terminal:
ssh -i "tutorial.pem" ubuntu@ec2–15–236–127–272.ap-south1.compute.amazonaws.com
Now, you may get into your remote EC2 instance's operating system via your terminal.
Note: you can also use third-party software like Putty.
5. Clone GitHub Repo and Launch your website:**
Clone project from Github to EC2 console terminal. Run:
git clone https://github.com/genialkartik/NodeJS_demo_repo.git . cd NodeJS_demo_repo
6. Install node.js, npm, and launch our website
sudo apt-get update sudo apt-get install nodejs sudo apt-get install nodejs-legacy sudo apt-get install build-essential sudo apt-get install npm npm install npm start
If everything goes well, you'll get a message in the console
'Server running at http://ec2-15-236-127-272.ap-south-1.compute.amazonaws.com:3000'
Follow the link or enter your Public DNS (IPv4) in URL with :
After a few mins or two, you should be able to refresh your site in the browser and see your web application up and running!
Woaaahhoo!! Congrats you did it!!
Phew!! that was a lot to understand for the day. I hope you loved it and successfully launched your website using AWS EC2 instance.
If you really like it or it may prove helpful to you anyhow, you are welcome to continue looking around on kartiktyagi.me and read even more exciting articles. You are welcome to reach me out for any unsettled questions! :)