{"id":16533002,"url":"https://github.com/jeff-pedro/learn-terraform-docker-aws","last_synced_at":"2026-05-18T03:03:28.540Z","repository":{"id":221735468,"uuid":"755166112","full_name":"jeff-pedro/learn-terraform-docker-aws","owner":"jeff-pedro","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-09T18:28:42.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T12:36:54.280Z","etag":null,"topics":["aws-iam","aws-s3","elasticbeanstalk","terraform","terraform-backend-s3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jeff-pedro.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}},"created_at":"2024-02-09T15:04:47.000Z","updated_at":"2024-02-09T17:22:03.000Z","dependencies_parsed_at":"2024-02-09T19:36:05.002Z","dependency_job_id":null,"html_url":"https://github.com/jeff-pedro/learn-terraform-docker-aws","commit_stats":null,"previous_names":["jeff-pedro/learn-terraform-docker-aws"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jeff-pedro/learn-terraform-docker-aws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-pedro%2Flearn-terraform-docker-aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-pedro%2Flearn-terraform-docker-aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-pedro%2Flearn-terraform-docker-aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-pedro%2Flearn-terraform-docker-aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeff-pedro","download_url":"https://codeload.github.com/jeff-pedro/learn-terraform-docker-aws/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeff-pedro%2Flearn-terraform-docker-aws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aws-iam","aws-s3","elasticbeanstalk","terraform","terraform-backend-s3"],"created_at":"2024-10-11T18:13:54.780Z","updated_at":"2026-05-18T03:03:28.523Z","avatar_url":"https://github.com/jeff-pedro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Terraform and Docker with AWS provider\n\n\u003e This repository builds and deploys a simple application using Terraform to deploy the infrastructure, Docker to build the image, and AWS Elastic Beanstalk to run the container.\n\n### Applied Concepts\n\n- **Elastic Bean Stalk (ECS)** to run containers.\n- **Elastic Container Registry (ECR)**, repository to store docker images.\n- **Terraform Backends**, to save states in the cloud.\n- **AWS Permissions** with role, policies and profile.\n- **AWS S3 Bucket** to store terraform states and others files.\n\n### Useful resources\n\n- [Official Terraform Docs](https://developer.hashicorp.com/terraform/tutorials/aws-get-started)\n- [Official AWS Docs](https://docs.aws.amazon.com/)\n- [ECR Public Repository](https://gallery.ecr.aws/)\n\n## Explored\n\n- How to create [Docker images for a Django project](https://docs.docker.com/samples/django/).\n\n- AWS [Role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role), [Policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) and [Profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) with Terraform to assign permissions to BeanStalk to manage containers.\n\n- Run applications with **Elastic Beanstalk** through Terraform:\n\n  - [application](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_application)\n  - [environment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_environment)\n  - [versions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_application_version)\n\n- Deploy the application version into **Elastic Beanstalk**.\n\n- [Put docker image](https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html) on **Elastic Beanstalk Repository (ECR)**.\n\n- Create [Dockerrun.aws.json](https://docs.aws.amazon.com/pt_br/elasticbeanstalk/latest/dg/single-container-docker-configuration.html) to run a Beanstalk application.\n\n- Create, configure and add files to a **AWS S3 Bucket** through the Terraform.\n\n## Deploy\n\n---\n\n### Infra\n\n1. Go to\n   ```\n   cd ./env/prod\n   ```\n2. Check\n   ```\n   terraform plan\n   ```\n3. Deploy\n   ```\n   terraform apply\n   ```\n\n**Web Interface:**\n\u003e http://\u003celasticbeanstalk_dns\u003e:**80**\n\n### Update application version\n\n1. Build new image\n\n   ```bash\n   cd ./api\n   docker build -t [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/production:v1 .\n   ```\n\n2. Push image to ECR\n\n   ```bash\n    docker push [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/production:v1\n\n   aws ecr get-login-password --region [REGION] | docker login --username AWS --password-stdin [AWS_ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com\n   ```\n\n3. ZIP Dockerfilerun.aws.json\n   ```bash\n   zip -r production.zip Dockerrun.aws.json\n   ```\n4. Deploy with Terraform\n   ```bash\n   terraform init\n   terraform apply\n   ```\n5. Update application version\n   ```bash\n   aws elasticbeanstalk update-environment --environment production-environment --version-label production\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeff-pedro%2Flearn-terraform-docker-aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeff-pedro%2Flearn-terraform-docker-aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeff-pedro%2Flearn-terraform-docker-aws/lists"}