Configuring an EC2 Instance as a Web Server with Nginx

Abishek KafleAbishek Kafle
1 min read

Table of contents

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

  1. Launch instance with name devops-ec2.

  2. 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
  1. Instance is created

  2. Now, let’s verify whether the IP has nginx installed or not.

  3. Boom! we have successfully completed the tasks.

    #happylearning #userdata #aws #cloudcomputing

0
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.