Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Web Hosting

This project consists of a webpage hosting solution on AWS using Infrastructure as Code (Terraform).

Project Overview

This solution implements a cloud architecture for hosting a simple webpage with the following features:

  • High Availability: Multi-AZ deployment
  • Global Low Latency: CloudFront distribution for edge caching
  • Autoscaling: Dynamic adjustment of resources based on demand
  • Security: IAM roles, security groups, and restricted access
  • Infrastructure as Code: Complete implementation with Terraform

Architecture

The architecture consists of three main layers:

Global Layer

  • CloudFront: Content delivery network with global edge location caching
  • S3: Object storage for static website content

Regional Layer

  • VPC: Network isolation with subnets across multiple AZs
  • Internet Gateway: Direct connection between VPC and internet
  • ALB: Application Load Balancer to distribute traffic
  • Auto Scaling Group: Dynamic EC2 instance management
  • EC2: Create instances running web servers

Security Layer

  • Security Groups: Instance traffic control
  • IAM: Identity and access management for permissions

Prerequisites

  • AWS Account (Free Tier eligible)
  • Terraform
  • AWS CLI
  • Git (if cloning from repo)

Project Structure

web-host/
|––main.tf           # Main Terraform configuration file
|––variables.tf      # Variable definitions
|––outputs.tf        # Output definitions
|––providers.tf      # Provider configuration
|––user-data.sh      # EC2 instance bootstrap script
|––index.html        # Sample webpage content
|––README.md         # Project documentation

Deployment Instructions

  1. Clone the repository (if using Git)

    git clone https://github.com/mardlpz/web-host.git
    cd web-host
    
  2. Configure AWS credentials

    The provider configuration for this program uses variables for AWS credentials, which allows for any of the following configuration options:

    • Terraform prompt: when running terraform plan/apply/destroy, you will receive a prompt to enter AWS access key and secret key
    • AWS CLI: run aws configure to be prompted to set up credentials for Terraform to use
    • terraform.tfvars file: create the file with content such as the following:
      aws_access_key = "YOUR_ACCESS_KEY"
      aws_secret_key = "YOUR_SECRET_KEY"
      region         = "us-east-1"
      
  3. Initialize Terraform

    terraform init
    
  4. Plan deployment

    terraform plan
    
  5. Apply the configuration

    terraform apply
    
  6. Access webpage

    Once apply is complete, the ALB DNS and CloudFront domain name will be displayed as outputs in the terminal. Access to the S3 hosted website can be granted through either of these URLS.

    • Example:
    alb_dns = "web-alb-1443665287.us-east-1.elb.amazonaws.com"
    cloudfront_url = "dniwj1yvqn1nf.cloudfront.net"
    s3_bucket = "web-bucket-dlbsepcp01-e"
    

Post-deployment

To avoid unnecessary charges, destroy all resources when done testing or making use:

terraform destroy

Customization

  • Webpage Content: replace web content in index.html with your own.
  • Region: modify region variable in variables.tf or override it in terraform.tfvars according to needs.
  • Instance Type: change instance_type variable for different compute resources if desired.
  • Scaling Parameters: adjust Auto Scaling Group settings in main.tf for different scaling configuration.

Future Expansion

Possible future features to implement in this solution include:

  • CloudWatch implementation to monitor, log, and trigger scaling events based on performance metrics
  • Expansion to multiple regions for true global experience
  • Route 53 with geolocation routing policy and health checks
  • AWS CI/CD pipeline for auto-deployment
  • Private subnets for further privacy

Author

Mariana Del Pozo Patrón - 42308963
IU International University of Applied Sciences
Cloud Programming (DLBSEPCP01_E)

About

Simple AWS cloud hosting solution for static webpages using Terraform.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages