AWS (Amazon Web Services) provides a powerful platform for hosting applications with security and scalability. In this blog, we will guide you through setting up an EC2 instance and installing an SSL certificate to secure your website.
Step 1: Launch an AWS EC2 Instance
Log in to AWS Console
- Go to AWS Console and sign in to your account.
- Navigate to EC2 Dashboard from the Services menu.
Create a New Instance
- Click on Launch Instance.
- Select an Amazon Machine Image (AMI), such as Ubuntu 22.04 LTS or Amazon Linux.
- Choose an instance type (e.g., t2.micro for free-tier users).
- Click Next and configure the instance settings as required.
Configure Key Pair for SSH Access
- Create a new key pair or use an existing one.
- Download the .pem file and keep it secure.
Configure Security Group
- Open ports 80 (HTTP), 443 (HTTPS), and 22 (SSH) to allow traffic.
- Click Review and Launch and confirm the instance launch.
Step 2: Connect to Your EC2 Instance
Once the instance is running:
- Open Terminal (Mac/Linux) or PuTTY (Windows).
- Run the following command to connect:
Step 1: Launch an AWS EC2 Instance
ssh -i "your-key.pem" ubuntu@your-ec2-public-ip
Step 2: Install Apache or Nginx
For Apache:
sudo apt update && sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
For Nginx:
sudo apt update && sudo apt install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
Step 3: Install SSL Certificate Using Let’s Encrypt
sudo apt install certbot python3-certbot-apache -y