Skip to content

**Part 1** in a series demonstrating infrastructure as code (IaC) using Terraform to provision AWS resources.

Notifications You must be signed in to change notification settings

senopaul/AWS-EC2-Web-Server-Iac-Part1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

AWS EC2 Web Server Infrastructure - Part 1

Terraform AWS License

🚀 Project Overview

This project is Part 1 in a series demonstrating infrastructure as code (IaC) using Terraform to provision AWS resources. This first implementation creates a basic EC2 instance with HTTP access, representing the starting point of a DevOps learning journey.

Key Components

  • EC2 Instance: t2.micro instance running Amazon Linux 2023 AMI
  • Security Group: Configured to allow HTTP ingress (port 80) and all egress traffic
  • Infrastructure as Code: Basic infrastructure defined using Terraform

📊 Architecture

┌────────────────┐      ┌────────────────────┐
│                │      │                    │
│    Internet    │◄────►│  EC2 Web Server    │
│                │      │  (t2.micro)        │
└────────────────┘      └────────────────────┘
                                 │
                                 ▼
                        ┌────────────────────┐
                        │   Security Group   │
                        │   (Port 80 open)   │
                        └────────────────────┘

🔧 Prerequisites

  • Terraform installed
  • AWS CLI installed and configured with appropriate credentials
  • AWS account with necessary permissions
  • Git for version control

📁 Project Structure

Server_1/
├── main.tf          # Main Terraform configuration
├── README.md        # Project documentation
└── .gitignore       # Git ignore file

🔨 Installation & Usage

Setup

  1. Clone the repository:
git clone https://github.com/senopaul/Server_1.git
cd Server_1
  1. Initialize Terraform:
terraform init
  1. Plan the infrastructure:
terraform plan
  1. Apply the configuration:
terraform apply
  1. When finished, destroy the infrastructure to avoid unnecessary charges:
terraform destroy

Key Operations

  • Verify Security Groups: terraform state show aws_security_group.web_access
  • Get EC2 Instance Public IP: terraform state show aws_instance.Server_1 | grep public_ip
  • Access the web server: After deployment, you can access the web server via HTTP at the EC2 instance's public IP address

📋 Current Features

  • Basic EC2 Instance: Deploys a t2.micro EC2 instance with Amazon Linux 2023
  • HTTP Access: Security group configured to allow HTTP traffic on port 80
  • Outbound Traffic: All outbound traffic allowed from the EC2 instance
  • AWS Region: Deployed in the us-east-1 region
  • Infrastructure as Code: Complete definition of infrastructure using Terraform

🔒 Security Considerations

  • Security Groups: Currently configured to allow only HTTP traffic (port 80)
  • Default VPC: Uses the default VPC and its security settings
  • AWS Credentials: Uses AWS CLI credentials, no hardcoded secrets in the code

🚧 Future Improvements

This is Part 1 of a series. Future parts will implement:

  • SSH access configuration
  • HTTPS support with proper certificates
  • Custom VPC with public and private subnets
  • Variable definitions for better customization
  • Output values for easy reference
  • State management with S3 and DynamoDB
  • Auto-scaling for high availability
  • Monitoring and alerting
  • More comprehensive security controls

📝 Learning Journey

This project marks the beginning of my DevOps journey, starting with the basics and building toward more complex implementations.

📞 Contact

Feel free to reach out for any questions or collaboration opportunities:


⭐️ This project is part 1 of my AWS infrastructure series. Follow for future updates! ⭐️

About

**Part 1** in a series demonstrating infrastructure as code (IaC) using Terraform to provision AWS resources.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages