AWS EC2: Getting Started with Amazon EC2! ☁️💻

What is AWS EC2?

Amazon Elastic Compute Cloud (EC2) is a web service offered by Amazon Web Services (AWS) that provides resizable compute capacity in the cloud. EC2 allows users to run virtual servers, known as instances, on-demand. Users can choose the instance type, such as the amount of virtual CPUs, memory, storage, and networking capacity, based on their specific requirements.

What makes EC2 instances the rockstars of cloud computing? 🌟

Several factors account for this!

  1. Scalability: Users can easily scale up or down by launching and terminating instances as needed.
  2. Variety of Instances: EC2 offers a wide range of instance types optimized for different use cases, such as compute-optimized, memory-optimized, storage-optimized, and GPU instances.
  3. Customizable: Users have control over the operating system, instance type, storage, and networking configurations.
  4. Pay-as-You-Go Pricing: EC2 follows a pay-as-you-go pricing model, allowing users to pay only for the compute capacity they use.
  5. Elastic Load Balancing: EC2 instances can be distributed across multiple Availability Zones using Elastic Load Balancing to ensure high availability and fault tolerance.
  6. Security: EC2 provides features such as security groups and network access control lists to control inbound and outbound traffic to instances.
  7. AMI (Amazon Machine Image): Users can create custom AMIs or use pre-configured AMIs provided by AWS to launch instances with specific software configurations.

In simple terms, AWS EC2 is like a versatile tool used for many things in the cloud, such as hosting websites, running applications, and handling data.
It's a key building block for various cloud services and solutions.

Steps for launching your web server on your first EC2 instance at no cost:
  1. Log in to your AWS console.
  2. Navigate to EC2 in the services panel.
  3. Click on Launch instance.
  4. In the Name and tags section, input your instance in the name text input, for example, I'll use MyWebServer.
  5. In the Application and OS Images (Amazon Machine Image) section, select the AMI for your EC2 instance, I'll opt for Amazon Linux for my instance as it's Free tier eligible.
  6. In the Instance type, choose t2.micro, also eligible for the Free tier. Check all instace types here.
  7. In the Key pair (login) section, create a new key pair by clicking Create new key pair
  8. In the subsequent Create key pair popup, enter a key pair name, keep the default settings, click Create key pair and Download the newly created key pair to your machine.
  9. Select the key pair from the dropdown list.
  10. In the Network settings section, enable Allow HTTP traffic from the internet to grant Internet access and keep other settings at their defaults.
  11. Click on Launch instance.
  12. Return to your instances list and wait until the instance's Status check indicates 2/2 checks passed, signifying that your instance is now running.
  13. Click on the instance ID, go to the Networking tab, and copy the Public IPv4 address.
  14. Open your terminal and execute the following commands:
    1. ssh -i {path-to-your-keypair-which-you-created-earlier-in-step-7} ec2-user@{paste-here-the-Public IPv4 address}
    2. sudo su
    3. yum update -y
    4. yum install httpd
    5. httpd
  15. Paste the Public IPv4 address into the browser and press Enter.
  16. If you've followed all the steps correctly, you should see the same result I have
  17. 🎉 Fantastic! 🎉 Your web server is now up and running on an EC2 instance.