{"id":16725279,"url":"https://github.com/unfor19/terraform-cwagent-ecs-instance-metric","last_synced_at":"2025-09-03T22:41:40.811Z","repository":{"id":41559432,"uuid":"334679666","full_name":"unfor19/terraform-cwagent-ecs-instance-metric","owner":"unfor19","description":"Terraform AWS ECS CloudWatch Agent on ECS","archived":false,"fork":false,"pushed_at":"2021-09-17T18:04:00.000Z","size":304,"stargazers_count":1,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T03:12:50.641Z","etag":null,"topics":["agent","aws","cloudwatch","devops","ecs","terraform"],"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/unfor19.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}},"created_at":"2021-01-31T14:50:24.000Z","updated_at":"2024-05-17T12:05:50.000Z","dependencies_parsed_at":"2022-07-09T15:03:04.816Z","dependency_job_id":null,"html_url":"https://github.com/unfor19/terraform-cwagent-ecs-instance-metric","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/unfor19/terraform-cwagent-ecs-instance-metric","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Fterraform-cwagent-ecs-instance-metric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Fterraform-cwagent-ecs-instance-metric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Fterraform-cwagent-ecs-instance-metric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Fterraform-cwagent-ecs-instance-metric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unfor19","download_url":"https://codeload.github.com/unfor19/terraform-cwagent-ecs-instance-metric/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Fterraform-cwagent-ecs-instance-metric/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264795402,"owners_count":23665231,"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":["agent","aws","cloudwatch","devops","ecs","terraform"],"created_at":"2024-10-12T22:48:37.369Z","updated_at":"2025-07-11T11:32:35.543Z","avatar_url":"https://github.com/unfor19.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-cwagent-ecs-instance-metric\r\n\r\n\u003cimg width=\"1000\" alt=\"logo\" src=\"https://github.com/unfor19/terraform-cwagent-ecs-instance-metric/blob/master/assets/terraform-cwagent-ecs-instance-metric.png?raw=true\" /\u003e\r\n\r\n\r\nThe terraform module for [deploying the CloudWatch Agent to Collect EC2 Instance-Level Metrics on Amazon ECS](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/deploy-container-insights-ECS-instancelevel.html#deploy-container-insights-ECS-instancelevel-quickstart). The [original CloudFormation template](https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/ecs-task-definition-templates/deployment-mode/daemon-service/cwagent-ecs-instance-metric/cloudformation-quickstart/cwagent-ecs-instance-metric-cfn.json).\r\n\r\n**IMPORTANT**: Works only on Linux EC2 instances. If you have 2 Linux + 1 Windows, then the ECS Service desired count will be 3, but the running tasks will be 2, which is normal.\r\n\r\n\r\n## CloudWatch Agent Configuration\r\n\r\nIn a future release, it will be possible to set a [custom configuration for the CloudWatch Agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/deploy-container-insights-ECS-instancelevel.html#:~:text=Advanced%20Configuration) with [SSM Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html).\r\n\r\n\u003cdetails\u003e\r\n\r\n\u003csummary\u003eDefault configuration file values - Expand/Collapse\u003c/summary\u003e\r\n\r\n- region (AWS Region)\r\n- metrics_collection_interval (Seconds)\r\n- force_flush_interval (Seconds)\r\n- endpoint_override (Omitted)\r\n\r\n```json\r\n{\r\n    \"agent\": {\r\n        \"region\": \"your-aws-region\"\r\n    },\r\n    \"logs\": {\r\n        \"metrics_collected\": {\r\n            \"ecs\": {\r\n                \"metrics_collection_interval\": 60\r\n            }\r\n        },\r\n        \"force_flush_interval\": 5\r\n    }\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n## Usage\r\n\r\n```ruby\r\nmodule \"cwagent\" {\r\n  source       = \"unfor19/ecs-instance-metric/cwagent\"\r\n  version      = \"0.0.3\"\r\n\r\n  # required\r\n  region       = \"eu-west-1\"\r\n  cluster_name = \"my-ecs-cluster-name\"\r\n\r\n  # optional\r\n  prefix       = \"ecs\"\r\n  app_name     = \"cwagent\"\r\n  suffix       = \"dev\"\r\n}\r\n```\r\n\r\n\u003c!-- terraform_docs_start --\u003e\r\n\r\n## Requirements\r\n\r\n| Name | Version |\r\n|------|---------|\r\n| terraform | \u003e= 0.12.21 |\r\n| aws | \u003e= 2.68 |\r\n\r\n## Providers\r\n\r\n| Name | Version |\r\n|------|---------|\r\n| aws | \u003e= 2.68 |\r\n| template | n/a |\r\n\r\n## Inputs\r\n\r\n| Name | Description | Type | Default | Required |\r\n|------|-------------|------|---------|:--------:|\r\n| app_name | Assigned to Resources Names | `string` | `\"cwagent\"` | no |\r\n| cluster_name | Target ECS Cluster from which you want to collect metrics | `string` | n/a | yes |\r\n| execution_role_arn | Target ECS Execution Role, if empty then the role is created as part of this module | `string` | `\"\"` | no |\r\n| image_tag | CloudWatch Agent Image Tag for amazon/cloudwatch-agent:{image_tag} | `string` | `\"1.247347.3b250378\"` | no |\r\n| prefix | Prefix all resources with this string, example: myapp | `string` | `\"\"` | no |\r\n| region | Target region | `string` | n/a | yes |\r\n| suffix | Suffix all resources with this string, example: dev | `string` | `\"\"` | no |\r\n| task_cpu | CloudWatch Agent Task milli-CPU | `number` | `128` | no |\r\n| task_memory | CloudWatch Agent Task Memory (MB) | `number` | `64` | no |\r\n| task_role_arn | Target ECS Task Role, if empty then the role is created as part of this module | `string` | `\"\"` | no |\r\n\r\n## Outputs\r\n\r\n| Name | Description |\r\n|------|-------------|\r\n| app_name | App name, optionally includes prefix and suffix |\r\n| ecs_service_arn | Service ARN |\r\n| ecs_task_definition_arn | Task Definition ARN |\r\n| iam_cwagent_task_execution_role_arn | Task Execution Role ARN |\r\n| iam_cwagent_task_role_arn | Task Role ARN |\r\n\r\n\u003c!-- terraform_docs_end --\u003e\r\n\r\n## Authors\r\n\r\nCreated and maintained by [Meir Gabay](https://github.com/unfor19)\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/unfor19/cwagent-ecs-instance-metric-terraform/blob/master/LICENSE) file for details\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfor19%2Fterraform-cwagent-ecs-instance-metric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funfor19%2Fterraform-cwagent-ecs-instance-metric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfor19%2Fterraform-cwagent-ecs-instance-metric/lists"}