Skip to content

This lab demonstrates setting up a secure AWS account, creating an IAM admin user with MFA, and deploying a custom Apache web server on an Amazon EC2 instance using best practices. The project focuses on foundational AWS security, EC2 provisioning, and Linux web server configuration.

License

Notifications You must be signed in to change notification settings

justintimejlew/1-AWS-Web-Server-EC2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Lab 1: Deploy a Custom Apache Web Server on Amazon EC2

Description:

In this project, I will launch a Amazon EC2 instance using Amazon Linux 2023, configure it as a web server with Apache (httpd), and create a customized webpage with a simple, but modern design. The setup will be automated using User Data to ensure that the web server and webpage is configured automatically upon instance startup.

How This Skill Benefits Companies:

👩🏽‍💻 Engineers

Being able to securely create an AWS account, manage IAM users, and deploy an Apache web server on EC2 is foundational to building reliable cloud infrastructure. These skills ensure engineers can provision resources safely, follow least-privilege and MFA best practices, and quickly deploy scalable services that support real applications. Mastery here reduces misconfigurations, improves security posture, and enables faster delivery of production-ready workloads.

📊 Managers

Understanding how teams securely deploy infrastructure on AWS helps managers reduce operational risk while increasing delivery speed. Proper IAM usage and standardized EC2 deployments prevent costly security incidents, enable repeatable environments, and support predictable timelines. These capabilities allow teams to move faster without sacrificing governance, compliance, or reliability.

🧠 Executives

Secure cloud deployment capabilities directly impact business agility, cost control, and risk reduction. When teams can rapidly and securely launch infrastructure, the organization can scale products faster, respond to market demands, and avoid outages or security breaches that damage trust and revenue. This foundation enables cloud investments to translate into measurable business outcomes rather than technical debt.

Steps to Complete the Project

1: Secure Account for Labs

  1. Signed in to my AWS Management Console and accessed IAM.
  2. Created an IAM admin user and added them to Admins group
    • Programmatic + Console access
    • Attach AdministratorAccess to Admins group
    • Forced new User to create a new password instead of using the autogenerated password from AWS.
  3. Assigned MFA devices to both the root user and IAM admin user.
  4. Logged out of root and used admin account AWS - IAM Security Recommendations

Note: Doing this follows the recommended security practices for AWS accounts.

2: Launch an Amazon EC2 Instance

  1. Accessed the EC2 Dashboard by clicking on EC2 located under services and clicked on Launch Instance: AWS - Launch Instance

  2. Input/selected the following for the instance:

    • Name: Custom-Apache-Web-Server

    • AMI: Amazon Linux 2023 kernel-6.1 AMI

    • Instance Type: t3.micro

    • Key Pair: Proceed without a key pair

    • Network Settings:

      • Ensured Auto-assign Public IP was enabled
      • Created a new security group with the following rules:
        • Allow SSH (22) to be able to connect to instance.
        • Allowed HTTP (80) traffic to display content.
    • User Data: Added the following script to automate the installation of Apache and deploy a custom webpage:

      #!/bin/bash
      # Updates the package list on the instance and installs Apache
      dnf update -y
      dnf install -y httpd
      
      # Starts and enables Apache service
      systemctl enable --now httpd
      
      # Sets the permissions for Apache root directory
      chown -R ec2-user:ec2-user /var/www/html
      
      # Creates a custom index.html page showing a simple message
      cat <<EOF > /var/www/html/index.html
      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>J Lew's My Custom Apache Server</title>
          <style>
              body {
                  font-family: Arial, sans-serif;
                  background-color: #f4f4f4;
                  text-align: center;
                  padding: 50px;
              }
              .container {
                  background: white;
                  padding: 20px;
                  border-radius: 10px;
                  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
                  display: inline-block;
              }
              h1 {
                  color: #333;
              }
              p {
                  color: #666;
              }
          </style>
      </head>
      <body>
          <div class="container">
              <h1>J Lew's Custom Apache Web Server!</h1>
              <p>Hosted on an Amazon Linux 2023 EC2 Instance.</p>
              <p>This page was deployed automatically using AWS User Data.</p>
          </div>
      </body>
      </html>
      EOF
      
      # Restarts Apache to apply changes so they show.
      systemctl restart httpd
  3. Clicked Launch Instance. AWS - Instance Configuration Summary

3: Verified the Web Server was Running

  1. Clicked on Instances to find my instance that was created and waited until the Status Check showed that it passed. AWS - Instance Created Successfully
  2. Next, I decided to connect to my AMI instance to confirm that my user data was added to the /var/www/html directory: AWS - Instance Configuration Summary
  3. Copied my Public IPv4 Address and pasted it into my web browser http://18.222.96.241/ (This link is not active anymore since I terminated the instance). AWS - Instance Configuration Summary
  4. Once I confirmed I could see my webcontent, I Terminated the instance to avoid incurring any additional cost. AWS - Instance Configuration Summary

About

This lab demonstrates setting up a secure AWS account, creating an IAM admin user with MFA, and deploying a custom Apache web server on an Amazon EC2 instance using best practices. The project focuses on foundational AWS security, EC2 provisioning, and Linux web server configuration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published