- Log in to AWS Console
- Go to AWS Management Console.
- Navigate to the EC2 Dashboard.
- Launch a New EC2 Instance
- Click on Launch Instance.
- Enter the instance name (e.g., "MyEC2Instance").
- Choose an Amazon Machine Image (AMI):
- Select an AMI (e.g., Amazon Linux 2, Ubuntu, or Windows).
- Select Instance Type:
- Choose an instance type (e.g., t2.micro for free tier).
- 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.
- 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.
- Configure Storage:
- Adjust volume size if needed (default is 8GB for free tier).
- Click Launch Instance.
- Allocate and Associate an Elastic IP
- Go to the Elastic IPs section in the EC2 dashboard.
- Click Allocate Elastic IP address → Choose "Amazon Pool" → Click Allocate.
- Select the newly allocated Elastic IP and click Associate Elastic IP address.
- Choose your instance from the dropdown list and click Associate.
- Connect to Your EC2 Instance
For Linux Instance:
- Open a terminal.
- 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:
- Use Remote Desktop Connection (mstsc on Windows).
- Enter the Elastic IP and connect using administrator credentials.
- Verify and Secure Your Instance
- Check Security Group Rules: Ensure only necessary ports are open.
- Port 443: Allowed from all networks
- Port 80: Allowed from all networks (till the time of deployment once done remove this rule)
- Port 22: Allowed from office networks only
- DB port: Allowed from office networks only if required.
- Enable Firewall & Updates:
sudo apt update && sudo apt upgrade -y # Ubuntu
- Install Essential Software (Optional):
Sudo apt install apache2