{"id":21017191,"url":"https://github.com/remiljw/learn-terraform-aws-instance","last_synced_at":"2026-05-07T02:39:15.791Z","repository":{"id":45989287,"uuid":"410109543","full_name":"remiljw/learn-terraform-aws-instance","owner":"remiljw","description":"Infrastructure as Code to create an S3 bucket and EC2 instance with python web server","archived":false,"fork":false,"pushed_at":"2024-01-29T16:53:58.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T10:55:53.497Z","etag":null,"topics":["amazon-web-services","aws","iac","infrastructure-as-code","python","terraform","webserver"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remiljw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-09-24T21:45:18.000Z","updated_at":"2022-04-27T15:22:42.000Z","dependencies_parsed_at":"2025-01-20T12:23:29.003Z","dependency_job_id":"b4287dab-7136-46db-9f20-f51f89c481aa","html_url":"https://github.com/remiljw/learn-terraform-aws-instance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remiljw/learn-terraform-aws-instance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remiljw%2Flearn-terraform-aws-instance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remiljw%2Flearn-terraform-aws-instance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remiljw%2Flearn-terraform-aws-instance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remiljw%2Flearn-terraform-aws-instance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remiljw","download_url":"https://codeload.github.com/remiljw/learn-terraform-aws-instance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remiljw%2Flearn-terraform-aws-instance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32720770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["amazon-web-services","aws","iac","infrastructure-as-code","python","terraform","webserver"],"created_at":"2024-11-19T10:18:26.945Z","updated_at":"2026-05-07T02:39:15.734Z","avatar_url":"https://github.com/remiljw.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![learn-terraform-aws-instance](https://github.com/remiljw/learn-terraform-aws-instance/workflows/Build%20and%20Test/badge.svg)](https://github.com/remiljw/learn-terraform-aws-instance/actions/workflows/test.yml)  [![learn-terraform-aws-instance](https://github.com/remiljw/learn-terraform-aws-instance/workflows/Deploy%20to%20Production/badge.svg)](https://github.com/remiljw/learn-terraform-aws-instance/actions/workflows/deploy.yml) \n\n# Prerequisites\nTo be able to run or test this infrastructure, you will need to get a few things up and running: \n- [Golang](https://golang.org/doc/install) installed\n- A [Terraform Cloud Account](https://app.terraform.io/)\n- The [Terraform CLI](https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started) 0.14.8+ installed.\n- The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed.\n- An [AWS](https://aws.amazon.com/free/) account.\n- Your AWS credentials. You can create a new [Access Key on this page](https://console.aws.amazon.com/iam/home?#/security_credentials).\n\n# Steps\n- Launch your terminal\n- Run `aws configure` to configure the AWS CLI from your terminal. Follow the prompts to input your AWS Access Key ID and Secret Access Key. Set the region `us-east-1`, then `json` as format.\n\n- Open `server.py` file and on line 3, fill in the `aws_access_key_id` `aws_secret_access_key` fields with your acquired AWS credentials from the previous step.\n```python\nec2 = boto3.client('ec2', aws_access_key_id='\u003cyour_aws_access_key\u003e', aws_secret_access_key='\u003caws_secret_access_key\u003e', region_name=region)\n```\n- You will need to create your organization and workspace on Terraform Cloud. Follow these [instructions](https://learn.hashicorp.com/tutorials/terraform/github-actions) to help you set that up.\n\n- Open `main.tf` and on line 5 and 9 respectively, replace the `organization` and workspaces `name` field to the organization and workspace you created in the previous step.\n```hcl\nterraform {\n  backend \"remote\" {\n    #         # The name of your Terraform Cloud organization.\n    hostname     = \"app.terraform.io\"\n    organization = \"\u003cyour-organization\u003e\"\n    #\n    #         # The name of the Terraform Cloud workspace to store Terraform state files in.\n    workspaces {\n      name = \"\u003cyour-workspace\u003e\"\n    }\n  }\n```\n- Create your [AWS Key Pair in the AWS Console](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#having-ec2-create-your-key-pair), download it, and move it to the root of this project.\n\n- Open `main.tf` and on line 131 change the value of `key_name` to the name of your downloaded key\n```json\nkey_name      = \"\u003cyour_key_name\u003e\"\n```\n- On line 146, edit the `private_key` to the path of tour key which you added to the root of this project. \n```json\nprivate_key = file(\"${path.module}/\u003cyour_key_name\u003e.pem\")\n```\n\n- Launch your terminal and cd to the root of this project, run the following commands to deploy the infrastructure:\n- - `terraform init`\n- - - initiates terraform\n- - `terraform fmt` \n- - - formats the files to match the canonical standard\n- - `terraform validate`\n- - - ensures the files are syntactically valid and internally consistent\n- - `terraform apply -auto-approve`\n- - - creates the infrastructure\n\n- Wait for the infrastructure to deploy. On successful deploy you should have an output as this on your terminal:\n```shell\nApply complete! Resources: 10 added, 0 changed, 0 destroyed.\n\nOutputs:\n\ninstance_id = \"i-0941f1d034a2f2f6d\"\ninstance_url = \"Visit http://52.204.187.105:8080 in your browser.\"\npublic_ip = \"52.204.187.105\"\nresource_tags = tomap({\n  \"Name\" = \"Flugel\"\n  \"Owner\" = \"InfraTeam\"\n})\n```\n- Run `terraform show` to see the details of the infrastructure. \n- Once you are done, you will need to destroy what you just built, so run:\n`terraform destroy -auto-approve` \n\n# Testing\nTo run the tests:\n- Launch your terminal and cd to the root of this project\n- run `cd test` to navigate to the test folder\n- run `go build -v`\n- run `go test -v`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremiljw%2Flearn-terraform-aws-instance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremiljw%2Flearn-terraform-aws-instance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremiljw%2Flearn-terraform-aws-instance/lists"}