diff --git a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/README.md b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/README.md index c1d4b945..0ff8389d 100644 --- a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/README.md +++ b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/README.md @@ -19,6 +19,9 @@ You must replace all the placeholders (with ```{{ }}```) in the above task defin * ```{{awslogs-region}}```: The AWS region where the container logs should be published: e.g. ```us-west-2``` +* ```{{aws-emf-agent-endpoint}}```: This should point to the endpoint that the agent is listening on. e.g ```tcp://cloudwatch-agent:25888``` + * Refer to https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Generation_CloudWatch_Agent.html. + You can also adjust the resource limit (e.g. cpu and memory) based on your particular use cases. Configure the CloudWatch agent through [SSM parameter](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-su-create.html). Please create a SSM parameter (```ecs-cwagent-sidecar-ec2``` or ```ecs-cwagent-sidecar-fargate```) in the region where your cluster is located, with the following text: diff --git a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-ec2.json b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-ec2.json index 74eef2ae..a9e06f47 100644 --- a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-ec2.json +++ b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-ec2.json @@ -10,6 +10,10 @@ "links": [ "cloudwatch-agent" ], + "environment": [{ + "name": "AWS_EMF_AGENT_ENDPOINT", + "value": "{{aws-emf-agent-endpoint}}" + }], "logConfiguration": { "logDriver": "awslogs", "options": { @@ -45,4 +49,4 @@ ], "cpu": "256", "memory": "256" -} \ No newline at end of file +} diff --git a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-fargate.json b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-fargate.json index c2e07cbc..5f0b1396 100644 --- a/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-fargate.json +++ b/ecs-task-definition-templates/deployment-mode/sidecar/cwagent-emf/cwagent-emf-fargate.json @@ -7,6 +7,10 @@ { "name": "demo-app", "image": "{{demo-app-image}}", + "environment": [{ + "name": "AWS_EMF_AGENT_ENDPOINT", + "value": "{{aws-emf-agent-endpoint}}" + }], "logConfiguration": { "logDriver": "awslogs", "options": { @@ -42,4 +46,4 @@ ], "cpu": "512", "memory": "1024" -} \ No newline at end of file +}