Deep dive into AWS EC2

Yogendra H J
3 min readApr 23, 2021

In continuation of my last blog, ‘AWS EC2 Virtual Servers in the cloud’ let us now do a deep dive into the technicals of an AWS Elastic Compute Cloud service. The previous blog can be read in the below link. https://yogendrahj.medium.com/aws-ec2-virtual-servers-in-the-cloud-e4801131d281

An EC2 instance can be launched in multiple ways such as using console which is a basic method used, another way is using CLI commands and one more way is using a Lambda function.

Your EC2 instance can be of two types one being a Public instance and another is a Private instance.

A Public instance is one which is having public IP and is reachable from outside your network whereas, a Private instance will have only private IP and cannot be reached from outside of your defined network. When you stop and start a public instance its IP address will be changed and in a private instance, its IP remains the same.

In step3 of launching an EC2 instance, you can input a predefined script that performs the defined task at the launch time of an instance. Here, it is called User data.

If you are launching a Linux instance its root device will be at /dev/xvda and for Windows instance, it will be /dev/sda1. There are 5 different types of volumes available and can be attached to an instance at any point in time without affecting its performance. These volumes can be encrypted using the KMS system. Security groups are the firewalls at the instance level through which traffic flows in and out, required traffic can be filtered using Security groups.

All the pricing-related details of EC2 can be read here https://aws.amazon.com/ec2/pricing/.

AWS EC2 Auto Scaling is a service that ensures you have the correct number of Amazon EC2 instances available to handle the load for your application. In “Auto Scaling groups” you define the minimum, maximum and desired number of EC2 instances in your environment, and the Auto Scaling group ensures these numbers are maintained at all times based on the defined rules.

  • Launch an EC2 instance using CLI -

“aws ec2 run-instances --image-id ami-xxxxx --count 1 --instance-type t2.micro --key-name <<MyKeyPair>> --security-group-ids sg-xxxxx --subnet-id subnet-xxxxx”

  • Display your AWS EC2 key pair -

“aws ec2 describe-key-pairs --key-name MyKeyPair”

  • Delete your keypair -

“aws ec2 delete-key-pair --key-name MyKeyPair”

All details on using AWS CLI for EC2 can be referred to in the below official documentation https://docs.aws.amazon.com/cli/latest/reference/ec2/.

Nothing can make you understand things much better until you do it on your own. If you are truly inspired to start your AWS journey start it from today create your own AWS free tier account (https://www.youtube.com/watch?v=YQre9KxuoE&list=PLTyrc6mz8dg8grU1HEhVw4zoCyvAl5MBO&index=4)and explore the things by making your hands dirty. Look at the blogs, AWS whitepapers, Youtube videos (KnowledgeIndia is one I recommend) and practice everyday.

Credits: AWS official documents, KnowledgeIndia youtube channel.

Happy to hear your inputs on my blogs.

LEARN and BE CURIOUS!!!!

Cheers,

Yogendra.

--

--

Yogendra H J

Learning and Sharing knowledge || Cloud Computing evangelist || AWS SAPro || Azure Admin || Exploring DevOps