{"id":14957962,"url":"https://github.com/msfidelis/ecs-microservices-orchestration","last_synced_at":"2025-10-24T13:30:43.930Z","repository":{"id":92817550,"uuid":"204359717","full_name":"msfidelis/ecs-microservices-orchestration","owner":"msfidelis","description":":cloud: :whale: :zap: :rocket:  :package: Complete microservices orchestration on ECS on AWS using Terraform","archived":false,"fork":false,"pushed_at":"2021-10-22T17:55:38.000Z","size":822,"stargazers_count":76,"open_issues_count":9,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-27T19:20:52.271Z","etag":null,"topics":["appmesh","aws","codebuild","codepipeline","ecs","ecs-cluster","fargate","service-mesh","terraform","terraform-modules"],"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/msfidelis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-08-25T23:05:23.000Z","updated_at":"2024-08-11T09:36:55.000Z","dependencies_parsed_at":"2023-04-01T12:04:05.378Z","dependency_job_id":null,"html_url":"https://github.com/msfidelis/ecs-microservices-orchestration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fecs-microservices-orchestration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fecs-microservices-orchestration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fecs-microservices-orchestration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fecs-microservices-orchestration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msfidelis","download_url":"https://codeload.github.com/msfidelis/ecs-microservices-orchestration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868598,"owners_count":16555871,"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":["appmesh","aws","codebuild","codepipeline","ecs","ecs-cluster","fargate","service-mesh","terraform","terraform-modules"],"created_at":"2024-09-24T13:15:54.486Z","updated_at":"2025-10-24T13:30:43.468Z","avatar_url":"https://github.com/msfidelis.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Microservices Orchestration on ECS\n\n![Arch](.github/images/container.jpg)\n\n### Complete Microservices Deploy and Orchestration on Amazon ECS using Terraform\n\nCreate clusters and services and pipelines on AWS using Terraform.\n\n\u003e This is a incremental evolution from [ecs-pipeline](https://github.com/msfidelis/ecs-pipeline) for big projects with more microservices and service discovery on AWS\n\nAWS Stack Implementation:\n\n* VPC\n* ECS Fargate\n* Codepipeline\n* Codebuild\n* Application Load Balancer\n* CloudMap\n\n\n## Architecture \n\n![Arch](.github/images/architecture.png)\n\n## Deploy Pipeline\n\nThis demo project search for a buildspec.yml on root path from repository. [You can see an example here](https://github.com/msfidelis/microservice-nadave-whois/blob/master/buildspec.yml).\n\n\n\n\u003c!-- ![Steps](.github/images/pipeline-demo.png) --\u003e\n\n# How to Deploy\n\n## Edit AWS Configurations\n\nEdit `main.tf`\n\n```hcl\n# Customize your AWS Region\nvariable \"aws_region\" {\n  description = \"AWS Region for the VPC\"\n  default     = \"us-east-1\"\n}\n\nprovider \"aws\" {\n  region = var.aws_region\n}\n\ndata \"aws_caller_identity\" \"current\" {}\n```\n\n## Creating a cluster\n\nEdit `clusters.tf` file to customize a cluster preferences. Give infos like ALB basic configurations, AZ's and etc.\n\n```hcl\nmodule \"cluster_example\" {\n\n    source              = \"./modules/ecs\"\n    vpc_id              = module.vpc.vpc_id\n    cluster_name        = var.cluster_name\n\n    listener = {\n        port     = 8080\n        protocol = \"HTTP\"\n        certificate_arn = \"\"\n        ssl_policy      = \"\" // Default \"ELBSecurityPolicy-TLS-1-1-2017-01\"\n    }\n\n    availability_zones  = [\n        module.vpc.public_subnet_1a,\n        module.vpc.public_subnet_1b\n    ]\n\n}\n```\n\n### Output for ecs\n\n```hcl\noutput \"cluster_id\" {}\n\noutput \"alb\" {}\n\noutput \"listener\" {}\n\n```\n\n## Create an Service\n\nEdit `services.tf` and customize an service configurations, like Github sources, containers preferences, alb route path and auto scale preferences.\n\n```hcl\nmodule \"service_whois\" {\n    source          = \"./modules/service\"\n    vpc_id          = module.vpc.vpc_id\n    region          = var.aws_region\n\n    is_public       = true\n\n    # Service name\n    service_name        = \"service-whois\"\n    service_base_path   = \"/whois*\"\n    service_priority    = 400\n    container_port      = 8080\n\n    service_healthcheck = {\n        healthy_threshold   = 3\n        unhealthy_threshold = 10\n        timeout             = 10\n        interval            = 60\n        matcher             = \"200\"\n        path                = \"/healthcheck\"\n        port                = 8080\n    }\n\n    # Cluster to deploy your service - see in clusters.tf\n    cluster_name        = var.cluster_name\n    cluster_id          = module.cluster_example.cluster_id\n    cluster_listener    = module.cluster_example.listener\n    cluster_mesh        = module.cluster_example.cluster_mesh\n\n    cluster_service_discovery = module.cluster_example.cluster_service_discovery\n\n    # Auto Scale Limits\n    desired_tasks   = 2\n    min_tasks       = 2\n    max_tasks       = 10\n\n    # Tasks CPU / Memory limits\n    desired_task_cpu        = 256\n    desired_task_mem        = 512\n\n    # CPU metrics for Auto Scale\n    cpu_to_scale_up         = 30\n    cpu_to_scale_down       = 20\n    cpu_verification_period = 60\n    cpu_evaluation_periods  = 1\n\n    # Pipeline Configuration\n    build_image         = \"aws/codebuild/docker:17.09.0\"\n\n    git_repository_owner    = \"msfidelis\"\n    git_repository_name     = \"microservice-nadave-whois\"\n    git_repository_branch   = \"master\"\n\n    # AZ's\n    availability_zones  = [\n        module.vpc.public_subnet_1a,\n        module.vpc.public_subnet_1b\n    ]\n}\n```\n\n### Enable Container Insights\n\nJust specify a value `true` on `enable_container_insights` parameter. (Default: `false`)\n\n```hcl\nmodule \"cluster_example\" {\n    source              = \"./modules/ecs\"\n\n    vpc_id              = module.vpc.vpc_id\n    cluster_name        = var.cluster_name\n\n    // ...\n\n    enable_container_insights   = true\n\n    // ...\n}\n\n```\n\n\n### Using Fargate Spot (WAITING FOR TERRAFORM PROVIDER)\n\nJust specify a value `FARGATE_SPOT` on `service_launch_type` parameter. (Default: `FARGATE`)\n\n\u003e To change this value is necessary recreate a service. This is causes downtime on production.\n\n```hcl\n```\n\n## How to Deploy\n\n### 1) Github Access Token\n\n* Create your Github Access Token to Command Line. [This link have all information about this](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). \n\n\n* Export Github Token as an environment variable. \n\n```bash\nexport GITHUB_TOKEN=YOUR_TOKEN\n``` \n\n### 2) Terraform\n\n* Initialize Terraform\n\n```bash\nterraform init\n```\n\n* Plan our modifications\n\n```bash\nterraform plan\n```\n\n* Apply the changes on AWS\n\n```bash\nterraform apply\n```\n\n#### References\n\n* [Easy deploy your Docker applications to AWS using ECS and Fargate](https://thecode.pub/easy-deploy-your-docker-applications-to-aws-using-ecs-and-fargate-a988a1cc842f)\n\n* [ECS Pipeline - By msfidelis](https://github.com/msfidelis/ecs-pipeline)\n\n* [ECS Terraform - By alex](https://github.com/alex/ecs-terraform)\n\n* [Terraform-ECS by arminc](https://github.com/arminc/terraform-ecs)\n\n\n### Roadmap\n\n* Appmesh\n\n* Multi Listeners\n\n* Fargate Spot\n\n* Private Services\n\n* Workers\n\n* Bitbucket integrations\n\n* Gitlab integrations\n\n* EFS Support\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fecs-microservices-orchestration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsfidelis%2Fecs-microservices-orchestration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fecs-microservices-orchestration/lists"}