Create an EC2 instance with a webserver using user data

Hello and welcome back to my page!

On this project I will show you how to:

Create a t2.micro EC2 instance(Amazon Linux)

In the user-data field, use a script that updates all packages, installs Apache, and starts the Apache service.

Verify that the instance has the apache webserver downloaded and installed through the public IP.

Let’s get started.

First, we will go to EC2 then click Launch Instance.

I will name the instance UserData:

I chose Amazon Linux:

I chose t2.micro:

I created a new keypair:

Allow SSH traffic from Anywhere 0.0.0.0/0

Allow HTTPS traffic from the internet

Allow HTTP traffic from the internet

Then, scroll down on Advanced Details:

Paste the script as shown below on User Data:

Then, click Launch instance:

Now, I will go grab the public IP from the instance and paste it in the browser:

This is it for this project, I have succesfully created an ec2 instance with a web server using user data.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store