AWS : EC2 Creation
Published: 2023-11-18 15:08:44

What is EC2 ?

EC2 is a Virtual Server offer by Amazon to running the application on AWS.

Installing ES2 in AWS.
Step# 1 : 
Login to Your AWS account and go to the ES2 Dashboard. 


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

Step# 2 :
In the EC2 Dashboard, Click the "Launch Instance" button(Orange color).

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

Step# 3: 
In the Launch Instance Page, Name your new Web server/Virtual Server and selecting OS Image ( AWS Linux, Ubuntu, Windows, Redhat) then choose the Latest version of the OS and Architecture. 

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

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

Step#4: 
In the Launch Instance Page, Choose the Instance type( No. of CPU's , Memory ) Re command is t2.micro for the study purpose, go head with higher performance machines for Organization purpose. 


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

Step# 5:
Creating Key Pair and it used to open your ES2 instance in your machine. 


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

Name the Key pair file and choose the RSA decryption/encryption algorithm then save the file *.pem in Local, don't share it. 


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

Step# 6:
Configure Network Settings on your EC2 instance. 


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

By clicking "Edit" button, you can change the configuration. 
Enable the "Auto-assign public IP" to connect your instance in public. Create and name your Security group to controlling the port access. We are open the ssh port to connect the EC2 from my local machine. 

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

Step #7: Storage. 
Choose the appropriate storage to be require for the application. Re command would be 8GB for learning purpose. 

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

Step# 8: 
Creating/installing the EC2 instance by click the "Launch Instance" button. You can create more than one instance with this configuration by change the "Number of Instance".


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

Below page will be navigate once EC2 successfully running. 

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

Step# 9 : 
By clicking the "Instance ID", we can see the all the configuration of EC2. 


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


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



**Detach/Terminate Instance**

Step #1:
In EC2 dashboard, Choose the instance name from list and select the Instance State drop down. It will show instance states, Stop, start, terminate, etc.

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

Choose the Instance state "Terminate Instance" will detach the instance which are choose in the Dashboard. 


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

Choose the "Terminate" button on the pop-up screen. 

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

Will take few minutes to terminated the EC2 Instance. 

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

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