1. Log in to AWS Console
  1. Go to AWS Management Console.
  2. Navigate to the EC2 Dashboard.

 

  1. Launch a New EC2 Instance
  1. Click on Launch Instance.
  2. Enter the instance name (e.g., "MyEC2Instance").
  3. Choose an Amazon Machine Image (AMI):
    • Select an AMI (e.g., Amazon Linux 2, Ubuntu, or Windows).
  4. Select Instance Type:
    • Choose an instance type (e.g., t2.micro for free tier).
  5. Create or Select Key Pair:
    • If you don’t have a key pair, create a new one and download the .pem file for SSH access.
  6. Configure Network Settings (Security Group):
    • Choose "Create a new security group".
    • Add rules for SSH (22 for Linux) and RDP (3389 for Windows) to allow access.
    • Optionally, allow HTTP (80) or HTTPS (443) if hosting a web application.
  7. Configure Storage:
    • Adjust volume size if needed (default is 8GB for free tier).
  8. Click Launch Instance.

 

  1. Allocate and Associate an Elastic IP
  1. Go to the Elastic IPs section in the EC2 dashboard.
  2. Click Allocate Elastic IP address → Choose "Amazon Pool" → Click Allocate.
  3. Select the newly allocated Elastic IP and click Associate Elastic IP address.
  4. Choose your instance from the dropdown list and click Associate.

 

  1. Connect to Your EC2 Instance

    For Linux Instance:

  1. Open a terminal.
  2. Run the following command (replace your-key.pem and your-elastic-ip):

ssh -i your-key.pem ec2-user@your-elastic-ip

    For Windows Instance:

  1. Use Remote Desktop Connection (mstsc on Windows).
  2. Enter the Elastic IP and connect using administrator credentials.


  1. Verify and Secure Your Instance
  1. Check Security Group Rules: Ensure only necessary ports are open.
  2. Port 443: Allowed from all networks
  3. Port 80: Allowed from all networks (till the time of deployment once done remove this rule)
  4. Port 22: Allowed from office networks only
  5. DB port: Allowed from office networks only if required.


  1. Enable Firewall & Updates:

sudo apt update && sudo apt upgrade -y  # Ubuntu


  1. Install Essential Software (Optional):

Sudo apt install apache2