{"id":22260940,"url":"https://github.com/piyushsachdeva/10weeksofcloudops_task3","last_synced_at":"2025-04-11T17:32:25.729Z","repository":{"id":185768123,"uuid":"672735507","full_name":"piyushsachdeva/10WeeksOfCloudOps_Task3","owner":"piyushsachdeva","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-22T02:57:30.000Z","size":35,"stargazers_count":23,"open_issues_count":1,"forks_count":70,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T13:46:26.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/piyushsachdeva.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":"2023-07-31T03:41:06.000Z","updated_at":"2025-01-12T11:53:54.000Z","dependencies_parsed_at":"2023-11-06T06:32:51.698Z","dependency_job_id":"cd2aca1c-ac03-4be2-873d-055b7497440c","html_url":"https://github.com/piyushsachdeva/10WeeksOfCloudOps_Task3","commit_stats":null,"previous_names":["piyushsachdeva/10weeksofcloudops_task3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyushsachdeva%2F10WeeksOfCloudOps_Task3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyushsachdeva%2F10WeeksOfCloudOps_Task3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyushsachdeva%2F10WeeksOfCloudOps_Task3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyushsachdeva%2F10WeeksOfCloudOps_Task3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piyushsachdeva","download_url":"https://codeload.github.com/piyushsachdeva/10WeeksOfCloudOps_Task3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248449927,"owners_count":21105585,"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":[],"created_at":"2024-12-03T09:10:51.725Z","updated_at":"2025-04-11T17:32:25.706Z","avatar_url":"https://github.com/piyushsachdeva.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Challenge 3 as part of #10WeeksofCloudOps - 2 tier Application using terraform \n\n✨This repository is created to learn and deploy a 2-tier application on aws cloud through Terraform. \n\n## If you are a visual learner, feel free to check out this video: \n[![2-tier Architecture using terraform](https://img.youtube.com/vi/s8q5B6DLH7s/sddefault.jpg)](https://youtu.be/s8q5B6DLH7s)\n\n## 🏠 Architecture\n\n![Architecture diagram](https://github.com/AnkitJodhani/3rdWeekofCloudOps/blob/main/architecture.gif)\n\n[Image Source: Ankit Jodhani](https://github.com/AnkitJodhani/3rdWeekofCloudOps/blob/main/architecture.gif)\n\n## 🖥️ Installation of Terraform\n\n**Note**: Follow the blog for the step-by-step instructions to build this project. [Terraform](https://ankitjodhani.hashnode.dev/implementing-two-tier-architecture-in-aws-with-terraform-step-by-step-guide-10weeksofcloudops)\n\n### Create S3 Backend Bucket\nCreate an S3 bucket to store the .tfstate file in the remote backend\n\n**Warning!** It is highly recommended that you `enable Bucket Versioning` on the S3 bucket to allow for state recovery in the case of accidental deletions and human error.\n\n**Note**: We will need this bucket name in the later step\n\n### Create a Dynamo DB table for state file locking\n- Give the table a name\n- Make sure to add a `Partition key` with the name `LockID` and type as `String`\n\n### Generate a public-private key pair for our instances\nWe need a public key and a private key for our server so please follow the procedure I've included below.\n\n```sh\ncd modules/key/\nssh-keygen\n```\nThe above command asks for the key name and then gives `client_key` it will create a pair of keys one public and one private. you can give any name you want but then you need to edit the Terraform file\n\nEdit the below file according to your configuration\n```sh\nvim root/backend.tf\n```\nAdd the below code in root/backend.tf\n```sh\nterraform {\n  backend \"s3\" {\n    bucket = \"BUCKET_NAME\"\n    key    = \"backend/FILE_NAME_TO_STORE_STATE.tfstate\"\n    region = \"us-east-1\"\n    dynamodb_table = \"dynamoDB_TABLE_NAME\"\n  }\n}\n```\n### 🏠 Let's set up the variable for our Infrastructure\nCreate one file with the name `terraform.tfvars` \n```sh\nvim root/terraform.tfvars\n```\n### 🔐 ACM certificate\nGo to AWS console --\u003e AWS Certificate Manager (ACM) and make sure you have a valid certificate in Issued status, if not, feel free to create one and use the domain name on which you are planning to host your application.\n\n### 👨‍💻 Route 53 Hosted Zone\nGo to AWS Console --\u003e Route53 --\u003e Hosted Zones and ensure you have a public hosted zone available, if not create one.\n\nAdd the below content into the `root/terraform.tfvars` file and add the values of each variable.\n```javascript\nregion = \"\"\nproject_name = \"\"\nvpc_cidr                = \"\"\npub_sub_1a_cidr        = \"\"\npub_sub_2b_cidr        = \"\"\npri_sub_3a_cidr        = \"\"\npri_sub_4b_cidr        = \"\"\npri_sub_5a_cidr        = \"\"\npri_sub_6b_cidr        = \"\"\ndb_username = \"\"\ndb_password = \"\"\ncertificate_domain_name = \"\"\nadditional_domain_name = \"\"\n\n```\n\n## ✈️ Now we are ready to deploy our application on the cloud ⛅\nget into the project directory \n```sh\ncd root\n```\n👉 let install dependency to deploy the application \n\n```sh\nterraform init \n```\n\nType the below command to see the plan of the execution \n```sh\nterraform plan\n```\n\n✨Finally, HIT the below command to deploy the application...\n```sh\nterraform apply \n```\n\nType `yes`, and it will prompt you for approval..\n\n**Thank you so much for reading..😅**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyushsachdeva%2F10weeksofcloudops_task3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyushsachdeva%2F10weeksofcloudops_task3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyushsachdeva%2F10weeksofcloudops_task3/lists"}