{"id":19167787,"url":"https://github.com/wmramadan/localstack-dind","last_synced_at":"2026-05-07T10:38:26.215Z","repository":{"id":255915745,"uuid":"850815842","full_name":"WMRamadan/localstack-dind","owner":"WMRamadan","description":"An example of using DIND with LocalStack","archived":false,"fork":false,"pushed_at":"2024-09-08T23:17:16.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T03:11:49.415Z","etag":null,"topics":["docker","docker-compose","dockerindocker","localstack","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/WMRamadan.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-09-01T21:18:40.000Z","updated_at":"2024-09-10T19:02:50.000Z","dependencies_parsed_at":"2024-11-09T09:39:29.360Z","dependency_job_id":null,"html_url":"https://github.com/WMRamadan/localstack-dind","commit_stats":null,"previous_names":["wmramadan/localstack-dind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Flocalstack-dind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Flocalstack-dind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Flocalstack-dind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Flocalstack-dind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WMRamadan","download_url":"https://codeload.github.com/WMRamadan/localstack-dind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240247733,"owners_count":19771366,"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":["docker","docker-compose","dockerindocker","localstack","terraform"],"created_at":"2024-11-09T09:39:24.566Z","updated_at":"2026-05-07T10:38:26.203Z","avatar_url":"https://github.com/WMRamadan.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LocalStack with DIND\n\nExplainer video available on [YouTube](https://www.youtube.com/watch?v=zAeXD5_AG34)\n\nThe repository covers the following:\n\n1) API Gateway that serves a Lambda function.\n\n2) An HTTP endpoint that serves a file from an S3 bucket. \n\n3) Two EC2 instances, one with public subnet and one with private subnet based on the same VPC.\n\n4) Localstack dependent on [Docker-in-Docker](https://hub.docker.com/_/docker) container socket.\n\nMake sure you have awscli configured and awslocal setup and set your LocalStack Auth Token in the `.env` file.\n\n## Prepare the environment\n\nBuild Docker images locally and run detached\n\n    docker compose up --build -d\n\nCreate the S3 bucket that will hold the TF state\n\n    ./localstack/aws/buckets.sh\n\nThen, enter the worker container\n\n    docker exec -it tfrunner-cnt /bin/bash\n\nGo to the bind mount folder containing project files.\n\n    cd /mnt/terraform\n\nInitialize the backend state file on S3\n\n    terraform init -upgrade \\\n        -backend-config=endpoint=\"http://localstack:4566\" \\\n        -backend-config=access_key=\"myrootaccesskeyid\" \\\n        -backend-config=secret_key=\"myrootsecretaccesskey\" \\\n        -backend-config=bucket=\"platform-state-local\" \\\n        -backend-config=key=\"tfstate.json\" \\\n        -backend-config=region=\"eu-west-3\" \\\n        -backend-config=skip_credentials_validation=true \\\n        -backend-config=skip_metadata_api_check=true \\\n        -backend-config=skip_region_validation=true \\\n        -backend-config=force_path_style=true\n\nCreate Terraform plan\n\n    terraform plan -out .terraform/tf-plan.out\n    \nApply the plan\n\n    terraform apply \".terraform/tf-plan.out\"\n\nYou should see a URL to test the Api Gateway endpoint similar to the following\n\n    curl http://localstack:4566/restapis/\u003cid\u003e/test/_user_request_/ -vv\n\nAnd the API will reply `Cheers from AWS Lambda!!`.\n\nYou will also see another URL for the S3 file endpoint\n\n    curl -X GET http://localstack:4566/file-bucket/data.txt -vv\n\nAnd the output will be `Hello, from file data.`.\n\nIf you would like to destroy the deployed stack you can do so by using the `--destory` flag with terraform plan then apply as follows\n\n    terraform plan -out .terraform/tf-plan.out --destroy\n    terraform apply \".terraform/tf-plan.out\"\n\nExit the container by entering `exit` and destory by\n\n    docker compose down -v\n\n\n## Prepare the environment in DIND\n\nBuild Docker images locally and run detached\n\n    docker compose -f docker-compose-dind.yml up -d\n\nThen, enter the dind container\n\n    docker exec -it dind /bin/sh\n\nInstall the AWS Cli\n\n    apk add aws-cli\n\nGo to the mount folder containing project files.\n\n    cd /mnt\n\nBuild Docker images and run detached\n\n    docker compose up --build -d\n\nCreate the S3 bucket that will hold the TF state\n\n    aws --endpoint-url=http://localhost:4566 s3 mb s3://platform-state-local\n\nThen, enter the worker container\n\n    docker exec -it tfrunner-cnt bash -l\n\nGo to the bind mount folder containing project files.\n\n    cd /mnt/terraform\n\nInitialize the backend state file on S3\n\n    terraform init -upgrade \\\n        -backend-config=endpoint=\"http://localstack:4566\" \\\n        -backend-config=access_key=\"myrootaccesskeyid\" \\\n        -backend-config=secret_key=\"myrootsecretaccesskey\" \\\n        -backend-config=bucket=\"platform-state-local\" \\\n        -backend-config=key=\"tfstate.json\" \\\n        -backend-config=region=\"eu-west-3\" \\\n        -backend-config=skip_credentials_validation=true \\\n        -backend-config=skip_metadata_api_check=true \\\n        -backend-config=skip_region_validation=true \\\n        -backend-config=force_path_style=true\n\nCreate Terraform plan\n\n    terraform plan -out .terraform/tf-plan.out\n    \nApply the plan\n\n    terraform apply \".terraform/tf-plan.out\"\n\nYou should see a URL to test the Api Gateway endpoint similar to the following\n\n    curl http://localstack:4566/restapis/\u003cid\u003e/test/_user_request_/ -vv\n\nAnd the API will reply `Cheers from AWS Lambda!!`.\n\nYou will also see another URL for the S3 file endpoint\n\n    curl -X GET http://localstack:4566/file-bucket/data.txt -vv\n\nAnd the output will be `Hello, from file data.`.\n\nExit the container by entering `exit` and destory by\n\n    docker compose down -v\n\nNow exit the DIND container by entering `exit` and destory by\n\n    docker compose -f docker-compose-dind.yml down -v\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmramadan%2Flocalstack-dind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwmramadan%2Flocalstack-dind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmramadan%2Flocalstack-dind/lists"}