{"id":22808008,"url":"https://github.com/yogitabadhe/terraform-webserver-setup","last_synced_at":"2026-05-11T02:26:02.353Z","repository":{"id":267004074,"uuid":"900002062","full_name":"YogitaBadhe/Terraform-WebServer-Setup","owner":"YogitaBadhe","description":"This project provides a detailed guide for launching, connecting to, and configuring a webserver on AWS using Terraform.","archived":false,"fork":false,"pushed_at":"2025-02-04T10:11:15.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T20:52:33.455Z","etag":null,"topics":["aws","ec2-instance","github","ias","infrastructureascode","terraform"],"latest_commit_sha":null,"homepage":"https://www.linkedin.com/in/yogita-badhe-466566179/","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YogitaBadhe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-07T15:47:09.000Z","updated_at":"2025-02-04T10:11:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4150ca4-b006-4d7d-9ed2-0f03e971232b","html_url":"https://github.com/YogitaBadhe/Terraform-WebServer-Setup","commit_stats":null,"previous_names":["yogitabadhe/terraform-webserver-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FTerraform-WebServer-Setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FTerraform-WebServer-Setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FTerraform-WebServer-Setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YogitaBadhe%2FTerraform-WebServer-Setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YogitaBadhe","download_url":"https://codeload.github.com/YogitaBadhe/Terraform-WebServer-Setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246379379,"owners_count":20767696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","ec2-instance","github","ias","infrastructureascode","terraform"],"created_at":"2024-12-12T11:07:31.636Z","updated_at":"2026-05-11T02:26:02.318Z","avatar_url":"https://github.com/YogitaBadhe.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Launch and Configure a Webserver using Terraform\n\nThis guide provides a step-by-step approach to launching, connecting to, and configuring a webserver on AWS using Terraform. You'll learn how to configure Terraform, manage AWS resources, and ensure a successful deployment.\n\n---\n\n## ✅ Prerequisites\nBefore getting started, ensure you have the following installed and configured:\n\n- 🛠 **Terraform** - Installed and configured.\n- ☁️ **AWS CLI** - Installed and configured with your access and secret keys using:\n  ```bash\n  aws configure\n  ```\n- 🔧 **Git** - Installed to manage your Terraform code repository.\n\n---\n\n## 📌 Step-by-Step Guide\n\n### 1️⃣ Launch EC2 Instance 🏗️\nBegin by launching an EC2 instance via the AWS Management Console or using a predefined Terraform configuration.\n\n### 2️⃣ Connect to EC2 Instance 🔗\nConnect to your EC2 instance securely via SSH using the appropriate key pair.\n\n### 3️⃣ Install Terraform and Dependencies 🌍\nIf Terraform is not already installed, follow the installation steps. Also, ensure that AWS CLI is properly set up:\n```bash\n# Install Terraform (if not installed)\n# Configure AWS CLI\naws configure\n```\n\n### 4️⃣ Install Git 🛠️\nInstall Git on your EC2 instance to manage your Terraform configuration files:\n```bash\nsudo yum install git -y\ngit --version\ngit config --global user.name \"your_username\"\ngit config --global user.email \"your_email@example.com\"\n```\n\n### 5️⃣ Clone the Repository 📂\nClone the repository containing the Terraform configurations:\n```bash\ngit clone https://github.com/YogitaBadhe/aws-terraform-webserver ☁️\ncd aws-terraform-webserver ☁️\n```\nAlternatively, create the project files manually using PowerShell:\n```powershell\nmkdir terraformproject\ncd .\\terraformproject\\\nNew-Item main.tf\nNew-Item variables.tf\ncode .\nmkdir aws\ncd aws\nmkdir aws_keys\ncd .\\aws_keys\\\n```\n\n### 6️⃣ Create a Key Pair 🔑\nCreate an AWS key pair named `mywebserver.pem` through the AWS Management Console. Save it in the `aws/aws_keys/` directory and set proper permissions:\n```bash\nchmod 400 aws/aws_keys/mywebserver.pem\n```\n\n### 7️⃣ Update Terraform Configuration 📜\nModify the `main.tf` file to include:\n- AWS region settings.\n- VPC ID, Subnet ID, and AMI ID.\n- Key pair name for SSH access.\n\nAlso, update `variables.tf` to include the key pair name.\n\n### 8️⃣ Initialize and Apply Terraform Configuration ⚙️\nRun the following Terraform commands to deploy your resources:\n```bash\nterraform init\nterraform validate\nterraform fmt\nterraform plan\nterraform apply\n```\n\n### 9️⃣ Verify Deployment 🔍\nOnce Terraform completes the deployment, retrieve the public IP address of the instance and verify the webserver by accessing it via a web browser.\n\n### 🔟 Clean Up 🗑️\nTo remove all deployed resources, run:\n```bash\nterraform destroy\n```\n\n### 1️⃣1️⃣ Commit and Push Code 💾\nSave your changes and push them to a GitHub repository:\n```bash\ngit add .\ngit commit -m \"Initial commit\"\ngit push origin main\n```\nFor private repositories, use your GitHub token:\n```bash\ngit push https://token@github.com/username/terraform-webserver.git\n```\n\n---\n\n🎉 **Congratulations!** You've successfully deployed and configured a webserver on AWS using Terraform! 🚀\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogitabadhe%2Fterraform-webserver-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogitabadhe%2Fterraform-webserver-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogitabadhe%2Fterraform-webserver-setup/lists"}