Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AWS Terraform Jenkins Infrastructure

Terraform AWS Jenkins Ubuntu License

Provision a complete AWS infrastructure using Terraform and automatically deploy a Jenkins Server on an EC2 instance using a Shell Script.


πŸ“– Table of Contents

  • Overview
  • Architecture
  • Project Structure
  • Features
  • Technologies Used
  • AWS Resources Created
  • Prerequisites
  • Deployment
  • Terraform Commands
  • File Description
  • Project Screenshots
  • Outputs
  • Security Best Practices
  • Future Enhancements
  • Contributing
  • License
  • Author

πŸ“Œ Overview

This project demonstrates Infrastructure as Code (IaC) using Terraform by provisioning AWS infrastructure and deploying Jenkins automatically.

The infrastructure includes:

  • Custom VPC
  • Public Subnet
  • Internet Gateway
  • Route Table
  • Security Group
  • EC2 Instance
  • Jenkins Installation using User Data Script

This project is suitable for beginners learning Terraform and AWS as well as recruiters evaluating DevOps skills.


πŸ—οΈ Architecture

                    AWS Cloud
                         β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚      VPC        β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                  Public Subnet
                         β”‚
                 Internet Gateway
                         β”‚
                  Route Table
                         β”‚
                  Security Group
                         β”‚
                    EC2 Instance
                         β”‚
                 User Data Script
                         β”‚
                  Install Jenkins
                         β”‚
                 Jenkins Dashboard

πŸ“‚ Project Structure

Terraform-Jenkins-AWS/
β”‚
β”œβ”€β”€ backend.tf
β”œβ”€β”€ provider.tf
β”œβ”€β”€ variable.tf
β”œβ”€β”€ terraform.tfvars
β”œβ”€β”€ vpc.tf
β”œβ”€β”€ jenkins-server.tf
β”œβ”€β”€ jenkins-server-script.sh
β”œβ”€β”€ outputs.tf
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md

✨ Features

  • Infrastructure as Code (Terraform)
  • AWS Cloud Deployment
  • Custom VPC
  • Public Networking
  • Security Groups
  • EC2 Provisioning
  • Automated Jenkins Installation
  • Reusable Terraform Variables
  • Terraform Outputs
  • Easy Customization
  • Beginner Friendly
  • Production Ready Structure

πŸ›  Technologies Used

Technology Purpose

| Terraform | Infrastructure as Code | | AWS | Cloud Platform | | EC2 | Virtual Machine | | VPC | Networking | | Ubuntu | Operating System | | Shell Script | Jenkins Installation | | Jenkins | CI/CD Tool |


☁️ AWS Resources Created

This Terraform project provisions:

  • VPC
  • Public Subnet
  • Internet Gateway
  • Route Table
  • Route Table Association
  • Security Group
  • EC2 Instance
  • Jenkins Installation
  • Elastic IP (Optional)

πŸ“‹ Prerequisites

Before deploying the infrastructure, ensure you have:

  • AWS Account
  • Terraform v1.x+
  • AWS CLI Installed
  • AWS CLI Configured
  • IAM User with Administrator Access
  • EC2 Key Pair

Verify installation:

terraform -version
aws --version

πŸš€ Deployment

Clone Repository

git clone https://github.com/shubham-rasal-123/terraform-code-to-create-jenkins-server.git

cd terraform-code-to-create-jenkins-server

Initialize Terraform

terraform init

Format Code

terraform fmt

Validate Configuration

terraform validate

Preview Infrastructure

terraform plan

Deploy Infrastructure

terraform apply --auto-approve

View Outputs

terraform output

Destroy Infrastructure

terraform destroy

πŸ”§ Useful Terraform Commands

terraform init
terraform fmt
terraform validate
terraform plan
terraform apply
terraform show
terraform output
terraform destroy

πŸ“„ File Description

backend.tf

Configures Terraform backend.


provider.tf

Configures AWS Provider and Region.


variable.tf

Defines all Terraform variables.


terraform.tfvars

Stores variable values.


vpc.tf

Creates

  • VPC
  • Public Subnet
  • Internet Gateway
  • Route Table
  • Route Table Association

jenkins-server.tf

Creates

  • Security Group
  • EC2 Instance
  • User Data Configuration

jenkins-server-script.sh

Automatically installs

  • Java
  • Jenkins
  • Starts Jenkins Service
  • Enables Jenkins at Boot

outputs.tf

Displays

  • Public IP
  • Instance ID
  • VPC ID
  • Subnet ID

πŸ“Š Infrastructure Overview

Resource Description

| VPC | Custom Virtual Private Cloud |

| Public Subnet | Public Network |

| Internet Gateway | Internet Connectivity |

| Route Table | Routing Configuration |

| Security Group | Firewall Rules |

| EC2 Instance | Ubuntu Server |

| Jenkins | CI/CD Automation |


πŸ”’ Security Best Practices

  • Never commit AWS credentials.
  • Never commit Terraform State files.
  • Restrict SSH access.
  • Use IAM Roles instead of Access Keys.
  • Store state remotely using S3.
  • Enable DynamoDB State Locking.
  • Protect sensitive variables.

πŸ“ˆ Future Enhancements

  • Terraform Modules
  • Remote Backend (S3)
  • DynamoDB Locking
  • Auto Scaling Group
  • Application Load Balancer
  • Route53
  • SSL using ACM
  • GitHub Actions
  • Docker Deployment
  • Kubernetes (EKS)
  • CloudWatch Monitoring

πŸ“œ .gitignore

.terraform/
*.tfstate
*.tfstate.*
terraform.tfvars
.terraform.lock.hcl
crash.log

.vscode/
.idea/

.DS_Store
Thumbs.db

🀝 Contributing

Contributions are welcome!

  1. Fork this repository.
  2. Create a feature branch.
  3. Commit your changes.
  4. Push your branch.
  5. Open a Pull Request.

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

-- Shubham Rasal -- DevOps Engineer

Skills

  • AWS
  • Terraform
  • Jenkins
  • Docker
  • Linux
  • Shell Scripting
  • Git & GitHub

⭐ Support

If you found this project helpful,

Please ⭐ Star this repository.

It motivates me to build more Cloud and DevOps projects.


🎯 Learning Outcomes

This project demonstrates practical experience with:

  • Infrastructure as Code (IaC)
  • AWS Networking
  • EC2 Provisioning
  • Jenkins Automation
  • Shell Scripting
  • Terraform Variables
  • Terraform Outputs
  • Cloud Infrastructure Deployment
  • DevOps Best Practices

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages