Configuring an EC2 Instance as a Web Server with Nginx


Tasks
Set up a new EC2 instance for the Nautilus project.
Instance Name: Name the EC2 instance
devops-ec2
.AMI: Use any available Ubuntu AMI to create the instance.
User Data Script: Configure the instance to run a script at launch to:
Install the Nginx package.
Start the Nginx service.
Security Group: Configure the instance to allow HTTP traffic on port 80
from the internet.
Steps
Launch instance with name devops-ec2.
Paste the given userdata in advance section.
#!/bin/bash
sudo apt-get update -y
sudo apt-get install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
Instance is created
Now, let’s verify whether the IP has nginx installed or not.
Boom! we have successfully completed the tasks.
#happylearning #userdata #aws #cloudcomputing
Subscribe to my newsletter
Read articles from Abishek Kafle directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Abishek Kafle
Abishek Kafle
Infosec Poet and CAP-certified DevOps/SecOps Engineer, passionate about security, creativity, and continuous learning.