Friday, 27 December 2024

Step-by-Step to Creating an EC2 Instance in AWS

 

What is EC2?

Amazon Elastic Compute Cloud (EC2) is a web service provided by Amazon Web Services (AWS) that allows users to rent virtual servers (referred to as "instances") on which they can run their applications. EC2 instances are essentially virtual machines that can be launched in the cloud and scaled up or down as needed. EC2 provides a wide range of instance types to choose from, allowing users to select the instance size and configuration that best fits their needs.

Why do we need an EC2 instance?

One of the main reasons we need EC2 instances is because they offer scalability and flexibility We can launch EC2 instances on demand and scale up or down as needed to match our workload requirements. This means we can easily provision resources when we need them and only pay for what we use.

Creating an EC2 instance.

No alt text provided for this image

Step 1: Sign in to the AWS Management Console

No alt text provided for this image
EC2 dashboard

To create an EC2 instance, you first need to sign in to the AWS Management Console. If you don't already have an AWS account, you'll need to create one. Once you're signed in, navigate to the EC2 dashboard and Launch an instance.


Step 2: Choose a name of your instance

No alt text provided for this image

Select a name of your instance as per your likability


Step 3: Choose an Amazon Machine Image (AMI)

No alt text provided for this image
Selecting AMI for your instance

An Amazon Machine Image (AMI) is a pre-configured virtual machine that serves as a template for your EC2 instance. You'll be prompted to choose an AMI from a list of available options. You can choose from Amazon Linux, Ubuntu, Windows, and many other options.


Step 4: Choose an Instance Type

No alt text provided for this image

An instance type determines the computing resources (CPU, RAM, storage, etc.) available to your EC2 instance. There are a variety of instance types to choose from, ranging from small and low-cost to large and high-performance. Select the instance type that best fits your needs and budget.


Step 5: Create a key pair

No alt text provided for this image

Create a key pair if you have never created one and store it in a safe place because it will act as a key to log in to your instance.


Step 6: Configure Security Group

No alt text provided for this image

Security groups act as virtual firewalls for your EC2 instance, controlling inbound and outbound traffic. You can configure security groups to allow or deny traffic from specific IP addresses, protocols, and ports. In this step, you'll need to create a new security group or select an existing one.


Step 7: Add Storage

No alt text provided for this image

EC2 instances require storage for the operating system, applications, and data. In this step, you can add and configure storage volumes for your instance. You can choose from different types of storage, including Amazon Elastic Block Store (EBS) volumes and instance store volumes.


Step 8: Review and Launch

No alt text provided for this image

Before launching your instance, review all the details to make sure everything is correct. You can also modify any settings that need to be changed. Once you're ready, click the "Launch" button to start your EC2 instance.


Step 9: Connect to Your Instance

No alt text provided for this image

After launching your instance, you can connect to it using various methods, such as SSH or Remote Desktop Protocol (RDP). You can also use the AWS Systems Manager Session Manager to connect to your instance securely without the need for a public IP address.

Conclusion

No alt text provided for this image

Creating an EC2 instance in AWS is a simple and straightforward process. With just a few clicks, you can launch a virtual machine in the cloud and start using it right away. By following the steps outlined in this guide, you can create your own EC2 instance in no time.