{"id":28904734,"url":"https://github.com/coding4deep/terraform-ansible-project","last_synced_at":"2025-12-30T20:06:45.420Z","repository":{"id":300312205,"uuid":"1005857483","full_name":"Coding4Deep/Terraform-Ansible-Project","owner":"Coding4Deep","description":"Springboot Fullstack Application Deployment on AWS, Infrastructure Automation with Terraform + Ansible","archived":false,"fork":false,"pushed_at":"2025-06-21T00:51:04.000Z","size":0,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-21T01:37:25.545Z","etag":null,"topics":["ansible","aws","bash-scripting","devops","devopsproject","git","linux","memcached","mongodb","rabbitmq","springboot","terraform"],"latest_commit_sha":null,"homepage":"","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/Coding4Deep.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,"zenodo":null}},"created_at":"2025-06-21T00:38:33.000Z","updated_at":"2025-06-21T00:54:20.000Z","dependencies_parsed_at":"2025-06-21T01:37:29.213Z","dependency_job_id":"1f9b0a02-21bb-48c1-8434-76770249b025","html_url":"https://github.com/Coding4Deep/Terraform-Ansible-Project","commit_stats":null,"previous_names":["coding4deep/terraform-ansible-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Coding4Deep/Terraform-Ansible-Project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coding4Deep%2FTerraform-Ansible-Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coding4Deep%2FTerraform-Ansible-Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coding4Deep%2FTerraform-Ansible-Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coding4Deep%2FTerraform-Ansible-Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coding4Deep","download_url":"https://codeload.github.com/Coding4Deep/Terraform-Ansible-Project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coding4Deep%2FTerraform-Ansible-Project/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261126449,"owners_count":23113312,"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":["ansible","aws","bash-scripting","devops","devopsproject","git","linux","memcached","mongodb","rabbitmq","springboot","terraform"],"created_at":"2025-06-21T13:02:03.289Z","updated_at":"2025-12-30T20:06:45.391Z","avatar_url":"https://github.com/Coding4Deep.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \n# Springboot Fullstack Application Deployment on AWS \n**Infrastructure Automation with Terraform + Ansible**\n\n\u003c/div\u003e\n\n---\n\n##  Project Overview\n\nThis project demonstrates **fully automated infrastructure provisioning and configuration** for a full-stack Spring Boot web application using:\n\n* **Terraform**: to provision AWS infrastructure (VPC, Subnets, EC2 instances, Security Groups, SSH Key, etc.)\n* **Ansible**: to install and configure required software on provisioned instances (Tomcat, Memcached, RabbitMQ, MongoDB)\n* **Shell Scripting**: to automated the whole process just by single command .\n\n---\n\n##  Tech Stack Used\n\n| Layer                        | Technology    |\n| ---------------------------- | ------------- |\n| Infrastructure Provisioning  | Terraform     |\n| Infrastructure Configuration | Ansible       |\n| Cloud Provider               | AWS           |\n| Application Server           | Apache Tomcat |\n| Database                     | MongoDB       |\n| Caching                      | Memcached     |\n| Messaging Queue              | RabbitMQ      |\n\n\n---\n\n##  Prerequisites\n\nMake sure you have following tools installed in your machine:\n\n1. **Terraform**\n\n   * [Terraform Installation Guide](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)\n2. **Ansible**\n\n   * [Ansible Installation Guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)\n3. **AWS CLI**\n\n   * [AWS CLI Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n4. **Python Boto3 Module (for Ansible AWS Plugin)**\n\n   ```bash\n   pip install boto3 botocore\n   ```\n5. **AWS Account** with Access Key and Secret Key configured:\n\n   ```bash\n   aws configure\n   ```\n\n---\n\n##  AWS Resources Provisioned\n\n* VPC\n* Public Subnet\n* Private Subnet\n* Security Groups\n* EC2 Instances:\n\n  * Public EC2 (Tomcat Server)\n  * Private EC2 (Memcached)\n  * Private EC2 (RabbitMQ)\n  * Private EC2 (MongoDB)\n* SSH Key Pair\n\n---\n\n##  Complete Project Structure\n\n```\nproject-root/\n│\n├── terraform/\n│   ├── # All Terraform code here\n|\n├── ansible/\n│   ├── # All Ansible code here\n|\n└── project.pem (auto-generated by Terraform)\n```\n\n---\n\n##  End-to-End Usage Guide\n\n### Step 1: Clone the Project Repository\n\n```bash\ngit clone https://github.com/Coding4Deep/Terraform-Ansible-Project.git\ncd Terraform-Ansible-Project\n```\n\n\n\n\n### Step 2: Update Terraform Configuration\n```bash\n* Update `provider.tf` with your AWS region.\n* Replace `ami-xxxxxxxx` with valid Ubuntu AMI ID from your region.\n\n```\n\n### Step 3: Apply Terraform to Create Infrastructure\n\n```bash\nterraform init\nterraform plan\nterraform apply\n```\n\n✅ Terraform will create the entire AWS infrastructure.\n✅ After provisioning is done, Terraform automatically triggers Ansible via `null_resource` to configure all servers.\n\n\u003e **Note:** You may be prompted for approval during `terraform apply`.\n\n### Step 5: Ansible Dynamic Inventory Setup\n\nEnsure you have valid AWS credentials locally (`~/.aws/credentials`).\n\nThe file `ansible/inventory/aws_ec2.yaml` uses AWS EC2 dynamic inventory plugin to auto-discover EC2 instances using tags.\n\nYou can test Ansible inventory:\n\n```bash\ncd ../ansible/\nansible-inventory --graph\n```\n\nYou should see:\n\n```\n@all:\n  |--@aws_ec2:\n    |--@role_tomcat:\n    |  |--springboot-public\n    |--@role_memcached:\n    |  |--springboot-memcached\n    |--@role_rabbitmq:\n    |  |--springboot-rabbitmq\n    |--@role_mongo:\n    |  |--springboot-mongo\n```\n\nNo IP addresses needed. Fully dynamic!\n\n### Step 5: Run Ansible Playbooks Manually (optional)\n\nIf you want to re-run Ansible manually anytime:\n\n```bash\nansible-playbook playbooks/site.yml\n```\n\nThis will execute all roles (tomcat, memcached, rabbitmq, mongo).\n\n---\n\n##  What Happens During Provisioning?\n\n| Component          | Action                                                           |\n| ------------------ | ---------------------------------------------------------------- |\n| Terraform          | Provisions VPC, Subnets, EC2 Instances, Security Groups, SSH Key |\n| Ansible            | Dynamically discovers EC2 instances via AWS tags                 |\n| Tomcat Playbook    | Installs Java, Downloads and Configures Apache Tomcat            |\n| Memcached Playbook | Installs and Starts Memcached Service                            |\n| RabbitMQ Playbook  | Installs and Starts RabbitMQ Server                              |\n| MongoDB Playbook   | Adds official MongoDB repo, Installs MongoDB, Starts MongoDB     |\n\n---\n\n##  Future Enhancements (Optional Improvements)\n\n* Use Bastion Host for secure SSH into private instances\n* Jenkins CI/CD integration for full automation pipeline\n* Monitoring with CloudWatch\n* HTTPS with ACM and Load Balancer\n\n---\n\n##  Credits\n\nCreated by \\[Deepak Sagar]. Open-source project to help anyone learn cloud provisioning and automation.\n\n---\n\n## 📅 License\n\nThis project is open-source and available under MIT License.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoding4deep%2Fterraform-ansible-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoding4deep%2Fterraform-ansible-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoding4deep%2Fterraform-ansible-project/lists"}