AWS for DevOps - EC2 Instance

Hey everyone, this is the third article in the series on AWS for DevOps. In this article, we are going to learn about EC2 Instances.

Introduction:

EC2 stands for Compute Cloud, it provides on-demand, scalable computing capacity in AWS. Using this, the hardware costs help you develop and deploy applications faster.

Using EC2, we can launch as many instances as you want. Using this, we can configure security and networking, as well as manage storage. It helps us scale up or down easily to handle compute-heavy tasks.

The architecture of EC2:

The EC2 instance is always secured with a security group, which is a virtual firewall that controls incoming and outgoing traffic. A private key is stored on the local computer, and a public key is stored on the instance. Both keys are specified as a key pair to prove the identity of the user.

Amazon Virtual Private Cloud (VPC):

A VPC is a logically isolated section of the AWS cloud where you can launch your AWS resources. It provides network segmentation, allowing you to define your own private IP address space, subnets, and routing tables. The EC2 instance resides within the VPC.

Availability Zone:

These are distinct data centers within a region. They provide redundancy and fault tolerance. Placing an EC2 instance in a specific AZ ensures high availability.

Security Group:

A security group acts as a virtual firewall that controls inbound and outbound traffic to the EC2 instance. You define rules in the security group to permit or deny traffic based on protocols, ports, and IP ranges.

Key Pair:

To access the EC2 instance securely, you use a key pair. A private key is stored on your local computer, and a corresponding public key is stored on the EC2 instance. This key pair is used for authentication when connecting to the instance.

Amazon EBS Volumes:

The EC2 instance is backed by an Amazon Elastic Block Store (EBS) volume. EBS provides durable block storage that can be attached to EC2 instances. You can think of it as a virtual hard drive where your data is stored.

Internet Gateway:

An internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between your VPC and the internet. It enables outgoing traffic from your EC2 instance to the Internet and incoming traffic from the Internet to your instance if you've configured it to allow that traffic.

How do these work internally?

  • When you launch the EC2 instance, you specify which VPC it belongs to and which subnet within that VPC it should reside in.
  • The security group associated with the instance controls the traffic allowed in and out of the instance, acting as a firewall.
  • You use the private key stored on your local computer to securely connect to the instance via SSH (for Linux) or RDP (for Windows).
  • The Amazon EBS volume provides storage for the instance's operating system, applications, and data.
  • The internet gateway allows the EC2 instance to communicate with the internet if necessary, making it accessible from the outside world.


Set up EC2 Instance

Step 1: Sign up for or log in to your AWS account.

Step 2: Enter "EC2 instance" in the search bar and enter

Step 3: Now, you'll get the dashboard of Instances. Click on Create instance now.

Step 4: Now, give a name to your instance. In my case, I've given it 'Test-EC2."

Step 5: In the Application and OS Images section, select the image that you are familiar with. I've chosen the default AWS Linux.

Step 6: Scroll down and select the "Create Keypair" option.

Step 7: Give the name as you wish, keep the remaining settings as default, and click on the Create Key Pair button.

Step 8: After clicking the button, the keypair gets downloaded automatically. Then click on the launch instance button.

Step 9: Now, go to the directory where the keypair file has been downloaded and open the terminal.

Step 10: On the AWS instances dashboard, you can see the number of instances running. On that, click your present instance's 'Connect option" and go to the "SSH client" option.

Step 11: Copy the code that you see in the ssh section and paste it into the terminal. Yes, give input, and it gets connected to the instance.


I hope you've got some basic knowledge about the instances in AWS (EC2). In an upcoming article, we are going to learn about the life cycle of EC2, VPC, Security Group, Route 53, S3 Buckets, and so on.

I request that you please follow me to get further updates and comment if you have any doubts.

To view or add a comment, sign in

More articles by Manjunath Irukulla

  • Guide to Observability using SigNoz - Part 2

    Hey, Welcome Back to the Series of Observability using SigNoz! Let’s focus on installing SigNoz on our system. Make…

  • A Comprehensive Guide to Observability using SigNoz

    In the ever-evolving world of DevOps, observability stands as a pillar for maintaining robust and reliable systems…

    2 Comments
  • Kicking Off an Exciting New Project: Intelligent CI/CD Pipeline with AWS and Generative AI! 🚀

    I'm thrilled to announce that we're embarking on a groundbreaking project to build a robust and intelligent CI/CD…

  • Terraform Series - Part 1

    Terraform, it is an Infrastructure as Code tool. As a DevOps or Cloud Engineer, we may work with multiple cloud…

  • Data Visualization - IPL Dataset

    Hey people, we've performed a few basic EDA commands on the IPL dataset. Now we are going to learn how to visualize the…

  • EDA Analysis on IPL Dataset

    In this new series, I'm going to share my learnings in Machine Learning. In this article, we are going to learn what…

  • Introduction to Containerization - Docker

    Containerization is a powerful process that simplifies application deployment and management across various…

  • AWS for DevOps - Part 02

    Prerequisites: To continue this blog you must have created an account on AWS. if you haven't made one, then try this…

  • Source Control Management

    Have you heard the term Source Control Management before? It's okay if not, because in this blog we are going to cover…

    1 Comment
  • AWS for DevOps

    Cloud computing is considered one of the most required skills these days. For those who generally don't know what cloud…

Explore content categories