Utilizing an AWS EC2 to create & Install NGINX Server at Launch

Melissa (Mel) Foster
Women in Technology
3 min readMar 17, 2023
Edited Logos on Adobe Free Stock

Today, we will be working once again with AWS (Amazon Web Service) EC2 service. We will create a new EC2 Instance and install a NGINX webserver. (NGINX is an open source software, used for web serving, reverse proxying, media streaming and more.) Our goal is to install at the launch of our EC2. I think we can do it!

To follow along you will need //

  • AWS Account with proper credentials using Free Options

To begin, we will log into our AWS Console. If you are like me and have been exploring your AWS Console, your home screen shows you your most recently visited. Select EC2.

Select EC2

Now, in our EC2 Dashboard, we can begin the process of setting up our EC2 by selecting Launch Instance.

Select Launch Instance

Next, we will name our Instance and choose our AMI. I am choosing to use the Ubuntu Server 22.04 LTS, which is offered as Free tier eligible.

As well will be keeping the Instance type as t2.micro Free tier eligible.

Choose the name of your Key-pair.

Note: It’s always recommended to create a new key pair and customizing the name to your project will help you stay organized.

Following down the screen we will now set up our Network Settings.

Our last section that needs our attention for this project is the Advanced details. We need to scroll down till we see User data.

Keep scrolling till we get to User data

In the User data we will enter our Bash Script to Install our NGINX Web Server

Simple Bash Script to Install NGINX at the start of the instance.

#!/bin/bash
sudo apt-get update -y
sudo apt-get install nginx -y
sudo service nginx start

Ok, you ready!! This was a fast foundational project that once we click our final launch we will have successfully created a NGINX Webpage at startup of our EC2! Here we go….. hit that launch button!

SUCCESS!!!! (Image: Adobe Free Stock)

As always, I hope you enjoyed this brisk walk-through! Be on the look-out for an advanced article showing how to do all this by utilizing the AWS CLI Service.

Join me on https://www.linkedin.com/in/melissafoster08/ or follow me at https://github.com/mel-foster

--

--

Melissa (Mel) Foster
Women in Technology

𝔻𝕖𝕧𝕆𝕡𝕤 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 |𝒲𝑜𝓂𝑒𝓃 𝐼𝓃 𝒯𝑒𝒸𝒽 𝒜𝒹𝓋𝑜𝒸𝒶𝓉𝑒 | 𝚂𝚘𝚌𝚒𝚊𝚕 𝙼𝚎𝚍𝚒𝚊 𝙲𝚛𝚎𝚊𝚝𝚘𝚛 | Photographer