Utilizing an AWS EC2 to create & Install NGINX Server at Launch
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.
Now, in our EC2 Dashboard, we can begin the process of setting up our EC2 by selecting 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.
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.
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!
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