AWS-EC2 - Notes By ShariqSP

Amazon EC2 Overview

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Below are the key features of Amazon EC2:

Features

Creating Ubuntu Instance

To create an Ubuntu instance on Amazon EC2, follow these steps:

  1. Sign in to the AWS Management Console.
  2. Navigate to the EC2 dashboard.
  3. Click on "Launch Instance".
  4. Choose an Amazon Machine Image (AMI) that contains Ubuntu.
  5. Select an instance type based on your requirements.
  6. Configure instance details like network settings, storage, etc.
  7. Review and launch the instance.
  8. Choose an existing key pair or create a new one for SSH access.
  9. Launch the instance.

Creating Windows Instance

The process for creating a Windows instance is similar to creating an Ubuntu instance, but you'll need to choose a Windows AMI and have the appropriate licensing.

Here are the basic steps:

  1. Sign in to the AWS Management Console.
  2. Navigate to the EC2 dashboard.
  3. Click on the "Launch Instance" button.
  4. Choose a Windows Amazon Machine Image (AMI).
  5. Select an instance type based on your requirements.
  6. Configure instance details, such as network settings and storage.
  7. Add any additional storage or tags if necessary.
  8. Configure security groups to control inbound and outbound traffic.
  9. Review and launch the instance.
  10. Choose an existing key pair or create a new one for RDP access.
  11. Click "Launch Instances."

Deploying a Simple Web Application with Apache2

Step 1: Launch an EC2 Instance

  1. Log in to your AWS Management Console.
  2. Navigate to the EC2 dashboard.
  3. Click on "Launch Instance" to create a new EC2 instance.
  4. Select an appropriate Amazon Machine Image (AMI), such as Ubuntu or Amazon Linux, and choose an instance type based on your requirements.
  5. Configure the instance settings, including network settings, storage, and security groups.
  6. Finally, launch the instance.

Step 2: Connect to Your EC2 Instance

  1. Once your instance is running, select it from the EC2 dashboard.
  2. Click on "Connect" to get instructions on how to connect to your instance using SSH.

Step 3: Install Apache2

  1. SSH into your EC2 instance using the provided instructions.
  2. Update the package index:
    sudo apt update
  3. Install Apache2:
    sudo apt install apache2
  4. Start the Apache2 service:
    sudo systemctl start apache2
  5. Enable Apache2 to start on boot:
    sudo systemctl enable apache2

Step 4: Deploy Your Web Application

  1. Navigate to the Apache2 web root directory:
    cd /var/www/html
  2. Replace the default index.html file with your web application files.

Step 5: Access Your Web Application

  1. Copy the Public IP address or DNS name of your EC2 instance from the AWS Management Console.
  2. Paste the address into your web browser's address bar.
  3. You should now see your web application deployed and accessible over the internet.

Congratulations! You have successfully deployed a simple web application using Apache2 on an Amazon EC2 instance.