A 0.99's Story⚡
Published: 2024-01-20 06:26:39

## What's a o.99?
99% might seem like a great number for Server Availability but actually boils down to 7 hours of down time per month!
That's why the 9's after the dot are important.

Did you ever think about why or how Netflix Servers Never go down? or how Facebook Servers go down for hours sometimes?
This is caused due to Server Down time but we all know that mostly. We are going to talk about Server Up Time & the role of AWS Elastic Compute Cloud service, how it works & it's role in reducing server down times , how it instantly scales up to handle high amounts of users.
And for the previous question, Netflix Operates at an Availability rate of **99.99%** !

## What & Why of EC2
Social Media Applications like Facebook, Tiktok or Instagram get more than 50 Million Users Every Month. But they aren't handling 50 Million users Every Single Moment. Sometimes it could spike up to more than 100 Million Users! This could instantly increase your Cloud Computing Costs a Hundred Folds. So How do you handle this instant spike? specially during Holiday seasons when everyone's on their phones sharing Terabytes of data online. 
You balance things up to reduce cost.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5l8yw4ibq8dtg4oivyd.gif)


AWS EC2 makes it so that you no longer need to use or buy new servers when there's a user spike up, instead it automatically scales up the software to meet the needs. It also stay in high availability because of the world wide AWS availability regions. So even if one region is damaged , backups from another region will instantly ring up & pull the entire system online. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd30q4qym9l25y0lsj0w.gif)

You can also pick & choose the type of EC2 instances you wish to use. For example if you're hosting hardware heavy application that needs extensive GPU power you can adjust & create an EC2 instance that uses more GPU power. Or in case of analyzing large amounts of data you allocate more storage to your instance. This way you no longer have to worry about configuring your software manually & use EC2 to serve any purpose.

Now let's see how you can easily ring up an EC2 instance of your own.

## Creating an EC2 Instance

- Go to AWS Console & in the search bar look for EC2

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lczyqjocs01g0t3vnh2l.png)
Select the EC2 service
- On the side panel , click on instances

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4wh9sp8v706nrcuh2v9k.png)

- Check the AWS Computing Service Instance & review the details

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ic5i9umwo9q3x7313gar.png)

- After that click on `Instance Types` on the left panel
- Search & select these 3 instance types `t3.large` `c5.large` `r5.large` & check them all


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ubaks6dnq79evd9onp1o.png)

- Return to instances tab & copy the IPV4 address

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wkh50mv3y57hcz85l68.png)
- Paste the id in a new browser tab & you should see something similar with all the info from your instance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgrbhk4d5caewqupqhws.png)
- Back to instances tab , click on `connect` 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm73ba5a81hgfdm3e5sj.png)
- You can click & review each individual section then click connect

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wuinmg901gkqx7c1qchz.png)

- You will be taken to a Terminal environment, now you must carry out these code commands:

1. Type the following command to provide ROOT Privilege:

`sudo -i`

2. To change to the application directory, run: 

`cd ../home/ec2-user/sample_app`

3. To view the files in the sample_app directory, run: 

`ls`
			 
4. To check the instance log, run: 

`tail -lf aws_compute_solutions.log`


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwz76jilxlf846hp1ele.png)

Make sure to add proper space & '.' / '_' in each command , as you can see I got an error for writing 'sample.app' instead of 'sample_app'
- Review the log details, press `Cntrl + C` , close the terminal window & return to your instance tab.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v56avsyr0y8y4sz57c7s.png)

- In your instances tab, go to Actions > Instance Settings > Edit User Data

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guthmclstxhlzxnpoae3.png)

- Review the commands under current user data

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9dcja2t1zndu6m9qfun6.png)

-Return to Instances tab, click on Instance State > Stop Instance, when prompted , click 'stop'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2516arpky03r6mng1ik.png)
 
That's pretty much it!
The complete bare bone basics of running an AWS EC2 instance. You can restart your instance by going on Instance State > Start
Review more info on the Instance Action tab.
This demo was done to show a basic idea of EC2 & how to navigate around an EC2 instance.
You can do this exercise by going to [AWS Cloud Quest](https://explore.skillbuilder.aws/learn/course/external/view/elearning/11458/aws-cloud-quest-cloud-practitioner)

Happy Coding!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrrksubuwr7gospvnt4p.gif)