id
stringlengths 8
78
| source
stringclasses 743
values | chunk_id
int64 1
5.05k
| text
stringlengths 593
49.7k
|
---|---|---|---|
acw-ug-171 | acw-ug.pdf | 171 | the Amazon SNS console at https://console.aws.amazon.com/sns/v3/home. 2. In the navigation pane, choose Topics. 3. On the Topics page, select a topic and choose Publish to topic. 4. In the Publish a message page, for Subject, enter a subject line for your message, and for Message, enter a brief message. 5. Choose Publish Message. 6. Check your email to confirm that you received the message. Setting up an SNS topic using the AWS CLI First, you create an SNS topic, and then you publish a message directly to the topic to test that you have properly configured it. To set up an SNS topic 1. Create the topic using the create-topic command as follows. aws sns create-topic --name my-topic Amazon SNS returns a topic ARN with the following format: { "TopicArn": "arn:aws:sns:us-east-1:111122223333:my-topic" } 2. Subscribe your email address to the topic using the subscribe command. If the subscription request succeeds, you receive a confirmation email message. Notifying users on alarm changes 479 Amazon CloudWatch User Guide aws sns subscribe --topic-arn arn:aws:sns:us-east-1:111122223333:my-topic -- protocol email --notification-endpoint my-email-address Amazon SNS returns the following: { "SubscriptionArn": "pending confirmation" } 3. From your email application, open the message from AWS Notifications and confirm your subscription. Your web browser displays a confirmation response from Amazon Simple Notification Service. 4. Check the subscription using the list-subscriptions-by-topic command. aws sns list-subscriptions-by-topic --topic-arn arn:aws:sns:us- east-1:111122223333:my-topic Amazon SNS returns the following: { "Subscriptions": [ { "Owner": "111122223333", "Endpoint": "me@mycompany.com", "Protocol": "email", "TopicArn": "arn:aws:sns:us-east-1:111122223333:my-topic", "SubscriptionArn": "arn:aws:sns:us-east-1:111122223333:my-topic:64886986- bf10-48fb-a2f1-dab033aa67a3" } ] } 5. (Optional) Publish a test message to the topic using the publish command. aws sns publish --message "Verification" --topic arn:aws:sns:us- east-1:111122223333:my-topic Amazon SNS returns the following. Notifying users on alarm changes 480 Amazon CloudWatch User Guide { "MessageId": "42f189a0-3094-5cf6-8fd7-c2dde61a4d7d" } 6. Check your email to confirm that you received the message. Schema of Amazon SNS notifications when alarms change state This section lists the schemas of the notifications sent to Amazon SNS topics when alarms change their state. Schema when a metric alarm changes state { "AlarmName": "string", "AlarmDescription": "string", "AWSAccountId": "string", "AlarmConfigurationUpdatedTimestamp": "string", "NewStateValue": "string", "NewStateReason": "string", "StateChangeTime": "string", "Region": "string", "AlarmArn": "string", "OldStateValue": "string", "OKActions": ["string"], "AlarmActions": ["string"], "InsufficientDataActions": ["string"], "Trigger": { "MetricName": "string", "Namespace": "string", "StatisticType": "string", "Statistic": "string", "Unit": "string or null", "Dimensions": [ { "value": "string", "name": "string" } ], "Period": "integer", "EvaluationPeriods": "integer", "DatapointsToAlarm": "integer", Notifying users on alarm changes 481 Amazon CloudWatch User Guide "ComparisonOperator": "string", "Threshold": "number", "TreatMissingData": "string", "EvaluateLowSampleCountPercentile": "string or null" } } Schema when a composite alarm changes state { "AlarmName": "string", "AlarmDescription": "string", "AWSAccountId": "string", "NewStateValue": "string", "NewStateReason": "string", "StateChangeTime": "string", "Region": "string", "AlarmArn": "string", "OKActions": [String], "AlarmActions": [String], "InsufficientDataActions": [String], "OldStateValue": "string", "AlarmRule": "string", "TriggeringChildren": [String] } Alarm events and EventBridge CloudWatch sends events to Amazon EventBridge whenever a CloudWatch alarm is created, updated, deleted, or changes alarm state. You can use EventBridge and these events to write rules that take actions, such as notifying you, when an alarm changes state. For more information, see What is Amazon EventBridge? CloudWatch guarantees the delivery of alarm state change events to EventBridge. Sample events from CloudWatch This section includes example events from CloudWatch. State change for a single-metric alarm { "version": "0", Alarm events and EventBridge 482 Amazon CloudWatch User Guide "id": "c4c1c1c9-6542-e61b-6ef0-8c4d36933a92", "detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2019-10-02T17:04:40Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServerCpuTooHigh" ], "detail": { "alarmName": "ServerCpuTooHigh", "configuration": { "description": "Goes into alarm when server CPU utilization is too high!", "metrics": [ { "id": "30b6c6b2-a864-43a2-4877-c09a1afc3b87", "metricStat": { "metric": { "dimensions": { "InstanceId": "i-12345678901234567" }, "name": "CPUUtilization", "namespace": "AWS/EC2" }, "period": 300, "stat": "Average" }, "returnData": true } ] }, "previousState": { "reason": "Threshold Crossed: 1 out of the last 1 datapoints [0.0666851903306472 (01/10/19 13:46:00)] was not greater than the threshold (50.0) (minimum 1 datapoint for ALARM -> OK transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\": \"2019-10-01T13:56:40.985+0000\",\"startDate\":\"2019-10-01T13:46:00.000+0000\", \"statistic\":\"Average\",\"period\":300,\"recentDatapoints\":[0.0666851903306472], \"threshold\":50.0}", "timestamp": "2019-10-01T13:56:40.987+0000", "value": "OK" }, "state": { Alarm events and EventBridge 483 Amazon CloudWatch User Guide "reason": "Threshold Crossed: 1 out of the last 1 datapoints [99.50160229693434 (02/10/19 16:59:00)] was greater than the threshold (50.0) (minimum 1 datapoint for OK -> ALARM transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\": \"2019-10-02T17:04:40.985+0000\",\"startDate\":\"2019-10-02T16:59:00.000+0000\", \"statistic\":\"Average\",\"period\":300,\"recentDatapoints\":[99.50160229693434], \"threshold\":50.0}", "timestamp": "2019-10-02T17:04:40.989+0000", "value": "ALARM" } } } State change for a metric math alarm { "version": "0", "id": "2dde0eb1-528b-d2d5-9ca6-6d590caf2329", "detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2019-10-02T17:20:48Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:TotalNetworkTrafficTooHigh" ], "detail": { "alarmName": "TotalNetworkTrafficTooHigh", "configuration": { "description": "Goes into alarm if total network traffic exceeds 10Kb", "metrics": [ { "expression": "SUM(METRICS())", "id": "e1", "label": "Total Network Traffic", "returnData": true }, { "id": "m1", "metricStat": { "metric": { "dimensions": { "InstanceId": "i-12345678901234567" Alarm events and EventBridge 484 Amazon CloudWatch User Guide }, "name": "NetworkIn", "namespace": "AWS/EC2" }, "period": 300, "stat": "Maximum" }, "returnData": false }, { "id": "m2", "metricStat": { "metric": { "dimensions": { "InstanceId": "i-12345678901234567" |
acw-ug-172 | acw-ug.pdf | 172 | metric math alarm { "version": "0", "id": "2dde0eb1-528b-d2d5-9ca6-6d590caf2329", "detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2019-10-02T17:20:48Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:TotalNetworkTrafficTooHigh" ], "detail": { "alarmName": "TotalNetworkTrafficTooHigh", "configuration": { "description": "Goes into alarm if total network traffic exceeds 10Kb", "metrics": [ { "expression": "SUM(METRICS())", "id": "e1", "label": "Total Network Traffic", "returnData": true }, { "id": "m1", "metricStat": { "metric": { "dimensions": { "InstanceId": "i-12345678901234567" Alarm events and EventBridge 484 Amazon CloudWatch User Guide }, "name": "NetworkIn", "namespace": "AWS/EC2" }, "period": 300, "stat": "Maximum" }, "returnData": false }, { "id": "m2", "metricStat": { "metric": { "dimensions": { "InstanceId": "i-12345678901234567" }, "name": "NetworkOut", "namespace": "AWS/EC2" }, "period": 300, "stat": "Maximum" }, "returnData": false } ] }, "previousState": { "reason": "Unchecked: Initial alarm creation", "timestamp": "2019-10-02T17:20:03.642+0000", "value": "INSUFFICIENT_DATA" }, "state": { "reason": "Threshold Crossed: 1 out of the last 1 datapoints [45628.0 (02/10/19 17:10:00)] was greater than the threshold (10000.0) (minimum 1 datapoint for OK -> ALARM transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\": \"2019-10-02T17:20:48.551+0000\",\"startDate\":\"2019-10-02T17:10:00.000+0000\", \"period\":300,\"recentDatapoints\":[45628.0],\"threshold\":10000.0}", "timestamp": "2019-10-02T17:20:48.554+0000", "value": "ALARM" } } } Alarm events and EventBridge 485 Amazon CloudWatch User Guide State change for an anomaly detection alarm { "version": "0", "id": "daafc9f1-bddd-c6c9-83af-74971fcfc4ef", "detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2019-10-03T16:00:04Z", "region": "us-east-1", "resources": ["arn:aws:cloudwatch:us-east-1:123456789012:alarm:EC2 CPU Utilization Anomaly"], "detail": { "alarmName": "EC2 CPU Utilization Anomaly", "state": { "value": "ALARM", "reason": "Thresholds Crossed: 1 out of the last 1 datapoints [0.0 (03/10/19 15:58:00)] was less than the lower thresholds [0.020599444741798756] or greater than the upper thresholds [0.3006915352732461] (minimum 1 datapoint for OK -> ALARM transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\": \"2019-10-03T16:00:04.650+0000\",\"startDate\":\"2019-10-03T15:58:00.000+0000\", \"period\":60,\"recentDatapoints\":[0.0],\"recentLowerThresholds\": [0.020599444741798756],\"recentUpperThresholds\":[0.3006915352732461]}", "timestamp": "2019-10-03T16:00:04.653+0000" }, "previousState": { "value": "OK", "reason": "Thresholds Crossed: 1 out of the last 1 datapoints [0.166666666664241 (03/10/19 15:57:00)] was not less than the lower thresholds [0.0206719426210418] or not greater than the upper thresholds [0.30076870222143803] (minimum 1 datapoint for ALARM -> OK transition).", "reasonData": "{\"version\":\"1.0\",\"queryDate\": \"2019-10-03T15:59:04.670+0000\",\"startDate\":\"2019-10-03T15:57:00.000+0000\", \"period\":60,\"recentDatapoints\":[0.166666666664241],\"recentLowerThresholds\": [0.0206719426210418],\"recentUpperThresholds\":[0.30076870222143803]}", "timestamp": "2019-10-03T15:59:04.672+0000" }, "configuration": { "description": "Goes into alarm if CPU Utilization is out of band", "metrics": [{ "id": "m1", "metricStat": { "metric": { Alarm events and EventBridge 486 Amazon CloudWatch User Guide "namespace": "AWS/EC2", "name": "CPUUtilization", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 60, "stat": "Average" }, "returnData": true }, { "id": "ad1", "expression": "ANOMALY_DETECTION_BAND(m1, 0.8)", "label": "CPUUtilization (expected)", "returnData": true }] } } } State change for a composite alarm with a suppressor alarm { "version": "0", "id": "d3dfc86d-384d-24c8-0345-9f7986db0b80", "detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-07-22T15:57:45Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServiceAggregatedAlarm" ], "detail": { "alarmName": "ServiceAggregatedAlarm", "state": { "actionsSuppressedBy": "WaitPeriod", "actionsSuppressedReason": "Actions suppressed by WaitPeriod", "value": "ALARM", "reason": "arn:aws:cloudwatch:us- east-1:123456789012:alarm:SuppressionDemo.EventBridge.FirstChild transitioned to ALARM at Friday 22 July, 2022 15:57:45 UTC", Alarm events and EventBridge 487 Amazon CloudWatch User Guide "reasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us- east-1:123456789012:alarm:ServerCpuTooHigh\",\"state\":{\"value\":\"ALARM\",\"timestamp \":\"2022-07-22T15:57:45.394+0000\"}}]}", "timestamp": "2022-07-22T15:57:45.394+0000" }, "previousState": { "value": "OK", "reason": "arn:aws:cloudwatch:us- east-1:123456789012:alarm:SuppressionDemo.EventBridge.Main was created and its alarm rule evaluates to OK", "reasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us- east-1:123456789012:alarm:TotalNetworkTrafficTooHigh\",\"state\":{\"value\":\"OK\", \"timestamp\":\"2022-07-14T16:28:57.770+0000\"}},{\"arn\":\"arn:aws:cloudwatch:us- east-1:123456789012:alarm:ServerCpuTooHigh\",\"state\":{\"value\":\"OK\",\"timestamp\": \"2022-07-14T16:28:54.191+0000\"}}]}", "timestamp": "2022-07-22T15:56:14.552+0000" }, "configuration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "actionsSuppressor": "ServiceMaintenanceAlarm", "actionsSuppressorWaitPeriod": 120, "actionsSuppressorExtensionPeriod": 180 } } } Creation of a composite alarm { "version": "0", "id": "91535fdd-1e9c-849d-624b-9a9f2b1d09d0", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-03-03T17:06:22Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServiceAggregatedAlarm" ], "detail": { "alarmName": "ServiceAggregatedAlarm", Alarm events and EventBridge 488 Amazon CloudWatch User Guide "operation": "create", "state": { "value": "INSUFFICIENT_DATA", "timestamp": "2022-03-03T17:06:22.289+0000" }, "configuration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "alarmName": "ServiceAggregatedAlarm", "description": "Aggregated monitor for instance", "actionsEnabled": true, "timestamp": "2022-03-03T17:06:22.289+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] } } } Creation of a composite alarm with a suppressor alarm { "version": "0", "id": "454773e1-09f7-945b-aa2c-590af1c3f8e0", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-07-14T13:59:46Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServiceAggregatedAlarm" ], "detail": { "alarmName": "ServiceAggregatedAlarm", "operation": "create", "state": { "value": "INSUFFICIENT_DATA", "timestamp": "2022-07-14T13:59:46.425+0000" }, "configuration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "actionsSuppressor": "ServiceMaintenanceAlarm", Alarm events and EventBridge 489 Amazon CloudWatch User Guide "actionsSuppressorWaitPeriod": 120, "actionsSuppressorExtensionPeriod": 180, "alarmName": "ServiceAggregatedAlarm", "actionsEnabled": true, "timestamp": "2022-07-14T13:59:46.425+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] } } } Update of a metric alarm { "version": "0", "id": "bc7d3391-47f8-ae47-f457-1b4d06118d50", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-03-03T17:06:34Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServerCpuTooHigh" ], "detail": { "alarmName": "ServerCpuTooHigh", "operation": "update", "state": { "value": "INSUFFICIENT_DATA", "timestamp": "2022-03-03T17:06:13.757+0000" }, "configuration": { "evaluationPeriods": 1, "threshold": 80, "comparisonOperator": "GreaterThanThreshold", "treatMissingData": "ignore", "metrics": [ { "id": "86bfa85f-b14c-ebf7-8916-7da014ce23c0", "metricStat": { "metric": { Alarm events and EventBridge 490 Amazon CloudWatch User Guide "namespace": "AWS/EC2", "name": "CPUUtilization", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Average" }, "returnData": true } ], "alarmName": "ServerCpuTooHigh", "description": "Goes into alarm when server CPU utilization is too high!", "actionsEnabled": true, "timestamp": "2022-03-03T17:06:34.267+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] }, "previousConfiguration": { "evaluationPeriods": 1, "threshold": 70, "comparisonOperator": "GreaterThanThreshold", "treatMissingData": "ignore", "metrics": [ { "id": "d6bfa85f-893e-b052-a58b-4f9295c9111a", "metricStat": { "metric": { "namespace": "AWS/EC2", "name": "CPUUtilization", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Average" }, "returnData": true } ], "alarmName": "ServerCpuTooHigh", "description": "Goes into alarm when |
acw-ug-173 | acw-ug.pdf | 173 | { "metric": { Alarm events and EventBridge 490 Amazon CloudWatch User Guide "namespace": "AWS/EC2", "name": "CPUUtilization", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Average" }, "returnData": true } ], "alarmName": "ServerCpuTooHigh", "description": "Goes into alarm when server CPU utilization is too high!", "actionsEnabled": true, "timestamp": "2022-03-03T17:06:34.267+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] }, "previousConfiguration": { "evaluationPeriods": 1, "threshold": 70, "comparisonOperator": "GreaterThanThreshold", "treatMissingData": "ignore", "metrics": [ { "id": "d6bfa85f-893e-b052-a58b-4f9295c9111a", "metricStat": { "metric": { "namespace": "AWS/EC2", "name": "CPUUtilization", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Average" }, "returnData": true } ], "alarmName": "ServerCpuTooHigh", "description": "Goes into alarm when server CPU utilization is too high!", Alarm events and EventBridge 491 Amazon CloudWatch User Guide "actionsEnabled": true, "timestamp": "2022-03-03T17:06:13.757+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] } } } Update of a composite alarm with a suppressor alarm { "version": "0", "id": "4c6f4177-6bd5-c0ca-9f05-b4151c54568b", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-07-14T13:59:56Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServiceAggregatedAlarm" ], "detail": { "alarmName": "ServiceAggregatedAlarm", "operation": "update", "state": { "actionsSuppressedBy": "WaitPeriod", "value": "ALARM", "timestamp": "2022-07-14T13:59:46.425+0000" }, "configuration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "actionsSuppressor": "ServiceMaintenanceAlarm", "actionsSuppressorWaitPeriod": 120, "actionsSuppressorExtensionPeriod": 360, "alarmName": "ServiceAggregatedAlarm", "actionsEnabled": true, "timestamp": "2022-07-14T13:59:56.290+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] }, Alarm events and EventBridge 492 Amazon CloudWatch User Guide "previousConfiguration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "actionsSuppressor": "ServiceMaintenanceAlarm", "actionsSuppressorWaitPeriod": 120, "actionsSuppressorExtensionPeriod": 180, "alarmName": "ServiceAggregatedAlarm", "actionsEnabled": true, "timestamp": "2022-07-14T13:59:46.425+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] } } } Deletion of a metric math alarm { "version": "0", "id": "f171d220-9e1c-c252-5042-2677347a83ed", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-03-03T17:07:13Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:TotalNetworkTrafficTooHigh" ], "detail": { "alarmName": "TotalNetworkTrafficTooHigh", "operation": "delete", "state": { "value": "INSUFFICIENT_DATA", "timestamp": "2022-03-03T17:06:17.672+0000" }, "configuration": { "evaluationPeriods": 1, "threshold": 10000, "comparisonOperator": "GreaterThanThreshold", "treatMissingData": "ignore", "metrics": [{ Alarm events and EventBridge 493 Amazon CloudWatch User Guide "id": "m1", "metricStat": { "metric": { "namespace": "AWS/EC2", "name": "NetworkIn", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Maximum" }, "returnData": false }, { "id": "m2", "metricStat": { "metric": { "namespace": "AWS/EC2", "name": "NetworkOut", "dimensions": { "InstanceId": "i-12345678901234567" } }, "period": 300, "stat": "Maximum" }, "returnData": false }, { "id": "e1", "expression": "SUM(METRICS())", "label": "Total Network Traffic", "returnData": true } ], "alarmName": "TotalNetworkTrafficTooHigh", "description": "Goes into alarm if total network traffic exceeds 10Kb", "actionsEnabled": true, "timestamp": "2022-03-03T17:06:17.672+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] Alarm events and EventBridge 494 Amazon CloudWatch } } } User Guide Deletion of a composite alarm with a suppressor alarm { "version": "0", "id": "e34592a1-46c0-b316-f614-1b17a87be9dc", "detail-type": "CloudWatch Alarm Configuration Change", "source": "aws.cloudwatch", "account": "123456789012", "time": "2022-07-14T14:00:01Z", "region": "us-east-1", "resources": [ "arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServiceAggregatedAlarm" ], "detail": { "alarmName": "ServiceAggregatedAlarm", "operation": "delete", "state": { "actionsSuppressedBy": "WaitPeriod", "value": "ALARM", "timestamp": "2022-07-14T13:59:46.425+0000" }, "configuration": { "alarmRule": "ALARM(ServerCpuTooHigh) OR ALARM(TotalNetworkTrafficTooHigh)", "actionsSuppressor": "ServiceMaintenanceAlarm", "actionsSuppressorWaitPeriod": 120, "actionsSuppressorExtensionPeriod": 360, "alarmName": "ServiceAggregatedAlarm", "actionsEnabled": true, "timestamp": "2022-07-14T13:59:56.290+0000", "okActions": [], "alarmActions": [], "insufficientDataActions": [] } } } Alarm events and EventBridge 495 Amazon CloudWatch User Guide Start an investigation in Amazon Q operational investigations from an alarm You can start an investigation in Amazon Q operational investigations from the current state of a CloudWatch alarm, or from any point in the last two weeks of a CloudWatch alarm's history. For more information about Amazon Q operational investigations, see Amazon Q Developer operational investigations (Preview). To start an investigation from a CloudWatch alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the left navigation pane, choose Alarms, All alarms. 3. Choose the name of the alarm. 4. Choose the time period in the alarm history that you want to investigate. 5. Choose Investigate, Start new investigation. 6. For New investigation title, enter a name for the investigation. Then choose Start investigation. The Amazon Q investigations assistant starts. It scans your telemetry data to find data that might be associated with this situation. 7. In the CloudWatch console's navigation pane, choose Investigations, then choose the name of the investigation that you just started. The Findings section displays a natural-language summary of the alarm's status and the reason that it was triggered. 8. (Optional) In the graph of the alarm, you can right-click and then choose to deep-dive into the alarm or the metric that it watches. 9. On the right side of the screen, choose the Suggestions tab. You see a list of other telemetry that Amazon Q operational investigations has discovered and that might be relevant to the investigation. These findings can include other metrics and CloudWatch Logs Insights query results. Amazon Q operational investigations ran these queries based on the alarm. • For each finding, you can choose Add to findings or Discard. Start an investigation in Amazon Q operational investigations from an alarm 496 Amazon CloudWatch User Guide When you choose Add to findings, the telemetry is added to the Findings section, and Amazon Q operational investigations uses this information to direct it's further scanning and suggestions. • For |
acw-ug-174 | acw-ug.pdf | 174 | of other telemetry that Amazon Q operational investigations has discovered and that might be relevant to the investigation. These findings can include other metrics and CloudWatch Logs Insights query results. Amazon Q operational investigations ran these queries based on the alarm. • For each finding, you can choose Add to findings or Discard. Start an investigation in Amazon Q operational investigations from an alarm 496 Amazon CloudWatch User Guide When you choose Add to findings, the telemetry is added to the Findings section, and Amazon Q operational investigations uses this information to direct it's further scanning and suggestions. • For a CloudWatch Logs Insights query result, to change or edit the query and re-run it, you can open the context (right-click) menu for by the results, and then choose Open in Logs Insights. For more information, see Analyzing log data with CloudWatch Logs Insights. If you want to run a different query, when you get to the Logs Insights page you can choose to use query assist to be able to use natural language to form a query. For more information, see Use natural language to generate and update CloudWatch Logs Insights queries. • (Optional) If you know of telemetry in another AWS service that might apply to this investigation, you can go to that service's console and add the telemetry to the investigation. For example, to add a Lambda metric to the investigation, you can do the following: 1. Open the Lambda console. 2. In the Monitor section, find the metric. 3. Open the context menu for the metric, choose Investigate, Add to investigation Then, in the Investigate pane, select the name of the investigation. 10. Amazon Q might also add hypotheses to the list in the Suggestions tab. These hypotheses are generated by the investigation in natural language. For each hyypotheses, you can choose Add to findings or Discard. 11. When you think you have completed the investigation and found the root cause of the issue, you can choose the Overview tab and then choose Investigation summary. Amazon Q investigations then creates a natural-language summary of the important findings and hypotheses from the investigation. Managing alarms Edit or delete a CloudWatch alarm You can edit or delete an existing alarm. Managing alarms 497 Amazon CloudWatch User Guide You can't change the name of an existing alarm. You can copy an alarm and give the new alarm a different name. To copy an alarm, select the check box next to the alarm name in the alarm list and choose Action, Copy. To edit an alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose the name of the alarm. 4. 5. To add or remove tags, choose the Tags tab and then choose Manage tags. To edit other parts of the alarm, choose Actions, Edit. The Specify metric and conditions page appears, showing a graph and other information about the metric and statistic that you selected. 6. To change the metric, choose Edit, choose the All metrics tab, and do one of the following: • • Choose the service namespace that contains the metric that you want. Continue choosing options as they appear to narrow the choices. When a list of metrics appears, select the check box next to the metric that you want. In the search box, enter the name of a metric, dimension, or resource ID and press Enter. Then choose one of the results and continue until a list of metrics appears. Select the check box next to the metric that you want. Choose Select metric. 7. To change other aspects of the alarm, choose the appropriate options. To change how many data points must be breaching for the alarm to go into ALARM state or to change how missing data is treated, choose Additional configuration. 8. Choose Next. 9. Under Notification, Auto Scaling action, and EC2 action, optionally edit the actions taken when the alarm is triggered. Then choose Next. 10. Optionally change the alarm description. You can't change the name of an existing alarm. You can copy an alarm and give the new alarm a different name. To copy an alarm, select the check box next to the alarm name in the alarm list and choose Action, Copy. 11. Choose Next. Editing or deleting a CloudWatch alarm 498 Amazon CloudWatch User Guide 12. Under Preview and create, confirm that the information and conditions are what you want, then choose Update alarm. To update an email notification list that was created using the Amazon SNS console 1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/v3/home. 2. In the navigation pane, choose Topics and then select the ARN for your notification list (topic). 3. Do one of the following: • To add an email address, choose Create subscription. |
acw-ug-175 | acw-ug.pdf | 175 | next to the alarm name in the alarm list and choose Action, Copy. 11. Choose Next. Editing or deleting a CloudWatch alarm 498 Amazon CloudWatch User Guide 12. Under Preview and create, confirm that the information and conditions are what you want, then choose Update alarm. To update an email notification list that was created using the Amazon SNS console 1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/v3/home. 2. In the navigation pane, choose Topics and then select the ARN for your notification list (topic). 3. Do one of the following: • To add an email address, choose Create subscription. For Protocol, choose Email. For Endpoint, enter the email address of the new recipient. Choose Create subscription. • To remove an email address, choose the Subscription ID. Choose Other subscription actions, Delete subscriptions. 4. Choose Publish to topic. To delete an alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Alarms. Select the check box to the left of the name of the alarm, and choose Actions, Delete. 4. Choose Delete. Hide Auto Scaling alarms When you view your alarms in the AWS Management Console, you can hide the alarms related to both Amazon EC2 Auto Scaling and Application Auto Scaling. This feature is available only in the AWS Management Console. To temporarily hide Auto Scaling alarms 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All alarms, and select Hide Auto Scaling alarms. Hide Auto Scaling alarms 499 Amazon CloudWatch User Guide Alarm use cases and examples The following sections provides examples and tutorials for alarms for common use cases. Topics • Create a billing alarm to monitor your estimated AWS charges • Create a CPU usage alarm • Create a load balancer latency alarm that sends email • Create a storage throughput alarm that sends email • Create an alarm on Performance Insights counter metrics from an AWS database • Create alarms to stop, terminate, reboot, or recover an EC2 instance Create a billing alarm to monitor your estimated AWS charges You can monitor your estimated AWS charges by using Amazon CloudWatch. When you enable the monitoring of estimated charges for your AWS account, the estimated charges are calculated and sent several times daily to CloudWatch as metric data. Billing metric data is stored in the US East (N. Virginia) Region and represents worldwide charges. This data includes the estimated charges for every service in AWS that you use, in addition to the estimated overall total of your AWS charges. The alarm triggers when your account billing exceeds the threshold you specify. It triggers only when the current billing exceeds the threshold. It doesn't use projections based on your usage so far in the month. If you create a billing alarm at a time when your charges have already exceeded the threshold, the alarm goes to the ALARM state immediately. Note For information about analyzing CloudWatch charges that you have already been billed for, see Analyzing, optimizing, and reducing CloudWatch costs. Tasks Alarm use cases and examples 500 Amazon CloudWatch • Enabling billing alerts • Create a billing alarm • Deleting a billing alarm Enabling billing alerts User Guide Before you can create an alarm for your estimated charges, you must enable billing alerts, so that you can monitor your estimated AWS charges and create an alarm using billing metric data. After you enable billing alerts, you can't disable data collection, but you can delete any billing alarms that you created. After you enable billing alerts for the first time, it takes about 15 minutes before you can view billing data and set billing alarms. Requirements • You must be signed in using account root user credentials or as an IAM user that has been given permission to view billing information. • For consolidated billing accounts, billing data for each linked account can be found by logging in as the paying account. You can view billing data for total estimated charges and estimated charges by service for each linked account, in addition to the consolidated account. • In a consolidated billing account, member linked account metrics are captured only if the payer account enables the Receive Billing Alerts preference. If you change which account is your management/payer account, you must enable the billing alerts in the new management/payer account. • The account must not be part of the Amazon Partner Network (APN) because billing metrics are not published to CloudWatch for APN accounts. For more information, see AWS Partner Network. To enable the monitoring of estimated charges 1. Open the AWS Billing and Cost Management console at https://console.aws.amazon.com/ costmanagement/. 2. In the navigation pane, choose Billing Preferences. 3. By Alert preferences choose Edit. 4. Choose Receive CloudWatch Billing Alerts. 5. Choose Save preferences. Create a billing alarm |
acw-ug-176 | acw-ug.pdf | 176 | Alerts preference. If you change which account is your management/payer account, you must enable the billing alerts in the new management/payer account. • The account must not be part of the Amazon Partner Network (APN) because billing metrics are not published to CloudWatch for APN accounts. For more information, see AWS Partner Network. To enable the monitoring of estimated charges 1. Open the AWS Billing and Cost Management console at https://console.aws.amazon.com/ costmanagement/. 2. In the navigation pane, choose Billing Preferences. 3. By Alert preferences choose Edit. 4. Choose Receive CloudWatch Billing Alerts. 5. Choose Save preferences. Create a billing alarm 501 Amazon CloudWatch Create a billing alarm Important User Guide Before you create a billing alarm, you must set your Region to US East (N. Virginia). Billing metric data is stored in this Region and represents worldwide charges. You also must enable billing alerts for your account or in the management/payer account (if you are using consolidated billing). For more information, see Enabling billing alerts. In this procedure, you create an alarm that sends a notification when your estimated charges for AWS exceed a defined threshold. To create a billing alarm using the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, and then choose All alarms. 3. Choose Create alarm. 4. Choose Select metric. In AWS Namespaces, choose Billing, and then choose Total Estimated Charge. Note If you don't see the Billing/Total Estimated Charge metric, enable billing alerts, and change your Region to US East (N. Virginia). For more information, see Enabling billing alerts. Select the box for the EstimatedCharges metric, and then choose Select metric. For Statistic, choose Maximum. For Period, choose 6 hours. For Threshold type, choose Static. For Whenever EstimatedCharges is . . ., choose Greater. 5. 6. 7. 8. 9. 10. For than . . ., define the value that you want to cause your alarm to trigger. For example, 200 USD. The EstimatedCharges metric values are only in US dollars (USD), and the currency conversion is provided by Amazon Services LLC. For more information, see What is AWS Billing?. Create a billing alarm 502 Amazon CloudWatch Note User Guide After you define a threshold value, the preview graph displays your estimated charges for the current month. 11. Choose Additional Configuration and do the following: • For Datapoints to alarm, specify 1 out of 1. • For Missing data treatment, choose Treat missing data as missing. 12. Choose Next. 13. Under Notification, ensure that In alarm is selected. Then specify an Amazon SNS topic to be notified when your alarm is in the ALARM state. The Amazon SNS topic can include your email address so that you receive email when the billing amount crosses the threshold that you specified. You can select an existing Amazon SNS topic, create a new Amazon SNS topic, or use a topic ARN to notify other account. If you want your alarm to send multiple notifications for the same alarm state or for different alarm states, choose Add notification. 14. Choose Next. 15. Under Name and description, enter a name for your alarm. The name must contain only UTF-8 characters, and can't contain ASCII control characters. • (Optional) Enter a description of your alarm. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 16. Choose Next. 17. Under Preview and create, make sure that your configuration is correct, and then choose Create alarm. Deleting a billing alarm You can delete your billing alarm when you no longer need it. To delete a billing alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. Create a billing alarm 503 Amazon CloudWatch User Guide 2. If necessary, change the Region to US East (N. Virginia). Billing metric data is stored in this Region and reflects worldwide charges. In the navigation pane, choose Alarms, All alarms. Select the check box next to the alarm and choose Actions, Delete. 3. 4. 5. When prompted for confirmation, choose Yes, Delete. Create a CPU usage alarm You can create an CloudWatch alarm that sends a notification using Amazon SNS when the alarm changes state from OK to ALARM. The alarm changes to the ALARM state when the average CPU use of an EC2 instance exceeds a specified threshold for consecutive specified periods. Setting up a CPU usage alarm using the AWS Management Console Use these steps to use the AWS Management Console to create a CPU usage alarm. To create an alarm based on CPU usage 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose Create alarm. 4. Choose Select metric. 5. In the All metrics tab, choose |
acw-ug-177 | acw-ug.pdf | 177 | Amazon SNS when the alarm changes state from OK to ALARM. The alarm changes to the ALARM state when the average CPU use of an EC2 instance exceeds a specified threshold for consecutive specified periods. Setting up a CPU usage alarm using the AWS Management Console Use these steps to use the AWS Management Console to create a CPU usage alarm. To create an alarm based on CPU usage 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose Create alarm. 4. Choose Select metric. 5. In the All metrics tab, choose EC2 metrics. 6. Choose a metric category (for example, Per-Instance Metrics). 7. Find the row with the instance that you want listed in the InstanceId column and CPUUtilization in the Metric Name column. Select the check box next to this row, and choose Select metric. 8. Under Specify metric and conditions, for Statistic choose Average, choose one of the predefined percentiles, or specify a custom percentile (for example, p95.45). 9. Choose a period (for example, 5 minutes). 10. Under Conditions, specify the following: a. For Threshold type, choose Static. Create a CPU usage alarm 504 Amazon CloudWatch User Guide b. For Whenever CPUUtilization is, specify Greater. Under than..., specify the threshold that is to trigger the alarm to go to ALARM state if the CPU utilization exceeds this percentage. For example, 70. c. Choose Additional configuration. For Datapoints to alarm, specify how many evaluation periods (data points) must be in the ALARM state to trigger the alarm. If the two values here match, you create an alarm that goes to ALARM state if that many consecutive periods are breaching. d. e. To create an M out of N alarm, specify a lower number for the first value than you specify for the second value. For more information, see Evaluating an alarm. For Missing data treatment, choose how to have the alarm behave when some data points are missing. For more information, see Configuring how CloudWatch alarms treat missing data. If the alarm uses a percentile as the monitored statistic, a Percentiles with low samples box appears. Use it to choose whether to evaluate or ignore cases with low sample rates. If you choose ignore (maintain alarm state), the current alarm state is always maintained when the sample size is too low. For more information, see Percentile-based CloudWatch alarms and low data samples. 11. Choose Next. 12. Under Notification, choose In alarm and select an SNS topic to notify when the alarm is in ALARM state To have the alarm send multiple notifications for the same alarm state or for different alarm states, choose Add notification. To have the alarm not send notifications, choose Remove. 13. When finished, choose Next. 14. Enter a name and description for the alarm. Then choose Next. The name must contain only UTF-8 characters, and can't contain ASCII control characters. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 15. Under Preview and create, confirm that the information and conditions are what you want, then choose Create alarm. Create a CPU usage alarm 505 Amazon CloudWatch User Guide Setting up a CPU usage alarm using the AWS CLI Use these steps to use the AWS CLI to create a CPU usage alarm. To create an alarm based on CPU usage 1. Set up an SNS topic. For more information, see Setting up Amazon SNS notifications. 2. Create an alarm using the put-metric-alarm command as follows. aws cloudwatch put-metric-alarm --alarm-name cpu-mon --alarm-description "Alarm when CPU exceeds 70%" --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 70 --comparison-operator GreaterThanThreshold -- dimensions Name=InstanceId,Value=i-12345678 --evaluation-periods 2 --alarm-actions arn:aws:sns:us-east-1:111122223333:my-topic --unit Percent 3. Test the alarm by forcing an alarm state change using the set-alarm-state command. a. Change the alarm state from INSUFFICIENT_DATA to OK. aws cloudwatch set-alarm-state --alarm-name cpu-mon --state-reason "initializing" --state-value OK b. Change the alarm state from OK to ALARM. aws cloudwatch set-alarm-state --alarm-name cpu-mon --state-reason "initializing" --state-value ALARM c. Check that you have received a notification about the alarm. Create a load balancer latency alarm that sends email You can set up an Amazon SNS notification and configure an alarm that monitors latency exceeding 100 ms for your Classic Load Balancer. Setting up a latency alarm using the AWS Management Console Use these steps to use the AWS Management Console to create a load balancer latency alarm. To create a load balancer latency alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. Create a load balancer latency alarm 506 Amazon CloudWatch User Guide 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose Create alarm. 4. Under CloudWatch Metrics by Category, choose the |
acw-ug-178 | acw-ug.pdf | 178 | latency alarm that sends email You can set up an Amazon SNS notification and configure an alarm that monitors latency exceeding 100 ms for your Classic Load Balancer. Setting up a latency alarm using the AWS Management Console Use these steps to use the AWS Management Console to create a load balancer latency alarm. To create a load balancer latency alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. Create a load balancer latency alarm 506 Amazon CloudWatch User Guide 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose Create alarm. 4. Under CloudWatch Metrics by Category, choose the ELB Metrics category. 5. 6. Select the row with the Classic Load Balancer and the Latency metric. For the statistic, choose Average, choose one of the predefined percentiles, or specify a custom percentile (for example, p95.45). 7. For the period, choose 1 Minute. 8. Choose Next. 9. Under Alarm Threshold, enter a unique name for the alarm (for example, myHighCpuAlarm) and a description of the alarm (for example, Alarm when Latency exceeds 100s). Alarm names must contain only UTF-8 characters, and can't contain ASCII control characters The name must contain only UTF-8 characters, and can't contain ASCII control characters. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 10. Under Whenever, for is, choose > and enter 0.1. For for, enter 3. 11. Under Additional settings, for Treat missing data as, choose ignore (maintain alarm state) so that missing data points don't trigger alarm state changes. For Percentiles with low samples, choose ignore (maintain the alarm state) so that the alarm evaluates only situations with adequate numbers of data samples. 12. Under Actions, for Whenever this alarm, choose State is ALARM. For Send notification to, choose an existing SNS topic or create a new one. To create an SNS topic, choose New list. For Send notification to, enter a name for the SNS topic (for example, myHighCpuAlarm), and for Email list, enter a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent. 13. Choose Create Alarm. Setting up a latency alarm using the AWS CLI Use these steps to use the AWS CLI to create a load balancer latency alarm. Create a load balancer latency alarm 507 Amazon CloudWatch User Guide To create a load balancer latency alarm 1. Set up an SNS topic. For more information, see Setting up Amazon SNS notifications. 2. Create the alarm using the put-metric-alarm command as follows: aws cloudwatch put-metric-alarm --alarm-name lb-mon --alarm-description "Alarm when Latency exceeds 100s" --metric-name Latency --namespace AWS/ELB --statistic Average --period 60 --threshold 100 --comparison-operator GreaterThanThreshold -- dimensions Name=LoadBalancerName,Value=my-server --evaluation-periods 3 --alarm- actions arn:aws:sns:us-east-1:111122223333:my-topic --unit Seconds 3. Test the alarm by forcing an alarm state change using the set-alarm-state command. a. Change the alarm state from INSUFFICIENT_DATA to OK. aws cloudwatch set-alarm-state --alarm-name lb-mon --state-reason "initializing" --state-value OK b. Change the alarm state from OK to ALARM. aws cloudwatch set-alarm-state --alarm-name lb-mon --state-reason "initializing" --state-value ALARM c. Check that you have received an email notification about the alarm. Create a storage throughput alarm that sends email You can set up an SNS notification and configure an alarm that is triggered when Amazon EBS exceeds 100 MB throughput. Setting up a storage throughput alarm using the AWS Management Console Use these steps to use the AWS Management Console to create an alarm based on Amazon EBS throughput. To create a storage throughput alarm 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All Alarms. 3. Choose Create alarm. Create a storage throughput alarm 508 Amazon CloudWatch User Guide 4. Under EBS Metrics, choose a metric category. 5. 6. Select the row with the volume and the VolumeWriteBytes metric. For the statistic, choose Average. For the period, choose 5 Minutes. Choose Next. 7. Under Alarm Threshold, enter a unique name for the alarm (for example, myHighWriteAlarm) and a description of the alarm (for example, VolumeWriteBytes exceeds 100,000 KiB/s). The name must contain only UTF-8 characters, and can't contain ASCII control characters. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 8. Under Whenever, for is, choose > and enter 100000. For for, enter 15 consecutive periods. A graphical representation of the threshold is shown under Alarm Preview. 9. Under Additional settings, for Treat missing data as, choose ignore (maintain alarm state) so that missing data points don't trigger alarm state changes. 10. |
acw-ug-179 | acw-ug.pdf | 179 | 100,000 KiB/s). The name must contain only UTF-8 characters, and can't contain ASCII control characters. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 8. Under Whenever, for is, choose > and enter 100000. For for, enter 15 consecutive periods. A graphical representation of the threshold is shown under Alarm Preview. 9. Under Additional settings, for Treat missing data as, choose ignore (maintain alarm state) so that missing data points don't trigger alarm state changes. 10. Under Actions, for Whenever this alarm, choose State is ALARM. For Send notification to, choose an existing SNS topic or create one. To create an SNS topic, choose New list. For Send notification to, enter a name for the SNS topic (for example, myHighCpuAlarm), and for Email list, enter a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent to an email address. 11. Choose Create Alarm. Setting up a storage throughput alarm using the AWS CLI Use these steps to use the AWS CLI to create an alarm based on Amazon EBS throughput. To create a storage throughput alarm 1. Create an SNS topic. For more information, see Setting up Amazon SNS notifications. 2. Create the alarm. aws cloudwatch put-metric-alarm --alarm-name ebs-mon --alarm-description "Alarm when EBS volume exceeds 100MB throughput" --metric-name VolumeReadBytes -- namespace AWS/EBS --statistic Average --period 300 --threshold 100000000 -- comparison-operator GreaterThanThreshold --dimensions Name=VolumeId,Value=my- Create a storage throughput alarm 509 Amazon CloudWatch User Guide volume-id --evaluation-periods 3 --alarm-actions arn:aws:sns:us- east-1:111122223333:my-alarm-topic --insufficient-data-actions arn:aws:sns:us- east-1:111122223333:my-insufficient-data-topic 3. Test the alarm by forcing an alarm state change using the set-alarm-state command. a. Change the alarm state from INSUFFICIENT_DATA to OK. aws cloudwatch set-alarm-state --alarm-name ebs-mon --state-reason "initializing" --state-value OK b. Change the alarm state from OK to ALARM. aws cloudwatch set-alarm-state --alarm-name ebs-mon --state-reason "initializing" --state-value ALARM c. Change the alarm state from ALARM to INSUFFICIENT_DATA. aws cloudwatch set-alarm-state --alarm-name ebs-mon --state-reason "initializing" --state-value INSUFFICIENT_DATA d. Check that you have received an email notification about the alarm. Create an alarm on Performance Insights counter metrics from an AWS database CloudWatch includes a DB_PERF_INSIGHTS metric math function which you can use to bring Performance Insights counter metrics into CloudWatch from Amazon Relational Database Service and Amazon DocumentDB (with MongoDB compatibility). DB_PERF_INSIGHTS also brings in the DBLoad metric at sub-minute intervals. You can set CloudWatch alarms on these metrics. For more information about Amazon RDS Performance Insights, see Monitoring DB load with Performance Insights on Amazon RDS. For more information about Amazon DocumentDB Performance Insights, see Monitoring with Performance Insights. Anomaly detection is not supported for alarms based on the DB_PERF_INSIGHTS function. Create an alarm on Performance Insights counter metrics from an AWS database 510 Amazon CloudWatch Note User Guide High-resolution metrics with sub-minute granularity retrieved by DB_PERF_INSIGHTS are only applicable to the DBLoad metric, or for operating system metrics if you have enabled Enhanced Monitoring at a higher resolution. For more information about Amazon RDS enhanced monitoring, see Monitoring OS metrics with Enhanced Monitoring.. You can create a high-resolution alarm using the DB_PERF_INSIGHTS function. The maximum evaluation range for a high-resolution alarm is three hours. You can use the CloudWatch console to graph metrics retrieved with the DB_PERF_INSIGHTS function for any time range. To create an alarm that's based on Performance Insights metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, and then choose All alarms. 3. Choose Create alarm. 4. Choose Select Metric. 5. Choose the Add math dropdown, and then select All functions, DB_PERF_INSIGHTS from the list. After you choose DB_PERF_INSIGHTS, a math expression box appears where you apply or edit math expressions. 6. In the math expression box, enter your DB_PERF_INSIGHTS math expression, and then choose Apply. For example, DB_PERF_INSIGHTS(‘RDS’, ‘db-ABCDEFGHIJKLMNOPQRSTUVWXY1’, ‘os.cpuUtilization.user.avg’) Important When you use the DB_PERF_INSIGHTS math expression, you must specify the Unique Database Resource ID of the database. This is different than the database identifier. To find the database resource ID in the Amazon RDS console, choose the DB instance to see its details. Then choose the Configuration tab. The Resource ID is displayed in the Configuration section. Create an alarm on Performance Insights counter metrics from an AWS database 511 Amazon CloudWatch User Guide For information about the DB_PERF_INSIGHTS function and other functions that are available for metric math, see Metric math syntax and functions. 7. Choose Select metric. The Specify metric and conditions page appears, showing a graph and other information about the math expression that you have selected. 8. For Whenever expression is, specify whether the expression must be greater |
acw-ug-180 | acw-ug.pdf | 180 | Amazon RDS console, choose the DB instance to see its details. Then choose the Configuration tab. The Resource ID is displayed in the Configuration section. Create an alarm on Performance Insights counter metrics from an AWS database 511 Amazon CloudWatch User Guide For information about the DB_PERF_INSIGHTS function and other functions that are available for metric math, see Metric math syntax and functions. 7. Choose Select metric. The Specify metric and conditions page appears, showing a graph and other information about the math expression that you have selected. 8. For Whenever expression is, specify whether the expression must be greater than, less than, or equal to the threshold. Under than..., specify the threshold value. 9. Choose Additional configuration. For Datapoints to alarm, specify how many evaluation periods (data points) must be in the ALARM state to trigger the alarm. If the two values here match, you create an alarm that goes to ALARM state if that many consecutive periods are breaching. To create an M out of N alarm, specify a lower number for the first value than you specify for the second value. For more information, see Evaluating an alarm. 10. For Missing data treatment, choose how to have the alarm behave when some data points are missing. For more information, see Configuring how CloudWatch alarms treat missing data. 11. Choose Next. 12. Under Notification, select an SNS topic to notify when the alarm is in ALARM state, OK state, or INSUFFICIENT_DATA state. To have the alarm send multiple notifications for the same alarm state or for different alarm states, choose Add notification. To have the alarm not send notifications, choose Remove. 13. To have the alarm perform Auto Scaling, EC2, Lambda, or Systems Manager actions, choose the appropriate button and choose the alarm state and action to perform. If you choose a Lambda function as an alarm action, you specify the function name or ARN, and you can optionally choose a specific version of the function. Alarms can perform Systems Manager actions only when they go into ALARM state. For more information about Systems Manager actions, see see Configuring CloudWatch to create OpsItems from alarms and Incident creation. Create an alarm on Performance Insights counter metrics from an AWS database 512 Amazon CloudWatch Note User Guide To create an alarm that performs an SSM Incident Manager action, you must have certain permissions. For more information, see Identity-based policy examples for AWS Systems Manager Incident Manager. 14. When finished, choose Next. 15. Enter a name and description for the alarm. Then choose Next. The name must contain only UTF-8 characters, and can't contain ASCII control characters. The description can include markdown formatting, which is displayed only in the alarm Details tab in the CloudWatch console. The markdown can be useful to add links to runbooks or other internal resources. 16. Under Preview and create, confirm that the information and conditions are what you want, then choose Create alarm. Create alarms to stop, terminate, reboot, or recover an EC2 instance Using Amazon CloudWatch alarm actions, you can create alarms that automatically stop, terminate, reboot, or recover your EC2 instances. You can use the stop or terminate actions to help you save money when you no longer need an instance to be running. You can use the reboot and recover actions to automatically reboot those instances or recover them onto new hardware if a system impairment occurs. There are a number of scenarios in which you might want to automatically stop or terminate your instance. For example, you might have instances dedicated to batch payroll processing jobs or scientific computing tasks that run for a period of time and then complete their work. Rather than letting those instances sit idle (and accrue charges), you can stop or terminate them, which helps you to save money. The main difference between using the stop and the terminate alarm actions is that you can easily restart a stopped instance if you need to run it again later. You can also keep the same instance ID and root volume. However, you cannot restart a terminated instance. Instead, you must launch a new instance. You can add the stop, terminate, or reboot, actions to any alarm that is set on an Amazon EC2 per- instance metric, including basic and detailed monitoring metrics provided by Amazon CloudWatch (in the AWS/EC2 namespace), in addition to any custom metrics that include the "InstanceId=" Create alarms to stop, terminate, reboot, or recover an EC2 instance 513 Amazon CloudWatch User Guide dimension, as long as the InstanceId value refers to a valid running Amazon EC2 instance. You can also add the recover action to alarms that is set on any Amazon EC2 per-instance metric except for StatusCheckFailed_Instance. Important Alarms configured on Amazon EC2 metrics can temporarily enter the INSUFFICIENT_DATA state if |
acw-ug-181 | acw-ug.pdf | 181 | that is set on an Amazon EC2 per- instance metric, including basic and detailed monitoring metrics provided by Amazon CloudWatch (in the AWS/EC2 namespace), in addition to any custom metrics that include the "InstanceId=" Create alarms to stop, terminate, reboot, or recover an EC2 instance 513 Amazon CloudWatch User Guide dimension, as long as the InstanceId value refers to a valid running Amazon EC2 instance. You can also add the recover action to alarms that is set on any Amazon EC2 per-instance metric except for StatusCheckFailed_Instance. Important Alarms configured on Amazon EC2 metrics can temporarily enter the INSUFFICIENT_DATA state if there are missing metric data points. This is rare, but can happen when the metric reporting is interrupted, even when the Amazon EC2 instance is healthy. For alarms on Amazon EC2 metrics that are configured to take stop, terminate, reboot, or recover actions, we recommend that you configure those alarms to treat missing data as missing, and to have these alarms trigger only when in the ALARM state. For more information about how you can configure CloudWatch to act on missing metrics that have alarms set on them, see Configuring how CloudWatch alarms treat missing data. To set up a CloudWatch alarm action that can reboot, stop, or terminate an instance, you must use a service-linked IAM role, AWSServiceRoleForCloudWatchEvents. The AWSServiceRoleForCloudWatchEvents IAM role enables AWS to perform alarm actions on your behalf. To create the service-linked role for CloudWatch Events, use the following command: aws iam create-service-linked-role --aws-service-name events.amazonaws.com Console support You can create alarms using the CloudWatch console or the Amazon EC2 console. The procedures in this documentation use the CloudWatch console. For procedures that use the Amazon EC2 console, see Create alarms that stop, terminate, reboot, or rcover an instance in the Amazon EC2 User Guide. Permissions If you are using an AWS Identity and Access Management (IAM) account to create or modify an alarm that performs EC2 actions or Systems Manager OpsItem actions, you must have the iam:CreateServiceLinkedRole permission. Contents Create alarms to stop, terminate, reboot, or recover an EC2 instance 514 Amazon CloudWatch User Guide • Adding stop actions to Amazon CloudWatch alarms • Adding terminate actions to Amazon CloudWatch alarms • Adding reboot actions to Amazon CloudWatch alarms • Adding recover actions to Amazon CloudWatch alarms • Viewing the history of triggered alarms and actions Adding stop actions to Amazon CloudWatch alarms You can create an alarm that stops an Amazon EC2 instance when a certain threshold has been met. For example, you may run development or test instances and occasionally forget to shut them off. You can create an alarm that is triggered when the average CPU utilization percentage has been lower than 10 percent for 24 hours, signaling that it is idle and no longer in use. You can adjust the threshold, duration, and period to suit your needs, plus you can add an SNS notification, so that you will receive an email when the alarm is triggered. Amazon EC2 instances that use an Amazon Elastic Block Store volume as the root device can be stopped or terminated, whereas instances that use the instance store as the root device can only be terminated. To create an alarm to stop an idle instance using the Amazon CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All alarms. 3. Choose Create alarm. 4. Choose Select Metric. 5. For AWS namespaces, choose EC2. 6. Do the following: a. b. c. d. e. f. Choose Per-Instance Metrics. Select the check box in the row with the correct instance and the CPUUtilization metric. Choose the Graphed metrics tab. For the statistic, choose Average. Choose a period (for example, 1 Hour). Choose Select metric. 7. Under Conditions, do the following: Create alarms to stop, terminate, reboot, or recover an EC2 instance 515 Amazon CloudWatch a. Choose Static. b. Under Whenever CPUUtilization is, choose Lower. c. For than, type 10. d. Choose Next. User Guide e. Under Notification, for Send notification to, choose an existing SNS topic or create a new one. To create an SNS topic, choose New list. For Send notification to, type a name for the SNS topic (for example, Stop_EC2_Instance). For Email list, type a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent to an email address. Choose Add EC2 Action. For Alarm state trigger, choose In alarm. For Take the following action, choose Stop this instance. f. g. h. Choose Next. i. j. Enter a name and description for the alarm. The name must contain only ASCII characters. Then choose Next. Under Preview and create, confirm that the information and |
acw-ug-182 | acw-ug.pdf | 182 | Stop_EC2_Instance). For Email list, type a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent to an email address. Choose Add EC2 Action. For Alarm state trigger, choose In alarm. For Take the following action, choose Stop this instance. f. g. h. Choose Next. i. j. Enter a name and description for the alarm. The name must contain only ASCII characters. Then choose Next. Under Preview and create, confirm that the information and conditions are what you want, then choose Create alarm. Adding terminate actions to Amazon CloudWatch alarms You can create an alarm that terminates an EC2 instance automatically when a certain threshold has been met (as long as termination protection is not enabled for the instance). For example, you might want to terminate an instance when it has completed its work, and you don't need the instance again. If you might want to use the instance later, you should stop the instance instead of terminating it. For information about enabling and disabling termination protection for an instance, see Enabling Termination Protection for an Instance in the Amazon EC2 User Guide. To create an alarm to terminate an idle instance using the Amazon CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Alarms, Create Alarm. For the Select Metric step, do the following: Create alarms to stop, terminate, reboot, or recover an EC2 instance 516 Amazon CloudWatch User Guide a. Under EC2 Metrics, choose Per-Instance Metrics. b. c. Select the row with the instance and the CPUUtilization metric. For the statistic, choose Average. d. Choose a period (for example, 1 Hour). e. Choose Next. 4. For the Define Alarm step, do the following: a. Under Alarm Threshold, type a unique name for the alarm (for example, Terminate EC2 instance) and a description of the alarm (for example, Terminate EC2 instance when CPU is idle for too long). Alarm names must contain only ASCII characters. b. Under Whenever, for is, choose < and type 10. For for, type 24 consecutive periods. A graphical representation of the threshold is shown under Alarm Preview. c. Under Notification, for Send notification to, choose an existing SNS topic or create a new one. To create an SNS topic, choose New list. For Send notification to, type a name for the SNS topic (for example, Terminate_EC2_Instance). For Email list, type a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent to an email address. d. Choose EC2 Action. e. For Whenever this alarm, choose State is ALARM. For Take this action, choose Terminate this instance. f. Choose Create Alarm. Adding reboot actions to Amazon CloudWatch alarms You can create an Amazon CloudWatch alarm that monitors an Amazon EC2 instance and automatically reboots the instance. The reboot alarm action is recommended for Instance Health Check failures (as opposed to the recover alarm action, which is suited for System Health Check failures). An instance reboot is equivalent to an operating system reboot. In most cases, it takes only a few minutes to reboot your instance. When you reboot an instance, it remains on the same physical host, so your instance keeps its public DNS name, private IP address, and any data on its instance store volumes. Create alarms to stop, terminate, reboot, or recover an EC2 instance 517 Amazon CloudWatch User Guide Rebooting an instance doesn't start a new instance billing hour, unlike stopping and restarting your instance. For more information about rebooting an instance, see Reboot Your Instance in the Amazon EC2 User Guide. Important To avoid a race condition between the reboot and recover actions, avoid setting the same evaluation period for both a reboot alarm and a recover alarm. We recommend that you set reboot alarms to three evaluation periods of one minute each. To create an alarm to reboot an instance using the Amazon CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Alarms, Create Alarm. For the Select Metric step, do the following: a. Under EC2 Metrics, choose Per-Instance Metrics. b. c. Select the row with the instance and the StatusCheckFailed_Instance metric. For the statistic, choose Minimum. d. Choose a period (for example, 1 Minute). e. Choose Next. 4. For the Define Alarm step, do the following: a. Under Alarm Threshold, type a unique name for the alarm (for example, Reboot EC2 instance) and a description of the alarm (for example, Reboot EC2 instance when health checks fail). Alarm names must contain only ASCII |
acw-ug-183 | acw-ug.pdf | 183 | https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Alarms, Create Alarm. For the Select Metric step, do the following: a. Under EC2 Metrics, choose Per-Instance Metrics. b. c. Select the row with the instance and the StatusCheckFailed_Instance metric. For the statistic, choose Minimum. d. Choose a period (for example, 1 Minute). e. Choose Next. 4. For the Define Alarm step, do the following: a. Under Alarm Threshold, type a unique name for the alarm (for example, Reboot EC2 instance) and a description of the alarm (for example, Reboot EC2 instance when health checks fail). Alarm names must contain only ASCII characters. b. Under Whenever, for is, choose > and type 0. For for, type 3 consecutive periods. A graphical representation of the threshold is shown under Alarm Preview. c. Under Notification, for Send notification to, choose an existing SNS topic or create a new one. To create an SNS topic, choose New list. For Send notification to, type a name for the SNS topic (for example, Reboot_EC2_Instance). For Email list, type a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each Create alarms to stop, terminate, reboot, or recover an EC2 instance 518 Amazon CloudWatch User Guide email address is sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent to an email address. d. Choose EC2 Action. e. For Whenever this alarm, choose State is ALARM. For Take this action, choose Reboot this instance. f. Choose Create Alarm. Adding recover actions to Amazon CloudWatch alarms You can create an Amazon CloudWatch alarm that monitors an Amazon EC2 instance and automatically recovers the instance if it becomes impaired due to an underlying hardware failure or a problem that requires AWS involvement to repair. Terminated instances cannot be recovered. A recovered instance is identical to the original instance, including the instance ID, private IP addresses, Elastic IP addresses, and all instance metadata. When the StatusCheckFailed_System alarm is triggered, and the recover action is initiated, you will be notified by the Amazon SNS topic that you chose when you created the alarm and associated the recover action. During instance recovery, the instance is migrated during an instance reboot, and any data that is in-memory is lost. When the process is complete, information is published to the SNS topic you've configured for the alarm. Anyone who is subscribed to this SNS topic will receive an email notification that includes the status of the recovery attempt and any further instructions. You will notice an instance reboot on the recovered instance. The recover action can be used only with StatusCheckFailed_System, not with StatusCheckFailed_Instance. Examples of problems that cause system status checks to fail include: • Loss of network connectivity • Loss of system power • Software issues on the physical host • Hardware issues on the physical host that impact network reachability The recover action is supported only on some instance types. For more information about supported instance types and other requirements, see Recover your instance and Requirements. Create alarms to stop, terminate, reboot, or recover an EC2 instance 519 Amazon CloudWatch Important User Guide To avoid a race condition between the reboot and recover actions, avoid setting the same evaluation period for both a reboot alarm and a recover alarm. We recommend that you set recover alarms to two evaluation periods of one minute each and reboot alarms to three evaluation periods of one minute each. To create an alarm to recover an instance using the Amazon CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Alarms, All alarms. 3. Choose Create Alarm. 4. Choose Select Metric and then do the following: a. b. Choose EC2 Metrics, Per-Instance Metrics. Select the row with the instance and the StatusCheckFailed_System metric, and then choose Select metric. c. For the statistic, choose Minimum. d. Choose a period (for example, 1 Minute). Important To avoid a race condition between the reboot and recover actions, avoid setting the same evaluation period for both a reboot alarm and a recover alarm. We recommend that you set recover alarms to two evaluation periods of one minute each. 5. For Conditions, do the following: a. Under Threshold type, choose Static. b. Under Whenever, choose Greater and enter 0 for than.... c. Choose Additional configuration, then for Datapoints to alarm specify 2 out of 2. 6. Choose Next. 7. Under Notification, do the following: Create alarms to stop, terminate, reboot, or recover an EC2 instance 520 Amazon CloudWatch User Guide a. b. c. d. e. f. For Alarm state trigger, choose In alarm. For Send notification to the following SNS topic, choose an existing SNS topic or create a new one. Choose Add EC2 Action. For Alarm state trigger, choose In alarm. For |
acw-ug-184 | acw-ug.pdf | 184 | the following: a. Under Threshold type, choose Static. b. Under Whenever, choose Greater and enter 0 for than.... c. Choose Additional configuration, then for Datapoints to alarm specify 2 out of 2. 6. Choose Next. 7. Under Notification, do the following: Create alarms to stop, terminate, reboot, or recover an EC2 instance 520 Amazon CloudWatch User Guide a. b. c. d. e. f. For Alarm state trigger, choose In alarm. For Send notification to the following SNS topic, choose an existing SNS topic or create a new one. Choose Add EC2 Action. For Alarm state trigger, choose In alarm. For Take the following action, choose Recover this instance. Choose Next. 8. For Alarm name, type a unique name for the alarm (for example, Recover EC2 instance) and a description of the alarm (for example, Recover EC2 instance when health checks fail). Alarm names must contain only ASCII characters. 9. Choose Next. 10. Choose Create Alarm. Viewing the history of triggered alarms and actions You can view alarm and action history in the Amazon CloudWatch console. Amazon CloudWatch keeps the last 30 days of alarm and action history. To view the history of triggered alarms and actions 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. 4. In the navigation pane, choose Alarms and select an alarm. To view the most recent state transition along with the time and metric values, choose Details. To view the most recent history entries, choose History. Alarms and tagging Tags are key-value pairs that can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values. For more general information about tagging resources, see Tagging your AWS resources The following list explains some details about how tagging works with CloudWatch alarms. Alarms and tagging 521 Amazon CloudWatch User Guide • To be able to set or update tags for a CloudWatch resource, you must be signed on to an account that has the cloudwatch:TagResource permission. For example, to create an alarm and set tags for it, you must have the cloudwatch:TagResource permission in addition to the the cloudwatch:PutMetricAlarm permission. We recommend that you make sure anyone in your organization who will create or update CloudWatch resources has the cloudwatch:TagResource permission. • Tags can be used for tag-based authorization control. For example, IAM user or role permissions can include conditions to limit CloudWatch calls to specific resources based on their tags. However, keep in mind the following • Tags with names that start with aws: can't be used for tag-based authorization control. • Composite alarms do not support tag-based authorization control. Alarms and tagging 522 Amazon CloudWatch User Guide Auditing CloudWatch telemetry configurations You can use Amazon CloudWatch to discover and understand the state of telemetry configuration for your AWS resources from a central view in the CloudWatch console. This simplifies the process of auditing your telemetry collection configurations across multiple resource types within an account or across multiple accounts in Organizations. With a consolidated view, you can easily review and manage telemetry settings, helping you to ensure proper monitoring and data collection across your AWS environment. CloudWatch can help you identify telemetry configuration for the following types of AWS resource types: • Amazon EC2 instances that provide detailed metrics. For more information, see Manage detailed monitoring for your EC2 instances in the Amazon EC2 User Guide. • Amazon VPC virtual networks that provide flow logs. For more information, see Logging IP traffic using VPC Flow Logs in the Amazon VPC User Guide. • Lambda functions that provide traces. For more information, see Visualize Lambda function invocations using AWS X-Ray in the AWS X-Ray Developer Guide. To begin auditing your telemetry configurations, you must first turn on the telemetry auditing experience for your AWS account or organization. Enabling this feature creates AWS Config service- linked configuration recorders that discover resources and their associated telemetry configuration metadata. For more information, see Configuration Recorder in the AWS Config Developer Guide. Note AWS Config periodically takes inventory of, or discovers, all the resources in your account as an anti-entropy behavior, regardless of the resource types in scope for your configuration recorders. The inventory includes deleted resources and resources that AWS Config is not currently recording. This behavior helps maintain data consistency. This means that although the service-linked configuration recorder for the CloudWatch telemetry auditing feature is configured to record three resource types (Amazon EC2 instances, Amazon EC2 VPC virtual networks, and Lambda functions), you might see describe calls from ConfigResourceCompositionSession and AWSConfig-Describe in AWS CloudTrail. For more information, see Non-recorded Resources in the AWS Config Developer Guide. 523 Amazon CloudWatch User Guide The telemetry auditing experience uses this information and offers visibility into the configuration status, at the resource |
acw-ug-185 | acw-ug.pdf | 185 | configuration recorders. The inventory includes deleted resources and resources that AWS Config is not currently recording. This behavior helps maintain data consistency. This means that although the service-linked configuration recorder for the CloudWatch telemetry auditing feature is configured to record three resource types (Amazon EC2 instances, Amazon EC2 VPC virtual networks, and Lambda functions), you might see describe calls from ConfigResourceCompositionSession and AWSConfig-Describe in AWS CloudTrail. For more information, see Non-recorded Resources in the AWS Config Developer Guide. 523 Amazon CloudWatch User Guide The telemetry auditing experience uses this information and offers visibility into the configuration status, at the resource type level and at more granular telemetry detail levels. You can customize your view of the resources or telemetry details using filters, and modify the telemetry configuration directly from the resource's console page. Turning on the telemetry auditing experience does not incur any additional costs. Topics • Turning on CloudWatch telemetry auditing • Viewing AWS resource telemetry in CloudWatch • Turning off CloudWatch telemetry auditing Turning on CloudWatch telemetry auditing Use the CloudWatch console to turn on telemetry auditing for your AWS account or organization. For an organization, CloudWatch uses a management account or a delegated administrator account to discover AWS resources and the telemetry configurations for all of the member accounts in the organization. Turning on the telemetry auditing experience does not incur any additional cost. Telemetry auditing remains on until you turn it off. For more information, see Turning off CloudWatch telemetry auditing. Topics • Auditing telemetry configurations for your organization • Turning on telemetry auditing for your account • Deregistering a delegated administrator account • Turning off trusted access for Organizations Auditing telemetry configurations for your organization To turn on telemetry configuration for your organization, you must use a management account or a delegated administrator account. CloudWatch uses this account to discover your organization's AWS resources and their telemetry configurations. Before you can turn on telemetry auditing for your organization, you need to turn on trusted access between AWS Organizations and CloudWatch. When you turn on trusted access, CloudWatch Turning on telemetry auditing 524 Amazon CloudWatch User Guide creates a service-linked role named AWSServiceRoleForObservabilityAdmin to support resource and telemetry configuration discovery for the organization. The role is created in all member accounts of the organization. For more information about the service-linked role, see Service- linked role permissions for CloudWatch telemetry config. For more information about AWS Organizations, see Amazon CloudWatch and AWS Organizations in the AWS Organizations User Guide. To use a management account for telemetry configuration, log in with the account, turn on trusted access, and then turn on telemetry auditing. For more information, see Turning on telemetry auditing for your AWS Organizations. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pain, choose Settings. 3. Choose the Organizations tab. 4. 5. In Organizational Management Settings, choose Turn on. The Enable trusted access page appears. To review the role policy, choose View permission details and the role policy appears in a window. Choose Enable trusted access. The telemetry configuration Overview page appears and CloudWatch begins discovering AWS resources in the organization. As CloudWatch discovers resources, it updates information on the Overview page. Note The time delay before resources appear on the Overview page depends on the number of member accounts and resources in your organization or account. Registering a delegated administrator account for your organization A delegated administrator account is a member account that shares administrator access for service-managed permissions. The account that you register as a delegated administrator must be in your organization. A delegated administrator account for your organization can be used outside of CloudWatch, so make sure that you understand this account type before you follow this procedure. For more information, see Amazon CloudWatch and AWS Organizations in the AWS Organizations User Guide. To remove or change the delegated administrator account, deregister the account first. For more information, see Deregistering a delegated administrator account. Auditing telemetry configurations for your organization 525 Amazon CloudWatch User Guide To register a delegated administrator account 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Settings. 3. Choose the Organization tab. 4. Choose Register delegated administrator. 5. On the Register delegated administrator page, for Delegated administrator account ID, enter the 12-digit account ID for an organization member. 6. Choose Register delegated administrator. At the top of the page, a message appears indicating the account was registered successfully. The Organization Settings page appears. To see information about the delegated administrator account, hover over the number below Delegated administrators. Turning on telemetry auditing for your AWS Organizations Turn on telemetry auditing for your AWS Organizations to monitor the telemetry for the AWS resources across all your member accounts. This also turns on the telemetry auditing experience for individual accounts. You can also turn on |
acw-ug-186 | acw-ug.pdf | 186 | page, for Delegated administrator account ID, enter the 12-digit account ID for an organization member. 6. Choose Register delegated administrator. At the top of the page, a message appears indicating the account was registered successfully. The Organization Settings page appears. To see information about the delegated administrator account, hover over the number below Delegated administrators. Turning on telemetry auditing for your AWS Organizations Turn on telemetry auditing for your AWS Organizations to monitor the telemetry for the AWS resources across all your member accounts. This also turns on the telemetry auditing experience for individual accounts. You can also turn on the telemetry auditing experience for only your account. For more information, see Turning on telemetry auditing for your account. You can turn off trusted access across all your member accounts. For more information, see Turning off trusted access for Organizations. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Telemetry config. 3. Choose Turn on, and then choose the Organization tab. The telemetry config Overview page appears and CloudWatch begins discovering AWS resources in your account. As CloudWatch discovers resources, it updates information in the Overview page. Note The delay before resources appear on the Overview page depends on the number of member accounts and resources in your organization or account. Auditing telemetry configurations for your organization 526 Amazon CloudWatch User Guide Turning on telemetry auditing for your account Turn on telemetry auditing for your AWS account to monitor telemetry for the AWS resources in that account. If you have an organization in AWS Organizations, turn on telemetry configuration for your organization instead. For more information, see Turning on telemetry auditing for your AWS Organizations. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Settings, Telemetry config. 3. Choose Turn on, then This account, if you are using a management account or a delegated administrator account. The telemetry configuration Overview page appears and CloudWatch begins discovering AWS resources in your account. As CloudWatch discovers resources, it updates information on the Overview page. Note The delay before resources appear on the Overview page depends on the number of member accounts and resources in your organization or account. Deregistering a delegated administrator account Deregister the delegated administrator account before turning off trusted access for Organizations. You can also deregister a delegated administrator account if it no longer has access to the appropriate AWS resources for telemetry auditing or to choose a different member account to be the delegated administrator. This account will not be able to perform account management tasks for Organizations. For more information, see Amazon CloudWatch and AWS Organizations in the AWS Organizations User Guide. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Settings. 3. On the Organization tab, choose Deregister. 4. On the Deregister delegated administrator page, choose Deregister. To register an account as a delegated administrator, see Registering a delegated administrator account for your organization. Turning on telemetry auditing for your account 527 Amazon CloudWatch User Guide Turning off trusted access for Organizations Trusted access extends the functionality of the management account in AWS Organizations to other AWS services. When you turn off trusted access, trusted access between your organization and all AWS services—not just CloudWatch—will stop. If you no longer want trusted access turned on for your organization, you can turn it off. For more information, see Amazon CloudWatch and AWS Organizations in the AWS Organizations User Guide. Note Before turning off trusted access for an organization, deregister the delegated administrator account. For more information, see Deregistering a delegated administrator account. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Settings. 3. Choose the Organization tab. 4. In the Organizational Management Settings section, select Turn off. Viewing AWS resource telemetry in CloudWatch Telemetry configuration displays AWS resources in two places: As an overview, on the Telemetry config page and in detail, on the Discovered resources page. • Telemetry config – This page shows the percentage of resources with telemetry that are configured for each resource type and the number of resources detected as providing metrics, as well as the total number of resources in your account or organization. You can filter the display of resources in the Telemetry config page by account ID or by the tags applied to your resources. • Discovered resources – This page shows details about each resource that has been discovered by telemetry configuration, including the resource ID, the type of telemetry each resource is providing, and the time when information about the resource was last refreshed by telemetry configuration. You can filter the display of resource on the Discovered resources page by any of the information provided about the resource. Turning off trusted access for Organizations 528 Amazon CloudWatch User Guide For each AWS |
acw-ug-187 | acw-ug.pdf | 187 | filter the display of resources in the Telemetry config page by account ID or by the tags applied to your resources. • Discovered resources – This page shows details about each resource that has been discovered by telemetry configuration, including the resource ID, the type of telemetry each resource is providing, and the time when information about the resource was last refreshed by telemetry configuration. You can filter the display of resource on the Discovered resources page by any of the information provided about the resource. Turning off trusted access for Organizations 528 Amazon CloudWatch User Guide For each AWS resource tracked by telemetry configuration, the Discovered resources page shows the status of its telemetry by providing the following information: • For telemetry types that CloudWatch detects that the resource is providing, the Discovered resources page shows On. • For telemetry types that CloudWatch detects the resource is not providing, the Discovered resources page shows Off. • For telemetry types that are not supported for a resource, the Discovered resources page shows NS, that is, not supported. To view resources on the Telemetry config page 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Telemetry config. The Telemetry config page shows the total number of each resource that was discovered by telemetry config, the number of resources providing telemetry, and the percentage of discovered resources that are providing telemetry. 4. To see recent changes to resources, choose Refresh. To view resources on the Discovered resources page 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Telemetry config. 3. Do one of the following to view all resource types discovered by telemetry configuration or to view one resource type: a. b. To view all resources that have been discovered by telemetry configuration, choose View resources. The Discovered resources page appears and shows all resources discovered by telemetry configuration. To view one resource type, at the bottom of the page, choose a type of AWS resource. The Discovered resources page appears. The Discovered resources page shows all discovered resources for that resource type. 4. On the Discovered resources page, do one or more of the following: Viewing resources 529 Amazon CloudWatch User Guide • To view information about the resource or to change its telemetry settings, choose a resource ID. The console page for the resource appears. Note You can only view a resource on its console page if the resource belongs to your account. To determine if the resource belongs to your account, check the AWS account column. If the AWS account column does not appear, change your the Discovered resources page preferences. For more information, see Changing preferences for Discovered resource page. • To view other pages of resources, choose a page number, or navigate by using < or > to view next or previous pages. • To see the latest information about resources in the page, choose Refresh. Filtering discovered resources You can use one or more filters on the Telemetry config page or the Discovered resources page to change your view of the resources. Your filter settings persist across both pages. To filter resources on the Telemetry config page 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Settings, and then choose Telemetry config. 3. You can filter the discovered resources that are displayed on the page by specifying an account ID or tag value. a. Choose Find resource. b. Choose Account ID or Tag value, and then choose additional options for the filter. Statistics about telemetry coverage for each resource change based on your filter options. 4. To remove a filter, in the filter text box, choose X. To filter resources on the Discovered resources page 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Telemetry config. Filtering discovered resources 530 Amazon CloudWatch User Guide 3. To view all resource types discovered by telemetry configuration or to view one resource type, do one of the following: a. b. To view all resources discovered by telemetry configuration, choose View resources. The Discovered resources page appears and shows all resources discovered by telemetry configuration. To view one resource type, at the bottom of the page, choose a type of AWS resource. The Discovered resources page appears. The Discovered resources page filters all discovered resources for that resource type. 4. You can filter the resources displayed in the page based on any of the columns in the page. You can change the columns in the page by changing your preferences for the Discovered resources page. For more information, see Changing preferences for Discovered resource page. a. b. Choose Find resource. Filters for each column in the page appear. Choose one, then choose additional options to define the filter. Resources appear in the page |
acw-ug-188 | acw-ug.pdf | 188 | of the page, choose a type of AWS resource. The Discovered resources page appears. The Discovered resources page filters all discovered resources for that resource type. 4. You can filter the resources displayed in the page based on any of the columns in the page. You can change the columns in the page by changing your preferences for the Discovered resources page. For more information, see Changing preferences for Discovered resource page. a. b. Choose Find resource. Filters for each column in the page appear. Choose one, then choose additional options to define the filter. Resources appear in the page that match the filter settings. To further filter the resources displayed in the page, choose Find resources again, choose another filter, and choose additional options. Resources appear in the page that match all of the filter settings. To remove one of the filters, in the filter text box, choose X. To remove all of the filters and see all resource types discovered by telemetry configuration, choose Clear filters. 5. 6. Changing preferences for Discovered resource page You can change your preferences for the Discovered resources page to control how many resources appear per page and which detailed metrics appear in the page. Only detailed metrics in view can be used to filter the resources displayed in the discovered resources page. For more information, see Filtering discovered resources. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Telemetry config. 3. Choose View resources. The Discovered resources page appears. 4. Choose the gear icon. Changing preferences for Discovered resource page 531 Amazon CloudWatch User Guide 5. In the Preferences dialog box, choose the number of resources per page and the visible content to show as columns. 6. Choose Confirm. Turning off CloudWatch telemetry auditing When you no longer need telemetry configuration, turn it off. When telemetry configuration is turned off, it no longer shows the status of telemetry for resources in your account or organization. You can turn on telemetry configuration at any time. For more information, see Turning on CloudWatch telemetry auditing. 1. Open the CloudWatch console. 2. In the navigation pane, choose Telemetry config. 3. Choose Turn off. Turning off telemetry auditing 532 Amazon CloudWatch User Guide Infrastructure monitoring The topics in this section explain CloudWatch features that can help you gain operational visibility into your AWS resources. Topics • Container Insights • Lambda Insights • CloudWatch Database Insights • Use Contributor Insights to analyze high-cardinality data • Detect common application problems with CloudWatch Application Insights • Using the resource health view in the CloudWatch console Container Insights Use CloudWatch Container Insights to collect, aggregate, and summarize metrics and logs from your containerized applications and microservices. Container Insights is available for Amazon Elastic Container Service (Amazon ECS), Amazon Elastic Kubernetes Service (Amazon EKS), RedHat OpenShift on AWS (ROSA), and Kubernetes platforms on Amazon EC2. Container Insights supports collecting metrics from clusters deployed on AWS Fargate for both Amazon ECS and Amazon EKS. CloudWatch automatically collects metrics for many resources, such as CPU, memory, disk, and network. Container Insights also provides diagnostic information, such as container restart failures, to help you isolate issues and resolve them quickly. You can also set CloudWatch alarms on metrics that Container Insights collects. Container Insights collects data as performance log events using embedded metric format. These performance log events are entries that use a structured JSON schema that enables high- cardinality data to be ingested and stored at scale. From this data, CloudWatch creates aggregated metrics at the cluster, node, pod, task, and service level as CloudWatch metrics. The metrics that Container Insights collects are available in CloudWatch automatic dashboards, and are also viewable in the Metrics section of the CloudWatch console. Metrics are not visible until the container tasks have been running for some time. When you deploy Container Insights, it automatically creates a log group for the performance log events. You don't need to create this log group yourself. Container Insights 533 Amazon CloudWatch User Guide To help you manage your Container Insights costs, CloudWatch does not automatically create all possible metrics from the log data. However, you can view additional metrics and additional levels of granularity by using CloudWatch Logs Insights to analyze the raw performance log events. With the original version of Container Insights, metrics collected and logs ingested are charged as custom metrics. With Container Insights with enhanced observability for Amazon EKS, Container Insights metrics and logs are charged per observation instead of being charged per metric stored or log ingested. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing. In Amazon EKS, RedHatOpenshift on AWS, and Kubernetes, Container Insights uses a containerized version of the CloudWatch agent to discover all of the running containers in a cluster. It then collects performance data at every |
acw-ug-189 | acw-ug.pdf | 189 | CloudWatch Logs Insights to analyze the raw performance log events. With the original version of Container Insights, metrics collected and logs ingested are charged as custom metrics. With Container Insights with enhanced observability for Amazon EKS, Container Insights metrics and logs are charged per observation instead of being charged per metric stored or log ingested. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing. In Amazon EKS, RedHatOpenshift on AWS, and Kubernetes, Container Insights uses a containerized version of the CloudWatch agent to discover all of the running containers in a cluster. It then collects performance data at every layer of the performance stack. Container Insights supports encryption with the AWS KMS key for the logs and metrics that it collects. To enable this encryption, you must manually enable AWS KMS encryption for the log group that receives Container Insights data. This causes Container Insights to encrypt this data using the provided KMS key. Only symmetric keys are supported. Do not use asymmetric KMS keys to encrypt your log groups. For more information, see Encrypt Log Data in CloudWatch Logs Using AWS KMS. Supported platforms Container Insights is available for Amazon Elastic Container Service, Amazon Elastic Kubernetes Service, RedHat OpenShift on AWS, and Kubernetes platforms on Amazon EC2 instances. • For Amazon ECS, Container Insights collects metrics at the cluster, task, and service levels on both Linux and Windows Server instances. Container Insights collects metrics at the instance level only on Linux instances. Network metrics are available for containers that use bridge network mode and awsvpc network mode, but are not available for containers that use host network mode. • For Amazon Elastic Kubernetes Service, and Kubernetes platforms on Amazon EC2 instances, Container Insights is supported on both Linux and Windows instances. Container Insights with enhanced observability for Amazon ECS On December 2, 2024, AWS released Container Insights with enhanced observability for Amazon ECS. This version supports enhanced observability for Amazon ECS clusters using the Amazon EC2 Supported platforms 534 Amazon CloudWatch User Guide and Fargate launch types. After you configure Container Insights with enhanced observability on Amazon ECS, Container Insights auto-collects detailed infrastructure telemetry from the cluster level down to the container level in your environment and displays these critical performance data in curated dashboards removing the heavy lifting in observability set-up. For information about how to set up Container Insights with enhanced observability, see Setting up Container Insights on Amazon ECS. Container Insights with enhanced observability provides all of the Container Insights metrics, plus additional task and container metrics. For more information, see Amazon ECS Container Insights with enhanced observability metrics. Container Insights with enhanced observability also supports CloudWatch cross-account observability. You can use a single monitoring account to monitor and troubleshoot applications that span multiple AWS accounts within a single Region. For more information, see CloudWatch cross-account observability. Container Insights with enhanced observability for Amazon EKS On November 6, 2023, a new version of Container Insights was released. This version supports enhanced observability for Amazon EKS clusters running on Amazon EC2 and can collect more detailed metrics from these clusters. After installation, it automatically collects detailed infrastructure telemetry and container logs for your Amazon EKS clusters. You can then use curated, immediately usable dashboards to drill down into application and infrastructure telemetry. Container Insights with enhanced observability for Amazon EKS collects granular health, performance, and status metrics up to the container level, and also control plane metrics. For more information about the additional metrics and dimensions collected, see Amazon EKS and Kubernetes Container Insights with enhanced observability metrics. If you installed Container Insights by using the CloudWatch agent on an Amazon EKS cluster on Amazon EC2 after November 6, 2023, you have Container Insights with enhanced observability for Amazon EKS. Otherwise, you can upgrade an Amazon EKS cluster to this new version by following the instructions in Upgrading to Container Insights with enhanced observability for Amazon EKS in CloudWatch. Container Insights supports CloudWatch cross-account observability. You use a single monitoring account to monitor and troubleshoot your applications that span multiple AWS accounts within a single Region. For more information, see CloudWatch cross-account observability. Container Insights with enhanced observability for Amazon EKS 535 Amazon CloudWatch User Guide Container Insights with enhanced observability for Amazon EKS also supports Windows worker nodes. Container Insights with enhanced observability for Amazon EKS is not supported on Fargate. Note You can find whether you have clusters that can be upgraded to Container Insights with enhanced observability for Amazon EKS by navigating to the Container Insights console. To do so, choose Insights, Container Insights in the navigation pane of the CloudWatch console. In the Container Insights console, a banner informs you if you have any Amazon EKS clusters that can be upgraded, and links to the upgrade page. CloudWatch agent container image Amazon |
acw-ug-190 | acw-ug.pdf | 190 | Container Insights with enhanced observability for Amazon EKS also supports Windows worker nodes. Container Insights with enhanced observability for Amazon EKS is not supported on Fargate. Note You can find whether you have clusters that can be upgraded to Container Insights with enhanced observability for Amazon EKS by navigating to the Container Insights console. To do so, choose Insights, Container Insights in the navigation pane of the CloudWatch console. In the Container Insights console, a banner informs you if you have any Amazon EKS clusters that can be upgraded, and links to the upgrade page. CloudWatch agent container image Amazon provides a CloudWatch agent container image on Amazon Elastic Container Registry. For more information, see cloudwatch-agent on Amazon ECR. Setting up Container Insights The Container Insights setup process is different for Amazon ECS and Amazon EKS and Kubernetes. Topics • Setting up Container Insights on Amazon ECS • Setting up Container Insights on Amazon EKS and Kubernetes • Setting up Container Insights on RedHat OpenShift on AWS (ROSA) Setting up Container Insights on Amazon ECS You can use one or both of the following options to enable Container Insights on Amazon ECS clusters: • Use the AWS Management Console or the AWS CLI to start collecting cluster-level, task-level, and service-level metrics. • Deploy the CloudWatch agent as a daemon service to start collecting of instance-level metrics on clusters that are hosted on Amazon EC2 instances. CloudWatch agent container image 536 Amazon CloudWatch Topics User Guide • Setting up Container Insights on Amazon ECS • Setting up Container Insights on Amazon ECS using AWS Distro for OpenTelemetry • Deploying the CloudWatch agent to collect EC2 instance-level metrics on Amazon ECS • Deploying the AWS Distro for OpenTelemetry to collect EC2 instance-level metrics on Amazon ECS clusters • Set up FireLens to send logs to CloudWatch Logs Setting up Container Insights on Amazon ECS You can set up Container Insights with enhanced observability or Container Insights on new and existing Amazon ECS clusters using either the Amazon ECS console or the AWS CLI. Container Insights collects metrics at the cluster, task, and service levels. Container Insights with enhanced observability provides additional dimensions and metrics, allowing you to deep dive down to container level visibility. If you're using Amazon ECS on an Amazon EC2 instance, launch that instance using an AMI that includes Amazon ECS agent version 1.29 or later. For information about updating your agent version, see Updating the Amazon ECS Container Agent. Note If the customer managed AWS KMS key that you use for your Amazon ECS Container Insights metrics is not already configured to work with CloudWatch, you must update the key policy to allow for encrypted logs in CloudWatch Logs. You must also associate your own AWS KMS key with the log group in /aws/ecs/ containerinsights/ClusterName/performance. For more information, see Encrypt log data in CloudWatch Logs using AWS Key Management Service. We recommend that you use Container Insights with enhanced observability instead of Container Insights as it provides detailed visibility in your container environment, reducing the mean time to resolution. Set up Container Insights with enhanced observability You can turn on Container Insights with enhanced observability using the Amazon ECS console or AWS CLI. Setting up Container Insights 537 Amazon CloudWatch AWS CLI User Guide Use the following command to turn on Container Insights with enhanced observability. Set the containerInsights account setting to enhanced aws ecs put-account-setting --name containerInsights --value enhanced Example output { "setting": { "name": "containerInsights", "value": "enhanced", "principalArn": "arn:aws:iam::123456789012:johndoe", "type": user } } Note By default, the put-account-setting applies only to the currently authenticated user. To enable the setting account-wide for all users and roles, use the root user as in the following example. aws ecs put-account-setting --name containerInsights --value enhanced -- principal-arn arn:aws:iam::accountID:root After you set this account setting, all new clusters automatically use Container Insights with enhanced observability. Use the update-cluster-settings command to add Container Insights with enhanced observability to existing cluster, or to upgrade clusters that currently use Container Insights to Container Insights with enhanced observability. aws ecs update-cluster-settings --cluster cluster-name --settings name=containerInsights,value=enhanced Amazon ECS console 1. Open the console at https://console.aws.amazon.com/ecs/v2. Setting up Container Insights 538 Amazon CloudWatch User Guide 2. 3. In the navigation bar at the top, select the Region for which to view your account settings. In the navigation page, choose Account Settings. 4. Choose Update. 5. To use Container Insights with enhanced observability, choose Container Insights with enhanced observability. 6. Choose Save changes. 7. On the confirmation screen, choose Confirm to save the selection. After you set this, all new clusters automatically use Container Insights with enhanced observability. You can add Container Insights with enhanced observability to existing clusters, or update clusters that currently use Container Insights to Container Insights with enhanced observability. For more information, see Updating |
acw-ug-191 | acw-ug.pdf | 191 | In the navigation bar at the top, select the Region for which to view your account settings. In the navigation page, choose Account Settings. 4. Choose Update. 5. To use Container Insights with enhanced observability, choose Container Insights with enhanced observability. 6. Choose Save changes. 7. On the confirmation screen, choose Confirm to save the selection. After you set this, all new clusters automatically use Container Insights with enhanced observability. You can add Container Insights with enhanced observability to existing clusters, or update clusters that currently use Container Insights to Container Insights with enhanced observability. For more information, see Updating an Amazon ECS cluster in the Amazon Elastic Container Service Developer Guide. Set up Container Insights You can turn on Container Insights using the Amazon ECS console or AWS CLI. AWS CLI To use Container Insights, set the container Insights account setting to enabled. Use the following command to turn on Container Insights. aws ecs put-account-setting --name containerInsights --value enabled Example output { "setting": { "name": "container Insights", "value": "enabled", "principalArn": "arn:aws:iam::123456789012:johndoe", "type": user } } Setting up Container Insights 539 Amazon CloudWatch User Guide When you set the container Insights account setting to enabled, all new clusters have Container Insights enabled by default. Use the update-cluster-settings command to add Container Insights to an existing cluster. aws ecs update-cluster-settings --cluster cluster-name --settings name=containerInsights,value=enabled Amazon ECS console 1. Open the console at https://console.aws.amazon.com/ecs/v2. 2. 3. In the navigation bar at the top, select the Region for which to view your account settings. In the navigation page, choose Account Settings. 4. Choose Update. 5. To use Container Insights, choose Container Insights. 6. Choose Save changes. 7. On the confirmation screen, choose Confirm to save the selection. After you set this, all new clusters automatically use Container Insights. Update existing clusters to add Container Insights. For more information, see Updating an Amazon ECS cluster in the Amazon Elastic Container Service Developer Guide. Setting up Container Insights on Amazon ECS using AWS Distro for OpenTelemetry Use this section if you want to use AWS Distro for OpenTelemetry to set up CloudWatch Container Insights on an Amazon ECS cluster. For more information about AWS Distro for Open Telemetry, see AWS Distro for OpenTelemetry. These steps assume that you already have a cluster running Amazon ECS. For more information about using AWS Distro for Open Telemetry with Amazon ECS and setting up an Amazon ECS cluster for this purpose, see Setting up AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service. Step 1: Create a task role The first step is creating a task role in the cluster that the AWS OpenTelemetry Collector will use. Setting up Container Insights 540 Amazon CloudWatch User Guide To create a task role for AWS Distro for OpenTelemetry 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. In the navigation pane, choose Policies and then choose Create policy. 3. Choose the JSON tab and copy in the following policy: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream", "logs:DescribeLogStreams", "logs:DescribeLogGroups", "ssm:GetParameters" ], "Resource": "*" } ] } 4. Choose Review policy. 5. 6. 7. 8. 9. For name, enter AWSDistroOpenTelemetryPolicy, and then choose Create policy. In the left navigation pane, choose Roles and then choose Create role. In the list of services, choose Elastic Container Service. Lower on the page, choose Elastic Container Service Task and then choose Next: Permissions. In the list of policies, search for AWSDistroOpenTelemetryPolicy. 10. Select the check box next to AWSDistroOpenTelemetryPolicy. 11. Choose Next: Tags and then choose Next: Review. 12. For Role name enter AWSOpenTelemetryTaskRole and then choose Create role. Step 2: Create a task execution role The next step is creating a task execution role for the AWS OpenTelemetry Collector. Setting up Container Insights 541 Amazon CloudWatch User Guide To create a task execution role for AWS Distro for OpenTelemetry 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. 3. 4. 5. 6. 7. In the left navigation pane, choose Roles and then choose Create role. In the list of services, choose Elastic Container Service. Lower on the page, choose Elastic Container Service Task and then choose Next: Permissions. In the list of policies, search for AmazonECSTaskExecutionRolePolicy and then select the check box next to AmazonECSTaskExecutionRolePolicy. In the list of policies, search for CloudWatchLogsFullAccess and then select the check box next to CloudWatchLogsFullAccess. In the list of policies, search for AmazonSSMReadOnlyAccess and then select the check box next to AmazonSSMReadOnlyAccess. 8. Choose Next: Tags and then choose Next: Review. 9. For Role name enter AWSOpenTelemetryTaskExecutionRole and then choose Create role. Step 3: Create a task definition The next step is creating a task definition. To create a task definition for AWS Distro for OpenTelemetry 1. Open the console at https://console.aws.amazon.com/ecs/v2. 2. In the navigation pane, choose Task definitions 3. Choose |
acw-ug-192 | acw-ug.pdf | 192 | the check box next to AmazonECSTaskExecutionRolePolicy. In the list of policies, search for CloudWatchLogsFullAccess and then select the check box next to CloudWatchLogsFullAccess. In the list of policies, search for AmazonSSMReadOnlyAccess and then select the check box next to AmazonSSMReadOnlyAccess. 8. Choose Next: Tags and then choose Next: Review. 9. For Role name enter AWSOpenTelemetryTaskExecutionRole and then choose Create role. Step 3: Create a task definition The next step is creating a task definition. To create a task definition for AWS Distro for OpenTelemetry 1. Open the console at https://console.aws.amazon.com/ecs/v2. 2. In the navigation pane, choose Task definitions 3. Choose Create new task definition, Create new task definition. 4. For Task definition family, specify a unique name for the task definition. 5. Configure your containers, and then choose Next. 6. Under Metrics and logging, select Use metric collection. 7. Choose Next. 8. Choose Create. For more information about using the AWS OpenTelemetry collector with Amazon ECS, see Setting up AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service. Setting up Container Insights 542 Amazon CloudWatch Step 4: Run the task The final step is running the task that you've created. To run the task for AWS Distro for OpenTelemetry User Guide 1. Open the console at https://console.aws.amazon.com/ecs/v2. 2. In the left navigation pane, choose Task Definitions and then select the task that you just created. 3. Choose Actions, Deploy, Run task. 4. Choose Deploy, Run task. 5. In the Compute options section, from Existing cluster, choose the cluster. 6. Choose Create. 7. Next, you can check for the new metrics in the CloudWatch console. 8. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 9. In the left navigation pane, choose Metrics. You should see a ECS/ContainerInsights namespace. Choose that namespace and you should see eight metrics. Deploying the CloudWatch agent to collect EC2 instance-level metrics on Amazon ECS To deploy the CloudWatch agent to collect instance-level metrics from Amazon ECS clusters that are hosted on EC2 instance, use a quick start setup with a default configuration, or install the agent manually to be able to customize it. Both methods require that you already have at least one Amazon ECS cluster deployed with an EC2 launch type and that the CloudWatch agent continer has access to the Amazon EC2 Instance Metadata Service (IMDS). For more information about IMDS, see Instance metadata and user data. These methods also assume that you have the AWS CLI installed. Additionally, to run the commands in the following procedures, you must be logged on to an account or role that has the IAMFullAccess and AmazonECS_FullAccess policies. Topics • Quick setup using AWS CloudFormation Setting up Container Insights 543 Amazon CloudWatch • Manual and custom setup Quick setup using AWS CloudFormation User Guide To use the quick setup, enter the following command to use AWS CloudFormation to install the agent. Replace cluster-name and cluster-region with the name and Region of your Amazon ECS cluster. This command creates the IAM roles CWAgentECSTaskRole and CWAgentECSExecutionRole. If these roles already exist in your account, use ParameterKey=CreateIAMRoles,ParameterValue=False instead of ParameterKey=CreateIAMRoles,ParameterValue=True when you enter the command. Otherwise, the command will fail. ClusterName=cluster-name Region=cluster-region curl -O 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 aws cloudformation create-stack --stack-name CWAgentECS-${ClusterName}-${Region} \ --template-body file://cwagent-ecs-instance-metric-cfn.json \ --parameters ParameterKey=ClusterName,ParameterValue=${ClusterName} \ ParameterKey=CreateIAMRoles,ParameterValue=True \ --capabilities CAPABILITY_NAMED_IAM \ --region ${Region} (Alternative) Using your own IAM roles If you want to use your own custom ECS task role and ECS task execution role instead of the CWAgentECSTaskRole and CWAgentECSExecutionRole roles, first make sure that the role to be used as the ECS task role has CloudWatchAgentServerPolicy attached. Also, make sure that the role to be used as the ECS task execution role has both the CloudWatchAgentServerPolicy and AmazonECSTaskExecutionRolePolicy policies attached. Then enter the following command. In the command, replace task-role-arn with the ARN of your custom ECS task role, and replace execution-role-arn with the ARN of your custom ECS task execution role. ClusterName=cluster-name Region=cluster-region TaskRoleArn=task-role-arn ExecutionRoleArn=execution-role-arn Setting up Container Insights 544 Amazon CloudWatch User Guide curl -O 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 aws cloudformation create-stack --stack-name CWAgentECS-${ClusterName}-${Region} \ --template-body file://cwagent-ecs-instance-metric-cfn.json \ --parameters ParameterKey=ClusterName,ParameterValue=${ClusterName} \ ParameterKey=TaskRoleArn,ParameterValue=${TaskRoleArn} \ ParameterKey=ExecutionRoleArn,ParameterValue=${ExecutionRoleArn} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${Region} Troubleshooting the quick setup To check the status of the AWS CloudFormation stack, enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stacks --stack-name CWAgentECS-$ClusterName-$Region -- region $Region If you see the StackStatus is other than CREATE_COMPLETE or CREATE_IN_PROGRESS, check the stack events to find the error. Enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stack-events --stack-name CWAgentECS-$ClusterName-$Region --region $Region To check the status of the cwagent daemon service, enter the following command. In the output, you should see that the runningCount is equal to the desiredCount in the deployment section. If it isn't equal, check the failures section in the output. ClusterName=cluster-name Region=cluster-region aws ecs describe-services --services cwagent-daemon-service --cluster $ClusterName -- region $Region You can also |
acw-ug-193 | acw-ug.pdf | 193 | command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stacks --stack-name CWAgentECS-$ClusterName-$Region -- region $Region If you see the StackStatus is other than CREATE_COMPLETE or CREATE_IN_PROGRESS, check the stack events to find the error. Enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stack-events --stack-name CWAgentECS-$ClusterName-$Region --region $Region To check the status of the cwagent daemon service, enter the following command. In the output, you should see that the runningCount is equal to the desiredCount in the deployment section. If it isn't equal, check the failures section in the output. ClusterName=cluster-name Region=cluster-region aws ecs describe-services --services cwagent-daemon-service --cluster $ClusterName -- region $Region You can also use the CloudWatch Logs console to check the agent log. Look for the /ecs/ecs- cwagent-daemon-service log group. Deleting the AWS CloudFormation stack for the CloudWatch agent Setting up Container Insights 545 Amazon CloudWatch User Guide If you need to delete the AWS CloudFormation stack, enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation delete-stack --stack-name CWAgentECS-${ClusterName}-${Region} -- region ${Region} Manual and custom setup Follow the steps in this section to manually deploy the CloudWatch agent to collect instance-level metrics from your Amazon ECS clusters that are hosted on EC2 instances. Necessary IAM roles and policies Two IAM roles are required. You must create them if they don't already exist. For more information about these roles, see IAM roles for Tasks and Amazon ECS Task Execution Role. • An ECS task role, which is used by the CloudWatch agent to publish metrics. If this role already exists, you must make sure it has the CloudWatchAgentServerPolicy policy attached. • An ECS task execution role, which is used by Amazon ECS agent to launch the CloudWatch agent. If this role already exists, you must make sure it has the AmazonECSTaskExecutionRolePolicy and CloudWatchAgentServerPolicy policies attached. If you do not already have these roles, you can use the following commands to create them and attach the necessary policies. This first command creates the ECS task role. aws iam create-role --role-name CWAgentECSTaskRole \ --assume-role-policy-document "{\"Version\": \"2012-10-17\",\"Statement\": [{\"Sid \": \"\",\"Effect\": \"Allow\",\"Principal\": {\"Service\": \"ecs-tasks.amazonaws.com \"},\"Action\": \"sts:AssumeRole\"}]}" After you enter the previous command, note the value of Arn from the command output as "TaskRoleArn". You'll need to use it later when you create the task definition. Then enter the following command to attach the necessary policies. aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/ CloudWatchAgentServerPolicy \ --role-name CWAgentECSTaskRole Setting up Container Insights 546 Amazon CloudWatch User Guide This next command creates the ECS task execution role. aws iam create-role --role-name CWAgentECSExecutionRole \ --assume-role-policy-document "{\"Version\": \"2012-10-17\",\"Statement\": [{\"Sid \": \"\",\"Effect\": \"Allow\",\"Principal\": {\"Service\": \"ecs-tasks.amazonaws.com \"},\"Action\": \"sts:AssumeRole\"}]}" After you enter the previous command, note the value of Arn from the command output as "ExecutionRoleArn". You'll need to use it later when you create the task definition. Then enter the following commands to attach the necessary policies. aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/ CloudWatchAgentServerPolicy \ --role-name CWAgentECSExecutionRole aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/service-role/ AmazonECSTaskExecutionRolePolicy \ --role-name CWAgentECSExecutionRole Create the task definition and launch the daemon service Create a task definition and use it to launch the CloudWatch agent as a daemon service. To create the task definition, enter the following command. In the first lines, replace the placeholders with the actual values for your deployment. logs-region is the Region where CloudWatch Logs is located, and cluster-region is the Region where your cluster is located. task-role-arn is the Arn of the ECS task role that you are using, and execution-role-arn is the Arn of the ECS task execution role. TaskRoleArn=task-role-arn ExecutionRoleArn=execution-role-arn AWSLogsRegion=logs-region Region=cluster-region curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/daemon-service/cwagent- ecs-instance-metric/cwagent-ecs-instance-metric.json \ | sed "s|{{task-role-arn}}|${TaskRoleArn}|;s|{{execution-role-arn}}| ${ExecutionRoleArn}|;s|{{awslogs-region}}|${AWSLogsRegion}|" \ | xargs -0 aws ecs register-task-definition --region ${Region} --cli-input-json Then run the following command to launch the daemon service. Replace cluster-name and cluster-region with the name and Region of your Amazon ECS cluster. Setting up Container Insights 547 Amazon CloudWatch Important User Guide Remove all capacity provider strategies before you run this command. Otherwise, the command won't work. ClusterName=cluster-name Region=cluster-region aws ecs create-service \ --cluster ${ClusterName} \ --service-name cwagent-daemon-service \ --task-definition ecs-cwagent-daemon-service \ --scheduling-strategy DAEMON \ --region ${Region} If you see this error message, An error occurred (InvalidParameterException) when calling the CreateService operation: Creation of service was not idempotent, you have already created a daemon service named cwagent-daemon-service. You must delete that service first, using the following command as an example. ClusterName=cluster-name Region=cluster-region aws ecs delete-service \ --cluster ${ClusterName} \ --service cwagent-daemon-service \ --region ${Region} \ --force (Optional) Advanced configuration Optionally, you can use SSM to specify other configuration options for the CloudWatch agent in your Amazon ECS clusters that are hosted on EC2 instances. These options are as follows: • metrics_collection_interval – How often in seconds that the CloudWatch agent collects metrics. The default is 60. The range is 1–172,000. • endpoint_override – (Optional) Specifies a different endpoint to send logs to. You might want to do this if you're publishing from a cluster in a VPC |
acw-ug-194 | acw-ug.pdf | 194 | as an example. ClusterName=cluster-name Region=cluster-region aws ecs delete-service \ --cluster ${ClusterName} \ --service cwagent-daemon-service \ --region ${Region} \ --force (Optional) Advanced configuration Optionally, you can use SSM to specify other configuration options for the CloudWatch agent in your Amazon ECS clusters that are hosted on EC2 instances. These options are as follows: • metrics_collection_interval – How often in seconds that the CloudWatch agent collects metrics. The default is 60. The range is 1–172,000. • endpoint_override – (Optional) Specifies a different endpoint to send logs to. You might want to do this if you're publishing from a cluster in a VPC and you want the logs data to go to a VPC endpoint. The value of endpoint_override must be a string that is a URL. Setting up Container Insights 548 Amazon CloudWatch User Guide • force_flush_interval – Specifies in seconds the maximum amount of time that logs remain in the memory buffer before being sent to the server. No matter the setting for this field, if the size of the logs in the buffer reaches 1 MB, the logs are immediately sent to the server. The default value is 5 seconds. • region – By default, the agent publishes metrics to the same Region where the Amazon ECS container instance is located. To override this, you can specify a different Region here. For example, "region" : "us-east-1" The following is an example of a customized configuration: { "agent": { "region": "us-east-1" }, "logs": { "metrics_collected": { "ecs": { "metrics_collection_interval": 30 } }, "force_flush_interval": 5 } } To customize your CloudWatch agent configuration in your Amazon ECS containers 1. Make sure that the AmazonSSMReadOnlyAccess policy is attached to your Amazon ECS Task Execution role. You can enter the following command to do so. This example assumes that your Amazon ECS Task Execution role is CWAgentECSExecutionRole. If you are using a different role, substitute that role name in the following command. aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/ AmazonSSMReadOnlyAccess \ --role-name CWAgentECSExecutionRole 2. Create the customized configuration file similar to the preceding example. Name this file / tmp/ecs-cwagent-daemon-config.json. Setting up Container Insights 549 Amazon CloudWatch User Guide 3. Run the following command to put this configuration into the Parameter Store. Replace cluster-region with the Region of your Amazon ECS cluster. To run this command, you must be logged on to a user or role that has the AmazonSSMFullAccess policy. Region=cluster-region aws ssm put-parameter \ --name "ecs-cwagent-daemon-service" \ --type "String" \ --value "`cat /tmp/ecs-cwagent-daemon-config.json`" \ --region $Region 4. Download the task definition file to a local file, such as /tmp/cwagent-ecs-instance- metric.json curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/daemon-service/ cwagent-ecs-instance-metric/cwagent-ecs-instance-metric.json -o /tmp/cwagent-ecs- instance-metric.json 5. Modify the task definition file. Remove the following section: "environment": [ { "name": "USE_DEFAULT_CONFIG", "value": "True" } ], Replace that section with the following: "secrets": [ { "name": "CW_CONFIG_CONTENT", "valueFrom": "ecs-cwagent-daemon-service" } ], 6. Restart the agent as a daemon service by following these steps: a. Run the following command. Setting up Container Insights 550 Amazon CloudWatch User Guide TaskRoleArn=task-role-arn ExecutionRoleArn=execution-role-arn AWSLogsRegion=logs-region Region=cluster-region cat /tmp/cwagent-ecs-instance-metric.json \ | sed "s|{{task-role-arn}}|${TaskRoleArn}|;s|{{execution-role-arn}}| ${ExecutionRoleArn}|;s|{{awslogs-region}}|${AWSLogsRegion}|" \ | xargs -0 aws ecs register-task-definition --region ${Region} --cli-input- json b. Run the following command to launch the daemon service. Replace cluster-name and cluster-region with the name and Region of your Amazon ECS cluster. ClusterName=cluster-name Region=cluster-region aws ecs create-service \ --cluster ${ClusterName} \ --service-name cwagent-daemon-service \ --task-definition ecs-cwagent-daemon-service \ --scheduling-strategy DAEMON \ --region ${Region} If you see this error message, An error occurred (InvalidParameterException) when calling the CreateService operation: Creation of service was not idempotent, you have already created a daemon service named cwagent-daemon- service. You must delete that service first, using the following command as an example. ClusterName=cluster-name Region=Region aws ecs delete-service \ --cluster ${ClusterName} \ --service cwagent-daemon-service \ --region ${Region} \ --force Setting up Container Insights 551 Amazon CloudWatch User Guide Deploying the AWS Distro for OpenTelemetry to collect EC2 instance-level metrics on Amazon ECS clusters Use the steps in this section to use AWS Distro for OpenTelemetry to collect EC2 instance-level metrics on an Amazon ECS cluster. For more information about the AWS Distro for OpenTelemetry, see AWS Distro for OpenTelemetry. These steps assume that you already have a cluster running Amazon ECS. This cluster must be deployed with the EC2 launch type. For more information about using AWS Distro for Open Telemetry with Amazon ECS and setting up an Amazon ECS cluster for this purpose, see Setting up AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service for ECS EC2 instance level metrics. Topics • Quick setup using AWS CloudFormation • Manual and custom setup Quick setup using AWS CloudFormation Download the AWS CloudFormation template file for installing the AWS Distro for OpenTelemetry collector for Amazon ECS on EC2. Run the following curl command. curl -O https://raw.githubusercontent.com/aws-observability/aws-otel-collector/main/ deployment-template/ecs/aws-otel-ec2-instance-metrics-daemon-deployment-cfn.yaml After you download the template file, open it and replace PATH_TO_CloudFormation_TEMPLATE with the |
acw-ug-195 | acw-ug.pdf | 195 | For more information about using AWS Distro for Open Telemetry with Amazon ECS and setting up an Amazon ECS cluster for this purpose, see Setting up AWS Distro for OpenTelemetry Collector in Amazon Elastic Container Service for ECS EC2 instance level metrics. Topics • Quick setup using AWS CloudFormation • Manual and custom setup Quick setup using AWS CloudFormation Download the AWS CloudFormation template file for installing the AWS Distro for OpenTelemetry collector for Amazon ECS on EC2. Run the following curl command. curl -O https://raw.githubusercontent.com/aws-observability/aws-otel-collector/main/ deployment-template/ecs/aws-otel-ec2-instance-metrics-daemon-deployment-cfn.yaml After you download the template file, open it and replace PATH_TO_CloudFormation_TEMPLATE with the path where you saved the template file. Then export the following parameters and run the AWS CloudFormation command, as shown in the following command. • Cluster_Name– The Amazon ECS cluster name • AWS_Region– The Region where the data will be sent • PATH_TO_CloudFormation_TEMPLATE– The path where you saved the AWS CloudFormation template file. • command– To enable the AWS Distro for OpenTelemetry collector to collect the instance- level metrics for Amazon ECS on Amazon EC2, you must specify --config=/etc/ecs/otel- instance-metrics-config.yaml for this parameter. Setting up Container Insights 552 Amazon CloudWatch User Guide ClusterName=Cluster_Name Region=AWS_Region command=--config=/etc/ecs/otel-instance-metrics-config.yaml aws cloudformation create-stack --stack-name AOCECS-${ClusterName}-${Region} \ --template-body file://PATH_TO_CloudFormation_TEMPLATE \ --parameters ParameterKey=ClusterName,ParameterValue=${ClusterName} \ ParameterKey=CreateIAMRoles,ParameterValue=True \ ParameterKey=command,ParameterValue=${command} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${Region} After running this command, use the Amazon ECS console to see if the task is running. Troubleshooting the quick setup To check the status of the AWS CloudFormation stack, enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stack --stack-name AOCECS-$ClusterName-$Region --region $Region If the value of StackStatus is anything other than CREATE_COMPLETE or CREATE_IN_PROGRESS, check the stack events to find the error. Enter the following command. ClusterName=cluster-name Region=cluster-region aws cloudformation describe-stack-events --stack-name AOCECS-$ClusterName-$Region -- region $Region To check the status of the AOCECS daemon service, enter the following command. In the output, you should see that runningCount is equal to the desiredCount in the deployment section. If it isn't equal, check the failures section in the output. ClusterName=cluster-name Region=cluster-region aws ecs describe-services --services AOCECS-daemon-service --cluster $ClusterName -- region $Region You can also use the CloudWatch Logs console to check the agent log. Look for the /aws/ecs/ containerinsights/{ClusterName}/performance log group. Setting up Container Insights 553 Amazon CloudWatch Manual and custom setup User Guide Follow the steps in this section to manually deploy the AWS Distro for OpenTelemetry to collect instance-level metrics from your Amazon ECS clusters that are hosted on Amazon EC2 instances. Step 1: Necessary roles and policies Two IAM roles are required. You must create them if they don't already exist. For more information about these roles, see Create IAM policy and Create IAM role. Step 2: Create the task definition Create a task definition and use it to launch the AWS Distro for OpenTelemetry as a daemon service. To use the task definition template to create the task definition, follow the instructions in Create ECS EC2 Task Definition for EC2 instance with AWS OTel Collector. To use the Amazon ECS console to create the task definition, follow the instructions in Install AWS OTel Collector by creating Task Definition through AWS console for Amazon ECS EC2 instance metrics. Step 3: Launch the daemon service To launch the AWS Distro for OpenTelemetry as a daemon service, follow the instructions in Run your task on the Amazon Elastic Container Service (Amazon ECS) using daemon service. (Optional) Advanced configuration Optionally, you can use SSM to specify other configuration options for the AWS Distro for OpenTelemetry in your Amazon ECS clusters that are hosted on Amazon EC2 instances. For more information, about creating a configuration file, see Custom OpenTelemetry Configuration. For more information about the options that you can use in the configuration file, see AWS Container Insights Receiver. Set up FireLens to send logs to CloudWatch Logs FireLens for Amazon ECS enables you to use task definition parameters to route logs to Amazon CloudWatch Logs for log storage and analytics. FireLens works with Fluent Bit and Fluentd. We provide an AWS for Fluent Bit image, or you can use your own Fluent Bit or Fluentd image. Creating Amazon ECS task definitions with a FireLens configuration is supported using the AWS SDKs, AWS CLI, and AWS Management Console. For more information about CloudWatch Logs, see What is CloudWatch Logs?. Setting up Container Insights 554 Amazon CloudWatch User Guide There are key considerations when using FireLens for Amazon ECS. For more information, see Considerations. To find the AWS for Fluent Bit images, see Using the AWS for Fluent Bit image. To create a task definition that uses a FireLens configuration, see Creating a task definition that uses a FireLens configuration. Example The following task definition example demonstrates how to specify a log configuration that forwards logs to a CloudWatch Logs log group. For more information, see What Is |
acw-ug-196 | acw-ug.pdf | 196 | Console. For more information about CloudWatch Logs, see What is CloudWatch Logs?. Setting up Container Insights 554 Amazon CloudWatch User Guide There are key considerations when using FireLens for Amazon ECS. For more information, see Considerations. To find the AWS for Fluent Bit images, see Using the AWS for Fluent Bit image. To create a task definition that uses a FireLens configuration, see Creating a task definition that uses a FireLens configuration. Example The following task definition example demonstrates how to specify a log configuration that forwards logs to a CloudWatch Logs log group. For more information, see What Is Amazon CloudWatch Logs? in the Amazon CloudWatch Logs User Guide. In the log configuration options, specify the log group name and the Region it exists in. To have Fluent Bit create the log group on your behalf, specify "auto_create_group":"true". You can also specify the task ID as the log stream prefix, which assists in filtering. For more information, see Fluent Bit Plugin for CloudWatch Logs. { "family": "firelens-example-cloudwatch", "taskRoleArn": "arn:aws:iam::123456789012:role/ecs_task_iam_role", "containerDefinitions": [ { "essential": true, "image": "906394416424.dkr.ecr.us-west-2.amazonaws.com/aws-for-fluent-bit:latest", "name": "log_router", "firelensConfiguration": { "type": "fluentbit" }, "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "firelens-container", "awslogs-region": "us-west-2", "awslogs-create-group": "true", "awslogs-stream-prefix": "firelens" } }, "memoryReservation": 50 }, { Setting up Container Insights 555 Amazon CloudWatch "essential": true, "image": "nginx", "name": "app", "logConfiguration": { "logDriver":"awsfirelens", "options": { "Name": "cloudwatch_logs", "region": "us-west-2", "log_key": "log", User Guide "log_group_name": "/aws/ecs/containerinsights/my- cluster/application", "auto_create_group": "true", "log_stream_name": "my-task-id" } }, "memoryReservation": 100 } ] } Setting up Container Insights on Amazon EKS and Kubernetes Container Insights is supported on Amazon EKS versions 1.23 and later. The quick start method of installation is supported only on versions 1.24 and later. The overall process for setting up Container Insights on Amazon EKS or Kubernetes is as follows: 1. Verify that you have the necessary prerequisites. 2. Set up the Amazon CloudWatch Observability EKS add-on, the CloudWatch agent, or AWS Distro for OpenTelemetry on your cluster to send metrics to CloudWatch. Note To use Container Insights with enhanced observability for Amazon EKS, you must use the Amazon CloudWatch Observability EKS add-on or the CloudWatch agent. For more information about this version of Container Insights, see Container Insights with enhanced observability for Amazon EKS. To use Container Insights with Fargate, you must use AWS Distro for OpenTelemetry. Container Insights with enhanced observability for Amazon EKS is not supported on Fargate. Setting up Container Insights 556 Amazon CloudWatch Note User Guide Container Insights now supports Windows worker nodes in an Amazon EKS cluster. Container Insights with enhanced observability for Amazon EKS is also supported on Windows. For information about enabling Container Insights on Windows, see Using the CloudWatch agent with Container Insights enhanced observability enabled. Set up Fluent Bit or Fluentd to send logs to CloudWatch Logs. (This is enabled by default if you install the Amazon CloudWatch Observability EKS add-on.) You can perform these steps at once as part of the quick start setup if you are using the CloudWatch agent, or do them separately. 3. (Optional) Set up Amazon EKS control plane logging. 4. (Optional) Set up the CloudWatch agent as a StatsD endpoint on the cluster to send StatsD metrics to CloudWatch. 5. (Optional) Enable App Mesh Envoy Access Logs. With the original version of Container Insights, metrics collected and logs ingested are charged as custom metrics. With Container Insights with enhanced observability for Amazon EKS, Container Insights metrics and logs are charged per observation instead of being charged per metric stored or log ingested. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing. Topics • Verifying prerequisites for Container Insights in CloudWatch • Using the CloudWatch agent with Container Insights enhanced observability enabled • Using AWS Distro for OpenTelemetry • Send logs to CloudWatch Logs • Updating or deleting Container Insights on Amazon EKS and Kubernetes Setting up Container Insights 557 Amazon CloudWatch User Guide Verifying prerequisites for Container Insights in CloudWatch Before you install Container Insights on Amazon EKS or Kubernetes, verify the following. These prerequisites apply whether you are using the CloudWatch agent or AWS Distro for OpenTelemetry to set up Container Insights on Amazon EKS clusters. • You have a functional Amazon EKS or Kubernetes cluster with nodes attached in one of the Regions that supports the Container Insights for Amazon EKS and Kubernetes. For the list of supported Regions, see Container Insights. • You have kubectl installed and running. For more information, see Installing kubectl in the Amazon EKS User Guide. • If you're using Kubernetes running on AWS instead of using Amazon EKS, the following prerequisites are also necessary: • Be sure that your Kubernetes cluster has enabled role-based access control (RBAC). For more information, see Using RBAC Authorization in the Kubernetes Reference. • Your kubelet has enabled Webhook authorization mode. For more information, see Kubelet |
acw-ug-197 | acw-ug.pdf | 197 | attached in one of the Regions that supports the Container Insights for Amazon EKS and Kubernetes. For the list of supported Regions, see Container Insights. • You have kubectl installed and running. For more information, see Installing kubectl in the Amazon EKS User Guide. • If you're using Kubernetes running on AWS instead of using Amazon EKS, the following prerequisites are also necessary: • Be sure that your Kubernetes cluster has enabled role-based access control (RBAC). For more information, see Using RBAC Authorization in the Kubernetes Reference. • Your kubelet has enabled Webhook authorization mode. For more information, see Kubelet authentication/authorization in the Kubernetes Reference. You must also grant IAM permissions to enable your Amazon EKS worker nodes to send metrics and logs to CloudWatch. There are two ways to do this: • Attach a policy to the IAM role of your worker nodes. This works for both Amazon EKS clusters and other Kubernetes clusters. • Use an IAM role for service accounts for the cluster, and attach the policy to this role. This works only for Amazon EKS clusters. The first option grants permissions to CloudWatch for the entire node, while using an IAM role for the service account gives CloudWatch access to only the appropriate daemonset pods. Attaching a policy to the IAM role of your worker nodes Follow these steps to attach the policy to the IAM role of your worker nodes. This works for both Amazon EKS clusters and Kubernetes clusters outside of Amazon EKS. To attach the necessary policy to the IAM role for your worker nodes 1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. Setting up Container Insights 558 Amazon CloudWatch User Guide 2. Select one of the worker node instances and choose the IAM role in the description. 3. On the IAM role page, choose Attach policies. 4. In the list of policies, select the check box next to CloudWatchAgentServerPolicy. If necessary, use the search box to find this policy. 5. Choose Attach policies. If you're running a Kubernetes cluster outside Amazon EKS, you might not already have an IAM role attached to your worker nodes. If not, you must first attach an IAM role to the instance and then add the policy as explained in the previous steps. For more information on attaching a role to an instance, see Attaching an IAM Role to an Instance in the Amazon EC2 User Guide. If you're running a Kubernetes cluster outside Amazon EKS and you want to collect EBS volume IDs in the metrics, you must add another policy to the IAM role attached to the instance. Add the following as an inline policy. For more information, see Adding and Removing IAM Identity Permissions in the IAM User Guide. { "Version": "2012-10-17", "Statement": [ { "Action": [ "ec2:DescribeVolumes" ], "Resource": "*", "Effect": "Allow" } ] } Using an IAM service account role This method works only on Amazon EKS clusters. To grant permission to CloudWatch using an IAM service account role 1. If you haven't already, enable IAM roles for service accounts on your cluster. For more information, see Enabling IAM roles for service accounts on your cluster . Setting up Container Insights 559 Amazon CloudWatch User Guide 2. If you haven't already, configure the service account to use an IAM role. For more information, see Configuring a Kubernetes service account to assume an IAM role. When you create the role, attach the CloudWatchAgentServerPolicy IAM policy to the role in addition to the policy that you create for the role. Also, the associated Kubernetes Service Account that is linked to this role should be created in the amazon-cloudwatch namespace, where the CloudWatch and Fluent Bit daemonsets will be deployed in the upcoming steps 3. If you haven't already, associate the IAM role with a service account in your cluster. For more information, see Configuring a Kubernetes service account to assume an IAM role. Using the CloudWatch agent with Container Insights enhanced observability enabled Use the instructions in one of the following sections to set up Container Insights on an Amazon EKS cluster or Kubernetes cluster by using the CloudWatch agent. The quick start instructions are supported only on Amazon EKS versions 1.24 and later. Note You can install Container Insights by following the instructions in any one of the following sections. You don't need to follow all three sets of instructions. Topics • Quick start with the Amazon CloudWatch Observability EKS add-on • Quick Start setup for Container Insights on Amazon EKS and Kubernetes • Setting up the CloudWatch agent to collect cluster metrics Quick start with the Amazon CloudWatch Observability EKS add-on You can use the Amazon EKS add-on to install Container Insights with enhanced observability for Amazon EKS. The add-on installs the CloudWatch agent to send infrastructure metrics from the cluster, installs |
acw-ug-198 | acw-ug.pdf | 198 | Note You can install Container Insights by following the instructions in any one of the following sections. You don't need to follow all three sets of instructions. Topics • Quick start with the Amazon CloudWatch Observability EKS add-on • Quick Start setup for Container Insights on Amazon EKS and Kubernetes • Setting up the CloudWatch agent to collect cluster metrics Quick start with the Amazon CloudWatch Observability EKS add-on You can use the Amazon EKS add-on to install Container Insights with enhanced observability for Amazon EKS. The add-on installs the CloudWatch agent to send infrastructure metrics from the cluster, installs Fluent Bit to send container logs, and also enables CloudWatch Application Signals to send application performance telemetry. When you use the Amazon EKS add-on version 1.5.0 or later, Container Insights is enabled on both Linux and Windows worker nodes in the cluster. Currently, Application Signals is not supported on Windows in Amazon EKS. Setting up Container Insights 560 Amazon CloudWatch User Guide The Amazon EKS add-on is not supported for clusters running Kubernetes instead of Amazon EKS. For more information about the Amazon CloudWatch Observability EKS add-on, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add-on or the Helm chart. If you use version 3.1.0 or later of the add-on, you can use EKS Pod Identity to grant the required permissions to the add-on. EKS Pod Identity is the recommended option and provides benefits such as least privilege, credential rotation, and auditability. Additionally, using EKS Pod Identity allows you to install the EKS add-on as part of the cluster creation itself. To install the Amazon CloudWatch Observability EKS add-on 1. Follow the EKS Pod Identity association steps to create the IAM role and set up the EKS Pod Identity agent. 2. Attach an IAM policy that grants the required permissions to your role. Replace my-role with the name of your IAM role from the previous step. aws iam attach-role-policy \ --role-name my-role \ --policy-arn=arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy 3. Enter the following command, using with the IAM role you created in the previous step: aws eks create-addon \ --addon-name amazon-cloudwatch-observability \ --cluster-name my-cluster-name \ --pod-identity-associations serviceAccount=cloudwatch- agent,roleArn=arn:aws:iam::111122223333:role/my-role Quick Start setup for Container Insights on Amazon EKS and Kubernetes Important If you are installing Container Insights on an Amazon EKS cluster, we recommend that you use the Amazon CloudWatch Observability EKS add-on for the installation, instead of using the instructions in this section. Additionally, to retrieve accelerated computing networks, you must use the Amazon CloudWatch Observability EKS add-on. For more information and instructions, see Quick start with the Amazon CloudWatch Observability EKS add-on. Setting up Container Insights 561 Amazon CloudWatch User Guide To complete the setup of Container Insights, you can follow the quick start instructions in this section. If you are installing in an Amazon EKS cluster and you use the instructions in this section on or after November 6, 2023, you install Container Insights with enhanced observability for Amazon EKS in the cluster. Important Before completing the steps in this section, you must have verified the prerequisites including IAM permissions. For more information, see Verifying prerequisites for Container Insights in CloudWatch. Alternatively, you can instead follow the instructions in the following two sections, Setting up the CloudWatch agent to collect cluster metrics and Send logs to CloudWatch Logs. Those sections provide more configuration details on how the CloudWatch agent works with Amazon EKS and Kubernetes, but require you to perform more installation steps. With the original version of Container Insights, metrics collected and logs ingested are charged as custom metrics. With Container Insights with enhanced observability for Amazon EKS, Container Insights metrics and logs are charged per observation instead of being charged per metric stored or log ingested. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing. Note Amazon has now launched Fluent Bit as the default log solution for Container Insights with significant performance gains. We recommend that you use Fluent Bit instead of Fluentd. Quick Start with the CloudWatch agent operator and Fluent Bit There are two configurations for Fluent Bit: an optimized version and a version that provides an experience more similar to Fluentd. The Quick Start configuration uses the optimized version. For more details about the Fluentd-compatible configuration, see Set up Fluent Bit as a DaemonSet to send logs to CloudWatch Logs. The CloudWatch agent operator is an additional container that gets installed to an Amazon EKS cluster. It is modeled after the OpenTelemetry Operator for Kubernetes. The operator manages the lifecycle of Kubernetes resources in a cluster. It installs the CloudWatch Agent, DCGM Exporter Setting up Container Insights 562 Amazon CloudWatch User Guide (NVIDIA), and the AWS Neuron Monitor on an Amazon EKS cluster and manages them. Fluent Bit and the CloudWatch Agent for Windows are installed directly to an Amazon EKS cluster without |
acw-ug-199 | acw-ug.pdf | 199 | the Fluentd-compatible configuration, see Set up Fluent Bit as a DaemonSet to send logs to CloudWatch Logs. The CloudWatch agent operator is an additional container that gets installed to an Amazon EKS cluster. It is modeled after the OpenTelemetry Operator for Kubernetes. The operator manages the lifecycle of Kubernetes resources in a cluster. It installs the CloudWatch Agent, DCGM Exporter Setting up Container Insights 562 Amazon CloudWatch User Guide (NVIDIA), and the AWS Neuron Monitor on an Amazon EKS cluster and manages them. Fluent Bit and the CloudWatch Agent for Windows are installed directly to an Amazon EKS cluster without the operator managing them. For a more secure and feature-rich certificate authority solution, the CloudWatch agent operator requires cert-manager, a widely-adopted solution for TLS certificate management in Kubernetes. Using cert-manager simplifies the process of obtaining, renewing, managing and using these certificates. It ensures that certificates are valid and up to date, and attempts to renew certificates at a configured time before expiry. cert-manager also facilitates issuing certificates from a variety of supported sources, including AWS Certificate Manager Private Certificate Authority. To deploy Container Insights using the quick start 1. Install cert-manager if it is not already installed in the cluster. For more information, see cert- manager Installation. 2. Install the custom resource definitions (CRD) by entering the following commmand. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/main/k8s-quickstart/cwagent-custom-resource-definitions.yaml | kubectl apply --server-side -f - 3. Install the operator by entering the following command. Replace my-cluster-name with the name of your Amazon EKS or Kubernetes cluster, and replace my-cluster-region with the name of the Region where the logs are published. We recommend that you use the same Region where your cluster is deployed to reduce the AWS outbound data transfer costs. ClusterName=my-cluster-name RegionName=my-cluster-region curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/ {{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl apply -f - For example, to deploy Container Insights on the cluster named MyCluster and publish the logs and metrics to US West (Oregon), enter the following command. ClusterName='MyCluster' RegionName='us-west-2' curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/ Setting up Container Insights 563 Amazon CloudWatch User Guide {{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl apply -f - Migrating from Container Insights If you already have Container Insights configured in an Amazon EKS cluster and you want to migrate to Container Insights with enhanced observability for Amazon EKS, see Upgrading to Container Insights with enhanced observability for Amazon EKS in CloudWatch Deleting Container Insights If you want to remove Container Insights after using the quick start setup, enter the following commands. ClusterName=my-cluster-name RegionName=my-cluster-region curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/ {{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl delete -f - curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/main/k8s-quickstart/cwagent-custom-resource-definitions.yaml | kubectl delete -f - Setting up the CloudWatch agent to collect cluster metrics Important If you are installing Container Insights on on Amazon EKS cluster, we recommend that you use the Amazon CloudWatch Observability EKS add-on for the installation, instead of using the instructions in this section. For more information and instructions, see Quick start with the Amazon CloudWatch Observability EKS add-on. To set up Container Insights to collect metrics, you can follow the steps in Quick Start setup for Container Insights on Amazon EKS and Kubernetes or you can follow the steps in this section. In the following steps, you set up the CloudWatch agent to be able to collect metrics from your clusters. Setting up Container Insights 564 Amazon CloudWatch User Guide If you are installing in an Amazon EKS cluster and you use the instructions in this section on or after November 6, 2023, you install Container Insights with enhanced observability for Amazon EKS in the cluster. Step 1: Create a namespace for CloudWatch Use the following step to create a Kubernetes namespace called amazon-cloudwatch for CloudWatch. You can skip this step if you have already created this namespace. To create a namespace for CloudWatch • Enter the following command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ daemonset/container-insights-monitoring/cloudwatch-namespace.yaml Step 2: Create a service account in the cluster Use one of the following methods to create a service account for the CloudWatch agent, if you do not already have one. • Use kubectl • Use a kubeconfig file Use kubectl for authentication To use kubectl to create a service account for the CloudWatch agent • Enter the following command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ daemonset/container-insights-monitoring/cwagent/cwagent-serviceaccount.yaml If you didn't follow the previous steps, but you already have a service account for the CloudWatch agent that you want to use, you must ensure that it has the following rules. Additionally, in the rest Setting up Container Insights 565 Amazon CloudWatch User Guide of the steps in the Container Insights installation, you must use the name of that service account instead of cloudwatch-agent. rules: - apiGroups: [""] resources: ["pods", "nodes", "endpoints"] verbs: ["list", "watch"] - apiGroups: [ "" ] resources: [ "services" ] verbs: [ "list", "watch" ] - apiGroups: ["apps"] resources: ["replicasets", "daemonsets", "deployments", "statefulsets"] |
acw-ug-200 | acw-ug.pdf | 200 | container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ daemonset/container-insights-monitoring/cwagent/cwagent-serviceaccount.yaml If you didn't follow the previous steps, but you already have a service account for the CloudWatch agent that you want to use, you must ensure that it has the following rules. Additionally, in the rest Setting up Container Insights 565 Amazon CloudWatch User Guide of the steps in the Container Insights installation, you must use the name of that service account instead of cloudwatch-agent. rules: - apiGroups: [""] resources: ["pods", "nodes", "endpoints"] verbs: ["list", "watch"] - apiGroups: [ "" ] resources: [ "services" ] verbs: [ "list", "watch" ] - apiGroups: ["apps"] resources: ["replicasets", "daemonsets", "deployments", "statefulsets"] verbs: ["list", "watch"] - apiGroups: ["batch"] resources: ["jobs"] verbs: ["list", "watch"] - apiGroups: [""] resources: ["nodes/proxy"] verbs: ["get"] - apiGroups: [""] resources: ["nodes/stats", "configmaps", "events"] verbs: ["create", "get"] - apiGroups: [""] resources: ["configmaps"] resourceNames: ["cwagent-clusterleader"] verbs: ["get","update"] - nonResourceURLs: ["/metrics"] verbs: ["get", "list", "watch"] Use kubeconfig for authentication Alternatively, you can use a kubeconfig file for authentication. This method allows you to bypass the need for a service account b directly specifying the kubeconfig path in your CloudWatch agent configuration. It also allows you to remove your dependency on the Kubernetes control plane API for authentication, streamlining your setup and potentially increasing security by managing authentication through your kubeconfig file. To use this method, update your CloudWatch agent configuration file to specify the path to your kubeconfig file, as in the following example. { "logs": { Setting up Container Insights 566 Amazon CloudWatch User Guide "metrics_collected": { "kubernetes": { "cluster_name": "YOUR_CLUSTER_NAME", "enhanced_container_insights": false, "accelerated_compute_metrics": false, "tag_service": false, "kube_config_path": "/path/to/your/kubeconfig" "host_ip": "HOSTIP" } } } } To create a kubeconfig file, create a Certificate Signing Request (CSR) for the admin/ {create_your_own_user} user with the system:masters Kubernetes role. Then sign with Kubernetes cluster’s Certificate Authority (CA) and create the kubeconfig file. Step 3: Create a ConfigMap for the CloudWatch agent Use the following steps to create a ConfigMap for the CloudWatch agent. To create a ConfigMap for the CloudWatch agent 1. Download the ConfigMap YAML to your kubectl client host by running the following command: curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/ container-insights-monitoring/cwagent/cwagent-configmap-enhanced.yaml 2. Edit the downloaded YAML file, as follows: • cluster_name – In the kubernetes section, replace {{cluster_name}} with the name of your cluster. Remove the {{}} characters. Alternatively, if you're using an Amazon EKS cluster, you can delete the "cluster_name" field and value. If you do, the CloudWatch agent detects the cluster name from the Amazon EC2 tags. 3. (Optional) Make further changes to the ConfigMap based on your monitoring requirements, as follows: Setting up Container Insights 567 Amazon CloudWatch User Guide • metrics_collection_interval – In the kubernetes section, you can specify how often the agent collects metrics. The default is 60 seconds. The default cadvisor collection interval in kubelet is 15 seconds, so don't set this value to less than 15 seconds. • endpoint_override – In the logs section, you can specify the CloudWatch Logs endpoint if you want to override the default endpoint. You might want to do this if you're publishing from a cluster in a VPC and you want the data to go to a VPC endpoint. • force_flush_interval – In the logs section, you can specify the interval for batching log events before they are published to CloudWatch Logs. The default is 5 seconds. • region – By default, the agent published metrics to the Region where the worker node is located. To override this, you can add a region field in the agent section: for example, "region":"us-west-2". • statsd section – If you want the CloudWatch Logs agent to also run as a StatsD listener in each worker node of your cluster, you can add a statsd section to the metrics section, as in the following example. For information about other StatsD options for this section, see Retrieve custom metrics with StatsD. "metrics": { "metrics_collected": { "statsd": { "service_address":":8125" } } } A full example of the JSON section is as follows. If you're using a kubeconfig file for authentication, add the kube_config_path parameter to specify the path to your kubeconfig file. { "agent": { "region": "us-east-1" }, "logs": { "metrics_collected": { "kubernetes": { "cluster_name": "MyCluster", "metrics_collection_interval": 60, Setting up Container Insights 568 Amazon CloudWatch User Guide "kube_config_path": "/path/to/your/kubeconfig" //if using kubeconfig for authentication } }, "force_flush_interval": 5, "endpoint_override": "logs.us-east-1.amazonaws.com" }, "metrics": { "metrics_collected": { "statsd": { "service_address": ":8125" } } } } 4. Create the ConfigMap in the cluster by running the following command. kubectl apply -f cwagent-configmap-enhanced.yaml Step 4: Deploy the CloudWatch agent as a DaemonSet To finish the installation of the CloudWatch agent and begin collecting container metrics, use the following steps. To deploy the CloudWatch agent as a DaemonSet 1. • If you do not want to use StatsD on the cluster, enter the following command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent- |
acw-ug-201 | acw-ug.pdf | 201 | Guide "kube_config_path": "/path/to/your/kubeconfig" //if using kubeconfig for authentication } }, "force_flush_interval": 5, "endpoint_override": "logs.us-east-1.amazonaws.com" }, "metrics": { "metrics_collected": { "statsd": { "service_address": ":8125" } } } } 4. Create the ConfigMap in the cluster by running the following command. kubectl apply -f cwagent-configmap-enhanced.yaml Step 4: Deploy the CloudWatch agent as a DaemonSet To finish the installation of the CloudWatch agent and begin collecting container metrics, use the following steps. To deploy the CloudWatch agent as a DaemonSet 1. • If you do not want to use StatsD on the cluster, enter the following command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent- daemonset.yaml • If you do want to use StatsD, follow these steps: a. Download the DaemonSet YAML to your kubectl client host by running the following command. Setting up Container Insights 569 Amazon CloudWatch User Guide curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment- mode/daemonset/container-insights-monitoring/cwagent/cwagent-daemonset.yaml b. Uncomment the port section in the cwagent-daemonset.yaml file as in the following: ports: - containerPort: 8125 hostPort: 8125 protocol: UDP c. Deploy the CloudWatch agent in your cluster by running the following command. kubectl apply -f cwagent-daemonset.yaml d. Deploy the CloudWatch agent on Windows nodes in your cluster by running the following command. The StatsD listener is not supported on the CloudWatch agent on Windows. kubectl apply -f cwagent-daemonset-windows.yaml 2. Validate that the agent is deployed by running the following command. kubectl get pods -n amazon-cloudwatch When complete, the CloudWatch agent creates a log group named /aws/ containerinsights/Cluster_Name/performance and sends the performance log events to this log group. If you also set up the agent as a StatsD listener, the agent also listens for StatsD metrics on port 8125 with the IP address of the node where the application pod is scheduled. Troubleshooting If the agent doesn't deploy correctly, try the following: • Run the following command to get the list of pods. kubectl get pods -n amazon-cloudwatch Setting up Container Insights 570 Amazon CloudWatch User Guide • Run the following command and check the events at the bottom of the output. kubectl describe pod pod-name -n amazon-cloudwatch • Run the following command to check the logs. kubectl logs pod-name -n amazon-cloudwatch Using AWS Distro for OpenTelemetry You can set up Container Insights to collect metrics from Amazon EKS clusters by using the AWS Distro for OpenTelemetry collector. For more information about the AWS Distro for OpenTelemetry, see AWS Distro for OpenTelemetry. Important If you install using AWS Distro for OpenTelemetry, you install Container Insights but do not get Container Insights with enhanced observability for Amazon EKS. You will not collect the detailed metrics supported in Container Insights with enhanced observability for Amazon EKS. How you set up Container Insights depends on whether the cluster is hosted on Amazon EC2 instances or on AWS Fargate. Amazon EKS clusters hosted on Amazon EC2 If you have not already done so, make sure that you have fulfilled the prerequisites including the necessary IAM roles. For more information, see Verifying prerequisites for Container Insights in CloudWatch. Amazon provides a Helm chart that you can use to set up the monitoring of Amazon Elastic Kubernetes Service on Amazon EC2. This monitoring uses the AWS Distro for OpenTelemetry(ADOT) Collector for metrics and Fluent Bit for logs. Therefore, the Helm chart is useful for customers who use Amazon EKS on Amazon EC2 and want to collect metrics and logs to send to CloudWatch Container Insights. For more information about this Helm chart, see ADOT Helm chart for EKS on EC2 metrics and logs to Amazon CloudWatch Container Insights. Alternatively, you can also use the instructions in the rest of this section. Setting up Container Insights 571 Amazon CloudWatch User Guide First, deploy the AWS Distro for OpenTelemetry collector as a DaemonSet by entering the following command. curl https://raw.githubusercontent.com/aws-observability/aws-otel-collector/main/ deployment-template/eks/otel-container-insights-infra.yaml | kubectl apply -f - To confirm that the collector is running, enter the following command. kubectl get pods -l name=aws-otel-eks-ci -n aws-otel-eks If the output of this command includes multiple pods in the Running state, the collector is running and collecting metrics from the cluster. The collector creates a log group named aws/ containerinsights/cluster-name/performance and sends the performance log events to it. For information about how to see your Container Insights metrics in CloudWatch, see Viewing Container Insights metrics. AWS has also provided documentation on GitHub for this scenario. If you want to customize the metrics and logs published by Container Insights, see https://aws-otel.github.io/docs/getting- started/container-insights/eks-infra. Amazon EKS clusters hosted on Fargate For instructions for how to configure and deploy an ADOT Collector to collect system metrics from workloads deployed to an Amazon EKS cluster on Fargate and send them to CloudWatch Container Insights, see Container Insights EKS Fargate in the AWS Distro for OpenTelemetry documentation. Send logs to CloudWatch Logs To send logs from your containers to Amazon CloudWatch Logs, you can use Fluent |
acw-ug-202 | acw-ug.pdf | 202 | see Viewing Container Insights metrics. AWS has also provided documentation on GitHub for this scenario. If you want to customize the metrics and logs published by Container Insights, see https://aws-otel.github.io/docs/getting- started/container-insights/eks-infra. Amazon EKS clusters hosted on Fargate For instructions for how to configure and deploy an ADOT Collector to collect system metrics from workloads deployed to an Amazon EKS cluster on Fargate and send them to CloudWatch Container Insights, see Container Insights EKS Fargate in the AWS Distro for OpenTelemetry documentation. Send logs to CloudWatch Logs To send logs from your containers to Amazon CloudWatch Logs, you can use Fluent Bit. For more information, see Fluent Bit. Note As of February 10 2025, AWS has deprecated support for FluentD as a log forwarder to CloudWatch Logs. We recommend that you use Fluent Bit, which is a lightweight and resource-efficient alternative. Existing FluentD deployments will continue to function. Setting up Container Insights 572 Amazon CloudWatch User Guide Migrate your logging pipeline to Fluent Bit to ensure continued support and optimal performance. Container Insights previously also supported using FluentD to send logs from your containers. FluentD has been deprecated and is now not supported for Container Insights. Use Fluent Bit instead. Topics • Set up Fluent Bit as a DaemonSet to send logs to CloudWatch Logs • (Optional) Set up Amazon EKS control plane logging • (Optional) Enable the Use_Kubelet feature for large clusters Set up Fluent Bit as a DaemonSet to send logs to CloudWatch Logs The following sections help you deploy Fluent Bit to send logs from containers to CloudWatch Logs. Topics • Setting up Fluent Bit • Multi-line log support • (Optional) Reducing the log volume from Fluent Bit • Troubleshooting • Dashboard Setting up Fluent Bit To set up Fluent Bit to collect logs from your containers, you can follow the steps in Quick Start setup for Container Insights on Amazon EKS and Kubernetes or you can follow the steps in this section. With either method, the IAM role that is attached to the cluster nodes must have sufficient permissions. For more information about the permissions required to run an Amazon EKS cluster, see Amazon EKS IAM Policies, Roles, and Permissions in the Amazon EKS User Guide. In the following steps, you set up Fluent Bit as a daemonSet to send logs to CloudWatch Logs. When you complete this step, Fluent Bit creates the following log groups if they don't already exist. Setting up Container Insights 573 Amazon CloudWatch Important User Guide If you already have FluentD configured in Container Insights and the FluentD DaemonSet is not running as expected (this can happen if you use the containerd runtime), you must uninstall it before installing Fluent Bit to prevent Fluent Bit from processing the FluentD error log messages. Otherwise, you must uninstall FluentD immediately after you have successfully installed Fluent Bit. Uninstalling Fluentd after installing Fluent Bit ensures continuity in logging during this migration process. Only one of Fluent Bit or FluentD is needed to send logs to CloudWatch Logs. Log group name Log source /aws/containerinsights/ Cluster_N All log files in /var/log/containers ame /application /aws/containerinsights/ Cluster_N ame /host Logs from /var/log/dmesg , /var/log/ secure , and /var/log/messages /aws/containerinsights/ Cluster_N ame /dataplane The logs in /var/log/journal for kubelet.service , kubeproxy.service , and docker.service . To install Fluent Bit to send logs from containers to CloudWatch Logs 1. If you don't already have a namespace called amazon-cloudwatch, create one by entering the following command: kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ daemonset/container-insights-monitoring/cloudwatch-namespace.yaml 2. Run the following command to create a ConfigMap named cluster-info with the cluster name and the Region to send logs to. Replace cluster-name and cluster-region with your cluster's name and Region. ClusterName=cluster-name RegionName=cluster-region Setting up Container Insights 574 Amazon CloudWatch User Guide FluentBitHttpPort='2020' FluentBitReadFromHead='Off' [[ ${FluentBitReadFromHead} = 'On' ]] && FluentBitReadFromTail='Off'|| FluentBitReadFromTail='On' [[ -z ${FluentBitHttpPort} ]] && FluentBitHttpServer='Off' || FluentBitHttpServer='On' kubectl create configmap fluent-bit-cluster-info \ --from-literal=cluster.name=${ClusterName} \ --from-literal=http.server=${FluentBitHttpServer} \ --from-literal=http.port=${FluentBitHttpPort} \ --from-literal=read.head=${FluentBitReadFromHead} \ --from-literal=read.tail=${FluentBitReadFromTail} \ --from-literal=logs.region=${RegionName} -n amazon-cloudwatch In this command, the FluentBitHttpServer for monitoring plugin metrics is on by default. To turn it off, change the third line in the command to FluentBitHttpPort='' (empty string) in the command. Also by default, Fluent Bit reads log files from the tail, and will capture only new logs after it is deployed. If you want the opposite, set FluentBitReadFromHead='On' and it will collect all logs in the file system. 3. Download and deploy the Fluent Bit daemonset to the cluster by running one of the following commands. • If you want the Fluent Bit optimized configuration for Linux computers, run this command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent- bit.yaml • If you want the Fluent Bit optimized configuration for Windows computers, run this command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit- windows.yaml Setting up Container Insights 575 Amazon CloudWatch User Guide • |
acw-ug-203 | acw-ug.pdf | 203 | tail, and will capture only new logs after it is deployed. If you want the opposite, set FluentBitReadFromHead='On' and it will collect all logs in the file system. 3. Download and deploy the Fluent Bit daemonset to the cluster by running one of the following commands. • If you want the Fluent Bit optimized configuration for Linux computers, run this command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent- bit.yaml • If you want the Fluent Bit optimized configuration for Windows computers, run this command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit- windows.yaml Setting up Container Insights 575 Amazon CloudWatch User Guide • If you are using Linux computers and want the Fluent Bit configuration that is more similar to Fluentd, run this command. kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon- cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/ deployment-mode/daemonset/container-insights-monitoring/fluent-bit/fluent-bit- compatible.yaml Important The Fluent Bit daemonset configuration by default sets the log level to INFO, which can result in higher CloudWatch Logs ingestion costs. If you want to reduce log ingestion volume and costs, you can change the log level to ERROR. For more information about how to reduce the log volume, see (Optional) Reducing the log volume from Fluent Bit 4. Validate the deployment by entering the following command. Each node should have one pod named fluent-bit-*. kubectl get pods -n amazon-cloudwatch The above steps create the following resources in the cluster: • A service account named Fluent-Bit in the amazon-cloudwatch namespace. This service account is used to run the Fluent Bit daemonSet. For more information, see Managing Service Accounts in the Kubernetes Reference. • A cluster role named Fluent-Bit-role in the amazon-cloudwatch namespace. This cluster role grants get, list, and watch permissions on pod logs to the Fluent-Bit service account. For more information, see API Overview in the Kubernetes Reference. • A ConfigMap named Fluent-Bit-config in the amazon-cloudwatch namespace. This ConfigMap contains the configuration to be used by Fluent Bit. For more information, see Configure a Pod to Use a ConfigMap in the Kubernetes Tasks documentation. If you want to verify your Fluent Bit setup, follow these steps. Setting up Container Insights 576 Amazon CloudWatch Verify the Fluent Bit setup User Guide 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Log groups. 3. Make sure that you're in the Region where you deployed Fluent Bit. 4. Check the list of log groups in the Region. You should see the following: • /aws/containerinsights/Cluster_Name/application • /aws/containerinsights/Cluster_Name/host • /aws/containerinsights/Cluster_Name/dataplane 5. Navigate to one of these log groups and check the Last Event Time for the log streams. If it is recent relative to when you deployed Fluent Bit, the setup is verified. There might be a slight delay in creating the /dataplane log group. This is normal as these log groups only get created when Fluent Bit starts sending logs for that log group. Multi-line log support For information on how to use Fluent Bit with multi-line logs, see the following sections of the Fluent Bit documentation: • Multiline Parsing • Multiline and Containers (v1.8) • Multiline Core (v1.8) • Always use multiline in the tail input (Optional) Reducing the log volume from Fluent Bit By default, we send Fluent Bit application logs and Kubernetes metadata to CloudWatch. If you want to reduce the volume of data being sent to CloudWatch, you can stop one or both of these data sources from being sent to CloudWatch. If you have followed the steps on this page to set up Fluent Bit, download the Kubernetes manifest YAML file from the kubectl apply command that you previously ran and modify it with your changes, which you can then re-apply to your cluster. Alternatively, if you are using the Amazon CloudWatch Observability EKS add-on or Helm chart, see (Optional) Additional configuration for information about managing the Fluent Bit configuration by using the add-on’s advanced config or the Helm chart. Setting up Container Insights 577 Amazon CloudWatch User Guide To stop Fluent Bit application logs, remove the following section from the Fluent Bit configuration file. [INPUT] Name tail Tag application.* Path /var/log/containers/fluent-bit* Parser docker DB /fluent-bit/state/flb_log.db Mem_Buf_Limit 5MB Skip_Long_Lines On Refresh_Interval 10 To remove Kubernetes metadata from being appended to log events that are sent to CloudWatch, add the following filters to the application-log.conf section in the Fluent Bit configuration. Replace <Metadata_1> and the similar fields with with the actual metadata identifiers. application-log.conf: | [FILTER] Name nest Match application.* Operation lift Nested_under kubernetes Add_prefix Kube. [FILTER] Name modify Match application.* Remove Kube.<Metadata_1> Remove Kube.<Metadata_2> Remove Kube.<Metadata_3> [FILTER] Name nest Match application.* Operation nest Wildcard Kube.* Nested_under kubernetes Remove_prefix Kube. Setting up Container Insights 578 Amazon CloudWatch Troubleshooting User Guide If you don't see these log groups and are looking in the correct Region, check the logs for the Fluent Bit daemonSet pods to look for the error. Run the following command and make sure |
acw-ug-204 | acw-ug.pdf | 204 | section in the Fluent Bit configuration. Replace <Metadata_1> and the similar fields with with the actual metadata identifiers. application-log.conf: | [FILTER] Name nest Match application.* Operation lift Nested_under kubernetes Add_prefix Kube. [FILTER] Name modify Match application.* Remove Kube.<Metadata_1> Remove Kube.<Metadata_2> Remove Kube.<Metadata_3> [FILTER] Name nest Match application.* Operation nest Wildcard Kube.* Nested_under kubernetes Remove_prefix Kube. Setting up Container Insights 578 Amazon CloudWatch Troubleshooting User Guide If you don't see these log groups and are looking in the correct Region, check the logs for the Fluent Bit daemonSet pods to look for the error. Run the following command and make sure that the status is Running. kubectl get pods -n amazon-cloudwatch If the logs have errors related to IAM permissions, check the IAM role that is attached to the cluster nodes. For more information about the permissions required to run an Amazon EKS cluster, see Amazon EKS IAM Policies, Roles, and Permissions in the Amazon EKS User Guide. If the pod status is CreateContainerConfigError, get the exact error by running the following command. kubectl describe pod pod_name -n amazon-cloudwatch Dashboard You can create a dashboard to monitor metrics of each running plugin. You can see data for input and output bytes and for record processing rates as well as output errors and retry/failed rates. To view these metrics, you will need to install the CloudWatch agent with Prometheus metrics collection for Amazon EKS and Kubernetes clusters. For more information about how to set up the dashboard, see Install the CloudWatch agent with Prometheus metrics collection on Amazon EKS and Kubernetes clusters. Note Before you can set up this dashboard, you must set up Container Insights for Prometheus metrics. For more information, see Container Insights Prometheus metrics monitoring. To create a dashboard for the Fluent Bit Prometheus metrics 1. Create environment variables, replacing the values on the right in the following lines to match your deployment. DASHBOARD_NAME=your_cw_dashboard_name REGION_NAME=your_metric_region_such_as_us-west-1 Setting up Container Insights 579 Amazon CloudWatch User Guide CLUSTER_NAME=your_kubernetes_cluster_name 2. Create the dashboard by running the following command. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/sample_cloudwatch_dashboards/fluent-bit/cw_dashboard_fluent_bit.json \ | sed "s/{{YOUR_AWS_REGION}}/${REGION_NAME}/g" \ | sed "s/{{YOUR_CLUSTER_NAME}}/${CLUSTER_NAME}/g" \ | xargs -0 aws cloudwatch put-dashboard --dashboard-name ${DASHBOARD_NAME} -- dashboard-body (Optional) Set up Amazon EKS control plane logging If you're using Amazon EKS, you can optionally enable Amazon EKS control plane logging, to provide audit and diagnostic logs directly from the Amazon EKS control plane to CloudWatch Logs. For more information, see Amazon EKS Control Plane Logging. (Optional) Enable the Use_Kubelet feature for large clusters By default, the Use_Kubelet feature is disabled in the FluentBit Kubernetes plugin. Enabling this feature can reduce traffic to the API server and mitigate the issue of the API Server being a bottleneck. We recommend that you enable this feature for large clusters. To enable Use_Kubelet, first add the nodes and nodes/proxy permissions to the clusterRole config. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: fluent-bit-role rules: - nonResourceURLs: - /metrics verbs: - get - apiGroups: [""] resources: - namespaces - pods - pods/logs - nodes - nodes/proxy Setting up Container Insights 580 Amazon CloudWatch User Guide verbs: ["get", "list", "watch"] In the DaemonSet configuration, this feature needs host network access. The image version for amazon/aws-for-fluent-bit should 2.12.0 or later, or the fluent bit image version should be 1.7.2 or later. apiVersion: apps/v1 kind: DaemonSet metadata: name: fluent-bit namespace: amazon-cloudwatch labels: k8s-app: fluent-bit version: v1 kubernetes.io/cluster-service: "true" spec: selector: matchLabels: k8s-app: fluent-bit template: metadata: labels: k8s-app: fluent-bit version: v1 kubernetes.io/cluster-service: "true" spec: containers: - name: fluent-bit image: amazon/aws-for-fluent-bit:2.19.0 imagePullPolicy: Always env: - name: AWS_REGION valueFrom: configMapKeyRef: name: fluent-bit-cluster-info key: logs.region - name: CLUSTER_NAME valueFrom: configMapKeyRef: name: fluent-bit-cluster-info key: cluster.name - name: HTTP_SERVER valueFrom: Setting up Container Insights 581 Amazon CloudWatch User Guide configMapKeyRef: name: fluent-bit-cluster-info key: http.server - name: HTTP_PORT valueFrom: configMapKeyRef: name: fluent-bit-cluster-info key: http.port - name: READ_FROM_HEAD valueFrom: configMapKeyRef: name: fluent-bit-cluster-info key: read.head - name: READ_FROM_TAIL valueFrom: configMapKeyRef: name: fluent-bit-cluster-info key: read.tail - name: HOST_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: HOSTNAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: CI_VERSION value: "k8s/1.3.8" resources: limits: memory: 200Mi requests: cpu: 500m memory: 100Mi volumeMounts: # Please don't change below read-only permissions - name: fluentbitstate mountPath: /var/fluent-bit/state - name: varlog mountPath: /var/log readOnly: true - name: varlibdockercontainers mountPath: /var/lib/docker/containers Setting up Container Insights 582 Amazon CloudWatch User Guide readOnly: true - name: fluent-bit-config mountPath: /fluent-bit/etc/ - name: runlogjournal mountPath: /run/log/journal readOnly: true - name: dmesg mountPath: /var/log/dmesg readOnly: true terminationGracePeriodSeconds: 10 hostNetwork: true dnsPolicy: ClusterFirstWithHostNet volumes: - name: fluentbitstate hostPath: path: /var/fluent-bit/state - name: varlog hostPath: path: /var/log - name: varlibdockercontainers hostPath: path: /var/lib/docker/containers - name: fluent-bit-config configMap: name: fluent-bit-config - name: runlogjournal hostPath: path: /run/log/journal - name: dmesg hostPath: path: /var/log/dmesg serviceAccountName: fluent-bit tolerations: - key: node-role.kubernetes.io/master operator: Exists effect: NoSchedule - operator: "Exists" effect: "NoExecute" - operator: "Exists" effect: "NoSchedule" The Kubernetes Plugin configuration should be similar |
acw-ug-205 | acw-ug.pdf | 205 | Setting up Container Insights 582 Amazon CloudWatch User Guide readOnly: true - name: fluent-bit-config mountPath: /fluent-bit/etc/ - name: runlogjournal mountPath: /run/log/journal readOnly: true - name: dmesg mountPath: /var/log/dmesg readOnly: true terminationGracePeriodSeconds: 10 hostNetwork: true dnsPolicy: ClusterFirstWithHostNet volumes: - name: fluentbitstate hostPath: path: /var/fluent-bit/state - name: varlog hostPath: path: /var/log - name: varlibdockercontainers hostPath: path: /var/lib/docker/containers - name: fluent-bit-config configMap: name: fluent-bit-config - name: runlogjournal hostPath: path: /run/log/journal - name: dmesg hostPath: path: /var/log/dmesg serviceAccountName: fluent-bit tolerations: - key: node-role.kubernetes.io/master operator: Exists effect: NoSchedule - operator: "Exists" effect: "NoExecute" - operator: "Exists" effect: "NoSchedule" The Kubernetes Plugin configuration should be similar to the following: Setting up Container Insights 583 Amazon CloudWatch User Guide [FILTER] Name kubernetes Match application.* Kube_URL https://kubernetes.default.svc:443 Kube_Tag_Prefix application.var.log.containers. Merge_Log On Merge_Log_Key log_processed K8S-Logging.Parser On K8S-Logging.Exclude Off Labels Off Annotations Off Use_Kubelet On Kubelet_Port 10250 Buffer_Size 0 Updating or deleting Container Insights on Amazon EKS and Kubernetes Use the steps in these sections to update your CloudWatch agent container image, or to remove Container Insights from an Amazon EKS or Kubernetes cluster. Topics • Upgrading to Container Insights with enhanced observability for Amazon EKS in CloudWatch • Updating the CloudWatch agent container image • Deleting the CloudWatch agent and Fluent Bit for Container Insights Upgrading to Container Insights with enhanced observability for Amazon EKS in CloudWatch Important If you are upgrading or installing Container Insights on an Amazon EKS cluster, we recommend that you use the Amazon CloudWatch Observability EKS add-on for the installation, instead of using the instructions in this section. Additionally, to retrieve accelerated computing metrics, you must use the Amazon CloudWatch Observability EKS add-on. For more information and instructions, see Quick start with the Amazon CloudWatch Observability EKS add-on. Container Insights with enhanced observability for Amazon EKS is the newest version of Container Insights. It collects detailed metrics from clusters running Amazon EKS and offers curated, Setting up Container Insights 584 Amazon CloudWatch User Guide immediately usable dashboards to drill down into application and infrastructure telemetry. For more information about this version of Container Insights, see Container Insights with enhanced observability for Amazon EKS. If you have installed the original version of Container Insights in an Amazon EKS cluster and you want to upgrade it to the newer version with enhanced observability, follow the instructions in this section. Important Before completing the steps in this section, you must have verified the prerequisites including cert-manager. For more information, see Quick Start with the CloudWatch agent operator and Fluent Bit. To upgrade an Amazon EKS cluster to Container Insights with enhanced observability for Amazon EKS 1. Install the CloudWatch agent operator by entering the following command. Replace my- cluster-name with the name of your Amazon EKS or Kubernetes cluster, and replace my- cluster-region with the name of the Region where the logs are published. We recommend that you use the same Region where your cluster is deployed to reduce the AWS outbound data transfer costs. ClusterName=my-cluster-name RegionName=my-cluster-region curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/ {{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl apply -f - If you notice a failure caused by conflicting resources, it is likely because you already have the CloudWatch agent and Fluent Bit with its associated components such as the ServiceAccount, the ClusterRole and the ClusterRoleBinding installed on the cluster. When the CloudWatch agent operator tries to install the CloudWatch agent and its associated components, if it detects any change in the contents, it by default fails the installation or update to avoid overwriting the state of the resources on the cluster. We recommend that you delete any existing CloudWatch agent with Container Insights setup that you had previously installed on the cluster, and then install the CloudWatch agent operator. Setting up Container Insights 585 Amazon CloudWatch User Guide 2. (Optional) To apply an existing custom Fluent Bit configuration, you must update the configmap associated with the Fluent Bit daemonset. The CloudWatch agent operator provides a default configuration for Fluent Bit, and you can override or modify the default configuration as needed. To apply a custom configuration, follow these steps. a. Open the existing configuration by entering the following command. kubectl edit cm fluent-bit-config -n amazon-cloudwatch b. Make your changes in the file, then enter :wq to save the file and exit edit mode. c. Restart Fluent Bit by entering the following command. kubectl rollout restart ds fluent-bit -n amazon-cloudwatch Updating the CloudWatch agent container image Important If you are upgrading or installing Container Insights on an Amazon EKS cluster, we recommend that you use the Amazon CloudWatch Observability EKS add-on for the installation, instead of using the instructions in this section. Additionally, to retrieve accelerated computing metrics, you must use the Amazon CloudWatch Observability EKS add-on or the CloudWatch agent operator. For more information and instructions, see Quick start with the Amazon CloudWatch Observability EKS add-on. If you |
acw-ug-206 | acw-ug.pdf | 206 | file and exit edit mode. c. Restart Fluent Bit by entering the following command. kubectl rollout restart ds fluent-bit -n amazon-cloudwatch Updating the CloudWatch agent container image Important If you are upgrading or installing Container Insights on an Amazon EKS cluster, we recommend that you use the Amazon CloudWatch Observability EKS add-on for the installation, instead of using the instructions in this section. Additionally, to retrieve accelerated computing metrics, you must use the Amazon CloudWatch Observability EKS add-on or the CloudWatch agent operator. For more information and instructions, see Quick start with the Amazon CloudWatch Observability EKS add-on. If you need to update your container image to the latest version, use the steps in this section. To update your container image 1. Verify if the amazoncloudwatchagent Customer Resource Definition (CRD) already exists by entering the following command. kubectl get crds amazoncloudwatchagents.cloudwatch.aws.amazon.com -n amazon- cloudwatch If this command returns an error that the CRD is missing, the cluster doesn't have Container Insights with enhanced observabilit for Amazon EKS configured with the CloudWatch agent Setting up Container Insights 586 Amazon CloudWatch User Guide operator. In this case, see Upgrading to Container Insights with enhanced observability for Amazon EKS in CloudWatch. 2. Apply the latest cwagent-version.yaml file by entering the following command. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/main/k8s-quickstart/cwagent-version.yaml | kubectl apply -f - Deleting the CloudWatch agent and Fluent Bit for Container Insights If you installed Container Insights by using installing the CloudWatch Observability add-on for Amazon EKS, you can delete Container Insights and the CloudWatch agent by entering the following command: Note The Amazon EKS add-on now supports Container Insights on Windows worker nodes. If you delete the Amazon EKS add-on, Container Insights for Windows is also deleted. aws eks delete-addon —cluster-name my-cluster —addon-name amazon-cloudwatch- observability Otherwise, to delete all resources related to the CloudWatch agent and Fluent Bit, enter the following command. In this command, My_Cluster_Name is the name of your Amazon EKS or Kubernetes cluster, and My_Region is the name of the Region where the logs are published. ClusterName=My_Cluster_Name RegionName=My-Region curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/main/k8s-quickstart/cwagent-operator-rendered.yaml | sed 's/ {{cluster_name}}/'${ClusterName}'/g;s/{{region_name}}/'${RegionName}'/g' | kubectl delete -f - curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/main/k8s-quickstart/cwagent-custom-resource-definitions.yaml | kubectl delete -f - Setting up Container Insights 587 Amazon CloudWatch User Guide Setting up Container Insights on RedHat OpenShift on AWS (ROSA) CloudWatch Container Insights with enhanced observability supports RedHat OpenShift on AWS (ROSA). This version supports enhanced observability for ROSA clusters. After you install the CloudWatch agent operator Helm chart, Container Insights auto-collects detailed infrastructure telemetry from the cluster level down to the container level in your environment. It then displays this performance data in curated dashboards removing the heavy lifting in observability setup. Note For RedHat for OpenShift on AWS (ROSA), when you install the CloudWatch agent operator using helm charts, the CloudWatch agent is by default also enabled to receive both metrics and traces from your applications that are instrumented for Application Signals. If you would like to optionally pass in custom configuration rules, you can do so by passing in a custom agent configuration by using the Helm chart, as outlined in (Optional) [Additional configuration], as outlined in (Optional) Additional configuration. To install Container Insights with enhanced observability on a RedHat OpenShift on AWS (ROSA) cluster 1. If necessary, install Helm. For more information, see Quickstart Guide in the Helm documentation. 2. Install the CloudWatch agent operator by entering the following commands. Replace my- cluster-name with the name of your cluster, and replace my-cluster-region with the Region that the cluster runs in. helm repo add aws-observability https://aws-observability.github.io/helm-charts helm repo update aws-observability helm install --wait --create-namespace \ --namespace amazon-cloudwatch amazon-cloudwatch-observability \ aws-observability/amazon-cloudwatch-observability \ --set clusterName=my-cluster-name \ --set region=my-cluster-region \ --set k8sMode=ROSA 3. Set up authorization for the agent operator by following the steps in Option 1, Option 2, or Option 3 in Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add- on or the Helm chart. Setting up Container Insights 588 Amazon CloudWatch User Guide Viewing Container Insights metrics After you have Container Insights set up and it is collecting metrics, you can view those metrics in the CloudWatch console. For Container Insights metrics to appear on your dashboard, you must complete the Container Insights setup. For more information, see Setting up Container Insights. This procedure explains how to view the metrics that Container Insights automatically generates from the collected log data. The rest of this section explains how to further dive into your data and use CloudWatch Logs Insights to see more metrics at more levels of granularity. To view Container Insights metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Insights, Container Insights. 3. Use the drop-down boxes near the top to select the type of resource to view, as well as the specific resource. You can set a CloudWatch alarm on any metric |
acw-ug-207 | acw-ug.pdf | 207 | up Container Insights. This procedure explains how to view the metrics that Container Insights automatically generates from the collected log data. The rest of this section explains how to further dive into your data and use CloudWatch Logs Insights to see more metrics at more levels of granularity. To view Container Insights metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Insights, Container Insights. 3. Use the drop-down boxes near the top to select the type of resource to view, as well as the specific resource. You can set a CloudWatch alarm on any metric that Container Insights collects. For more information, see Using Amazon CloudWatch alarms Note If you have already set up CloudWatch Application Insights to monitor your containerized applications, the Application Insights dashboard appears below the Container Insights dashboard. If you have not already enabled Application Insights, you can do so by choosing Auto-configure Application Insights below the performance view in the Container Insights dashboard. For more information about Application Insights and containerized applications, see Enable Application Insights for Amazon ECS and Amazon EKS resource monitoring. Viewing the top contributors For some of the views in Container Insights performance monitoring, you can also see the top contributors by memory or CPU, or the most recently active resources. This is available when you select any of the following dashboards in the drop-down box near the top of the page: Viewing Container Insights metrics 589 Amazon CloudWatch • ECS Services • ECS Tasks • EKS Namespaces • EKS Services • EKS Pods User Guide When you are viewing one of these types of resources, the bottom of the page displays a table sorted initially by CPU usage. You can change it to sort by memory usage or recent activity. To see more about one of the rows in the table, you can select the checkbox next to that row and then choose Actions and choose one of the options in the Actions menu. Using CloudWatch Logs Insights to view Container Insights data Container Insights collects metrics by using performance log events with using embedded metric format. The logs are stored in CloudWatch Logs. CloudWatch generates several metrics automatically from the logs which you can view in the CloudWatch console. You can also do a deeper analysis of the performance data that is collected by using CloudWatch Logs Insights queries. For more information about CloudWatch Logs Insights, see Analyze Log Data with CloudWatch Logs Insights. For more information about the log fields you can use in queries, see Container Insights performance log events for Amazon EKS and Kubernetes. To use CloudWatch Logs Insights to query your container metric data 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Logs, Logs Insights. Near the top of the screen is the query editor. When you first open CloudWatch Logs Insights, this box contains a default query that returns the 20 most recent log events. 3. In the box above the query editor, select one of the Container Insights log groups to query. For the following example queries to work, the log group name must end with performance. When you select a log group, CloudWatch Logs Insights automatically detects fields in the data in the log group and displays them in Discovered fields in the right pane. It also displays a bar graph of log events in this log group over time. This bar graph shows the distribution of events in the log group that matches your query and time range, not only the events displayed in the table. Viewing Container Insights metrics 590 Amazon CloudWatch User Guide 4. In the query editor, replace the default query with the following query and choose Run query. STATS avg(node_cpu_utilization) as avg_node_cpu_utilization by NodeName | SORT avg_node_cpu_utilization DESC This query shows a list of nodes, sorted by average node CPU utilization. 5. To try another example, replace that query with another query and choose Run query. More sample queries are listed later on this page. STATS avg(number_of_container_restarts) as avg_number_of_container_restarts by PodName | SORT avg_number_of_container_restarts DESC This query displays a list of your pods, sorted by average number of container restarts. 6. If you want to try another query, you can use include fields in the list at the right of the screen. For more information about query syntax, see CloudWatch Logs Insights Query Syntax. To see lists of your resources 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Resources. The default view is a list of your resources being monitored by Container Insights, and alarms that you have set on these resources. To see a visual map of the resources, choose Map view. 4. From the map view, you can pause your pointer over any resource in the map to see |
acw-ug-208 | acw-ug.pdf | 208 | query, you can use include fields in the list at the right of the screen. For more information about query syntax, see CloudWatch Logs Insights Query Syntax. To see lists of your resources 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Resources. The default view is a list of your resources being monitored by Container Insights, and alarms that you have set on these resources. To see a visual map of the resources, choose Map view. 4. From the map view, you can pause your pointer over any resource in the map to see basic metrics about that resource. You can choose any resource to see more detailed graphs about the resource. Use case: Seeing task-level metrics in Amazon ECS containers The following example illustrates how to use CloudWatch Logs Insights to dive deeper into your Container Insights logs. For more examples, see the blog Introducing Amazon CloudWatch Container Insights for Amazon ECS. Container Insights does not automatically generate metrics at the Task level of granularity. The following query displays task-level metrics for CPU and memory usage. stats avg(CpuUtilized) as CPU, avg(MemoryUtilized) as Mem by TaskId, ContainerName Viewing Container Insights metrics 591 Amazon CloudWatch | sort Mem, CPU desc User Guide Other sample queries for Container Insights List of your pods, sorted by average number of container restarts STATS avg(number_of_container_restarts) as avg_number_of_container_restarts by PodName | SORT avg_number_of_container_restarts DESC Pods requested vs. pods running fields @timestamp, @message | sort @timestamp desc | filter Type="Pod" | stats min(pod_number_of_containers) as requested, min(pod_number_of_running_containers) as running, ceil(avg(pod_number_of_containers- pod_number_of_running_containers)) as pods_missing by kubernetes.pod_name | sort pods_missing desc Count of cluster node failures stats avg(cluster_failed_node_count) as CountOfNodeFailures | filter Type="Cluster" | sort @timestamp desc Application log errors by container name stats count() as countoferrors by kubernetes.container_name | filter stream="stderr" | sort countoferrors desc Metrics collected by Container Insights Container Insights collects one set of metrics for Amazon ECS and AWS Fargate on Amazon ECS, and a different set for Amazon EKS, AWS Fargate on Amazon EKS, RedHat OpenShift on AWS (ROSA), and Kubernetes. Metrics are not visible until the container tasks have been running for some time. Topics Metrics collected by Container Insights 592 Amazon CloudWatch User Guide • Amazon ECS Container Insights with enhanced observability metrics • Amazon ECS Container Insights metrics • Amazon EKS and Kubernetes Container Insights with enhanced observability metrics • Amazon EKS and Kubernetes Container Insights metrics Amazon ECS Container Insights with enhanced observability metrics The following table lists the metrics and dimensions that Container Insights with enhanced observability collects for Amazon ECS. These metrics are in the ECS/ContainerInsights namespace. For more information, see Metrics. If you do not see any Container Insights metrics in your console, be sure that you have completed the setup of Container Insights with enhanced observability. Metrics do not appear before Container Insights with enhanced observability has been set up completely. For more information, see Set up Container Insights with enhanced observability. The following metrics are available for all launch types. Metric name Dimensions Description ContainerInstanceCount ClusterName The number of EC2 instances running the Amazon ECS agent that are registered with a cluster. This metric is collected only for container instances that are running Amazon ECS tasks in the cluster. It is not collected for empty container instances that do not have any Amazon ECS tasks. Unit: Count Metrics collected by Container Insights 593 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerCpuUtilized ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName , TaskId TaskDefinitionFami ly , ClusterName , ContainerName ServiceName , ClusterName , ContainerName ContainerCpuReserved ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName , TaskId TaskDefinitionFami ly , ClusterName , ContainerName ServiceName , ClusterName , ContainerName The CPU units used by containers in the resource that is specified by the dimension set that you're using. Unit: None The CPU units reserved by containers in the resource that is specified by the dimension set that you're using. This metric is collected based on the CPU reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance CPU reservation is used. Unit: None Metrics collected by Container Insights 594 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerCpuUtilization TaskDefinitionFami ly , ClusterName The total percentage of CPU units being used ServiceName , ClusterName ClusterName by containers in the resource that is specified by the dimension set that you're using. ClusterName , ServiceName , TaskId Unit: Percent ClusterName , TaskDefinitionFami ly , TaskId The memory being used by containers in the resource that is specified by the dimension set that you're using. Unit: Megabytes ContainerMemoryUtilized ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName |
acw-ug-209 | acw-ug.pdf | 209 | CPU reservation is used. Unit: None Metrics collected by Container Insights 594 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerCpuUtilization TaskDefinitionFami ly , ClusterName The total percentage of CPU units being used ServiceName , ClusterName ClusterName by containers in the resource that is specified by the dimension set that you're using. ClusterName , ServiceName , TaskId Unit: Percent ClusterName , TaskDefinitionFami ly , TaskId The memory being used by containers in the resource that is specified by the dimension set that you're using. Unit: Megabytes ContainerMemoryUtilized ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName , TaskId TaskDefinitionFami ly , ClusterName , ContainerName ServiceName , ClusterName , ContainerName Metrics collected by Container Insights 595 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerMemoryReserved ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName , TaskId TaskDefinitionFami ly , ClusterName , ContainerName ServiceName , ClusterName , ContainerName The memory that is reserved by container s in the resource that is specified by the dimension set that you're using. This metric is collected based on the memory reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance memory reservation is used. Unit: Megabytes Metrics collected by Container Insights 596 Amazon CloudWatch Metric name Dimensions Description User Guide The total percentage of memory being used by containers in the resource that is specified by the dimension set that you're using. Unit: Percent ContainerMemoryUtilization ClusterName ContainerName , TaskId, ServiceName , ClusterName ContainerName , TaskDefinitionFami ly , ClusterName , TaskId TaskDefinitionFami ly , ClusterName , ContainerName ServiceName , ClusterName , ContainerName ContainerNetworkRxBytes TaskDefinitionFami ly , ClusterName The number of bytes received by the container ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second Metrics collected by Container Insights 597 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerNetworkTxBytes TaskDefinitionFami ly , ClusterName The number of bytes transmitted by the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId container that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second ContainerStorageReadBytes TaskDefinitionFami ly , ClusterName The number of bytes read from storage on the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId container in the resource that is specified by the dimensions that you're using. This does not include read bytes for your storage devices. This metric is obtained from the Docker runtime. Unit: Bytes Metrics collected by Container Insights 598 Amazon CloudWatch Metric name Dimensions Description User Guide ContainerStorageWriteBytes TaskDefinitionFami ly , ClusterName The number of bytes written to storage in the container that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. Unit: Bytes ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId CpuUtilized TaskDefinitionFami ly , ClusterName The CPU units used by tasks in the resource that is specified by the dimension set that you're using. Unit: None ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId Metrics collected by Container Insights 599 Amazon CloudWatch Metric name CpuReserved User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The CPU units reserved by tasks in the resource ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId DeploymentCount ServiceName , ClusterName that is specified by the dimension set that you're using. This metric is collected based on the CPU reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance CPU reservation is used. Unit: None The number of deployments in an Amazon ECS service. Unit: Count DesiredTaskCount ServiceName , ClusterName The desired number of tasks for an Amazon ECS service. Unit: Count Metrics collected by Container Insights 600 Amazon CloudWatch Metric name EBSFilesystemSize Dimensions Description User Guide ClusterName ,TaskDefin itionFamily , VolumeName TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The total amount, in gigabytes (GB), of Amazon EBS filesystem storage that is allocated to the resources specified by the dimensions you're using. This metric is only available for tasks that run on Amazon ECS infrastructure running on Fargate using platform version 1.4.0 or Amazon EC2 instances using container agent version 1.79.0 or later. Unit: Gigabytes (GB) Metrics collected by Container |
acw-ug-210 | acw-ug.pdf | 210 | The desired number of tasks for an Amazon ECS service. Unit: Count Metrics collected by Container Insights 600 Amazon CloudWatch Metric name EBSFilesystemSize Dimensions Description User Guide ClusterName ,TaskDefin itionFamily , VolumeName TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The total amount, in gigabytes (GB), of Amazon EBS filesystem storage that is allocated to the resources specified by the dimensions you're using. This metric is only available for tasks that run on Amazon ECS infrastructure running on Fargate using platform version 1.4.0 or Amazon EC2 instances using container agent version 1.79.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 601 Amazon CloudWatch Metric name EBSFilesystemUtilized Dimensions Description User Guide ClusterName ,TaskDefin itionFamily , VolumeName TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The total amount, in gigabytes (GB), of Amazon EBS filesyste m storage that is being used by the resources specified by the dimensions that you're using. This metric is only available for tasks that run on Amazon ECS infrastructure running on Fargate using platform version 1.4.0 or Amazon EC2 instances using container agent version 1.79.0 or later. For tasks run on Fargate, Fargate reserves space on the disk that is only used by Fargate. There is no cost associated with the space Fargate uses, but you will see this additional storage using tools like df. Unit: Gigabytes (GB) Metrics collected by Container Insights 602 Amazon CloudWatch Metric name Dimensions Description User Guide EphemeralStorageReserved 1 TaskDefinitionFami ly , ClusterName The number of bytes reserved from ephemeral ServiceName , ClusterName ClusterName storage in the resource that is specified by the dimensions that you're using. Ephemeral storage is used for the container ClusterName , ServiceName , TaskId root filesystem and any bind mount host ClusterName , TaskDefinitionFami ly , TaskId volumes defined in the container image and task definition. The amount of ephemeral storage can’t be changed in a running task. This metric is only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 603 Amazon CloudWatch Metric name MemoryUtilized User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The memory being used by tasks in the resource that is specified by the dimension set that you're using. Unit: Megabytes ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId MemoryReserved TaskDefinitionFami ly , ClusterName The memory that is reserved by tasks in the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId resource that is specified by the dimension set that you're using. This metric is collected based on the memory reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance memory reservation is used. Unit: Megabytes Metrics collected by Container Insights 604 Amazon CloudWatch Metric name NetworkRxBytes User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The number of bytes received by the resource ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second NetworkTxBytes TaskDefinitionFami ly , ClusterName The number of bytes transmitted by the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId resource that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second Metrics collected by Container Insights 605 Amazon CloudWatch Metric name PendingTaskCount Dimensions Description User Guide ServiceName , ClusterName The number of tasks currently in the PENDING state. Unit: Count The number of tasks currently in the RUNNING state. Unit: Count The number of times a container in an Amazon ECS task has been restarted. RunningTaskCount ServiceName , ClusterName RestartCount ClusterName ClusterName , ServiceName ClusterName , TaskDefinitionFami ly This metric is collected only for containers that have a restart policy ClusterName , ServiceName , TaskId enabled. Unit: Count ClusterName , TaskDefinitionFami ly , TaskId ServiceCount ClusterName The number of services in the cluster. Unit: Count Metrics collected by Container Insights 606 Amazon CloudWatch Metric name StorageReadBytes User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The number of bytes read from storage on the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId instance in the resource that is specified by the dimensions that you're using. This does not include read bytes for your storage devices. This metric is obtained from the Docker runtime. Unit: Bytes StorageWriteBytes TaskDefinitionFami ly , ClusterName The number of bytes written to storage in |
acw-ug-211 | acw-ug.pdf | 211 | ServiceCount ClusterName The number of services in the cluster. Unit: Count Metrics collected by Container Insights 606 Amazon CloudWatch Metric name StorageReadBytes User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The number of bytes read from storage on the ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId instance in the resource that is specified by the dimensions that you're using. This does not include read bytes for your storage devices. This metric is obtained from the Docker runtime. Unit: Bytes StorageWriteBytes TaskDefinitionFami ly , ClusterName The number of bytes written to storage in the ServiceName , ClusterName ClusterName resource that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. ClusterName , ServiceName , TaskId Unit: Bytes ClusterName , TaskDefinitionFami ly , TaskId TaskCount ClusterName The number of tasks running in the cluster. Unit: Count Metrics collected by Container Insights 607 Amazon CloudWatch Metric name TaskCpuUtilization User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The total percentage of CPU units being used by a task. Unit: Percent ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId TaskEphemeralStorageUtiliza tion TaskDefinitionFami ly , ClusterName The total percentage of ephemeral storage being used by a task. Unit: Percent ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId Metrics collected by Container Insights 608 Amazon CloudWatch Metric name Dimensions Description User Guide TaskMemoryUtilization TaskDefinitionFami ly , ClusterName The total percentage of memory being used by a task. Unit: Percent ServiceName , ClusterName ClusterName ClusterName , ServiceName , TaskId ClusterName , TaskDefinitionFami ly , TaskId TaskSetCount ServiceName , ClusterName The number of task sets in the service. Unit: Count Note The EphemeralStorageReserved and EphemeralStorageUtilized metrics are only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Fargate reserves space on disk. It is only used by Fargate. You aren't billed for it. It isn't shown in these metrics. However, you can see this additional storage in other tools such as df. The following metrics are available when you complete the steps in Deploying the CloudWatch agent to collect EC2 instance-level metrics on Amazon ECS and use the EC2 launch type. Metric name Dimensions instance_ cpu_limit ClusterName Description The maximum number of CPU Metrics collected by Container Insights 609 Amazon CloudWatch User Guide Metric name Dimensions instance_ cpu_reser ved_capacity ClusterName InstanceId , ContainerInstanceId , ClusterName instance_ cpu_usage _total instance_ cpu_utili zation ClusterName ClusterName InstanceId , ContainerInstanceId , ClusterName Description units that can be assigned to a single EC2 instance in the cluster. Unit: None The percentage of CPU currently being reserved on a single EC2 instance in the cluster. Unit: Percent The number of CPU units being used on a Single EC2 instance in the cluster. Unit: None The total percentag e of CPU units being used on a single EC2 instance in the cluster. Unit: Percent Metrics collected by Container Insights 610 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ filesyste m_utilization ClusterName InstanceId , ContainerInstanceId , ClusterName instance_ memory_limit ClusterName instance_ memory_re served_ca pacity ClusterName InstanceId , ContainerInstanceId , ClusterName The total percentag e of file system capacity being used on a single EC2 instance in the cluster. Unit: Percent The maximum amount of memory, in bytes, that can be assigned to a single EC2 instance in this cluster. Unit: Bytes The percentage of Memory currently being reserved on a single EC2 instance in the cluster. Unit: Percent Metrics collected by Container Insights 611 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ memory_ut ilization ClusterName InstanceId , ContainerInstanceId , ClusterName The total percentag e of memory being used on a single EC2 instance in the cluster. Note If you're using the Java ZGC garbage collector for your applicati on, this metric might be inaccurate. Unit: Percent Metrics collected by Container Insights 612 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ memory_wo rking_set ClusterName instance_ network_t otal_bytes ClusterName instance_ number_of _running_tasks ClusterName The amount of memory, in bytes, being used on a single EC2 instance in the cluster. Note If you're using the Java ZGC garbage collector for your applicati on, this metric might be inaccurate. Unit: Bytes The total number of bytes per second transmitted and received over the network on a single EC2 instance in the cluster. Unit: Bytes/second The number of running tasks on a single EC2 instance in the cluster. Unit: Count Metrics collected by Container Insights 613 Amazon CloudWatch User Guide Amazon ECS Container Insights metrics The following table lists the metrics and dimensions that Container Insights collects for Amazon ECS. These metrics are in the ECS/ContainerInsights namespace. For more information, see Metrics. If you do not see any Container Insights metrics in your console, be sure that |
acw-ug-212 | acw-ug.pdf | 212 | might be inaccurate. Unit: Bytes The total number of bytes per second transmitted and received over the network on a single EC2 instance in the cluster. Unit: Bytes/second The number of running tasks on a single EC2 instance in the cluster. Unit: Count Metrics collected by Container Insights 613 Amazon CloudWatch User Guide Amazon ECS Container Insights metrics The following table lists the metrics and dimensions that Container Insights collects for Amazon ECS. These metrics are in the ECS/ContainerInsights namespace. For more information, see Metrics. If you do not see any Container Insights metrics in your console, be sure that you have completed the setup of Container Insights. Metrics do not appear before Container Insights has been set up completely. For more information, see Setting up Container Insights. The following metrics are available when you complete the steps in Setting up Container Insights on Amazon ECS. Metric name Dimensions Description ContainerInstanceCount ClusterName CpuUtilized TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The number of EC2 instances running the Amazon ECS agent that are registered with a cluster. This metric is collected only for container instances that are running Amazon ECS tasks in the cluster. It is not collected for empty container instances that do not have any Amazon ECS tasks. Unit: Count The CPU units used by tasks in the resource that is specified by the dimension set that you're using. Metrics collected by Container Insights 614 Amazon CloudWatch Metric name CpuReserved User Guide Dimensions ClusterName Description Unit: None TaskDefinitionFami ly , ClusterName The CPU units reserved by tasks in the resource ServiceName , ClusterName ClusterName DeploymentCount ServiceName , ClusterName DesiredTaskCount ServiceName , ClusterName that is specified by the dimension set that you're using. This metric is collected based on the CPU reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance CPU reservation is used. Unit: None The number of deployments in an Amazon ECS service. Unit: Count The desired number of tasks for an Amazon ECS service. Unit: Count Metrics collected by Container Insights 615 Amazon CloudWatch Metric name Dimensions Description User Guide EBSFilesystemSize VolumeName , TaskDefinitionFami ly , ClusterName TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The total amount, in gigabytes (GB), of Amazon EBS filesystem storage that is allocated to the resources specified by the dimensions you're using. This metric is only available for tasks that run on Amazon ECS infrastructure running on Fargate using platform version 1.4.0 or Amazon EC2 instances using container agent version 1.79.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 616 Amazon CloudWatch Metric name Dimensions Description User Guide EBSFilesystemUtilized VolumeName , TaskDefinitionFami ly , ClusterName TaskDefinitionFami ly , ClusterName ServiceName , ClusterName The total amount, in gigabytes (GB), of Amazon EBS filesyste m storage that is being used by the resources specified by the dimensions that you're using. This metric is only available for tasks that run on Amazon ECS infrastructure running on Fargate using platform version 1.4.0 or Amazon EC2 instances using container agent version 1.79.0 or later. For tasks run on Fargate, Fargate reserves space on the disk that is only used by Fargate. There is no cost associated with the space Fargate uses, but you will see this additional storage using tools like df. Unit: Gigabytes (GB) Metrics collected by Container Insights 617 Amazon CloudWatch Metric name Dimensions Description User Guide EphemeralStorageReserved 1 TaskDefinitionFami ly , ClusterName The number of bytes reserved from ephemeral ServiceName , ClusterName ClusterName storage in the resource that is specified by the dimensions that you're using. Ephemeral storage is used for the container root filesystem and any bind mount host volumes defined in the container image and task definition. The amount of ephemeral storage can’t be changed in a running task. This metric is only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 618 Amazon CloudWatch Metric name Dimensions Description User Guide EphemeralStorageUtilized 1 TaskDefinitionFami ly , ClusterName The number of bytes used from ephemeral ServiceName , ClusterName ClusterName storage in the resource that is specified by the dimensions that you're using. Ephemeral storage is used for the container root filesystem and any bind mount host volumes defined in the container image and task definition. The amount of ephemeral storage can’t be changed in a running task. This metric is only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 619 Amazon CloudWatch Metric name MemoryUtilized User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The memory being used by tasks in the resource ServiceName , ClusterName ClusterName that is specified by the dimension set that you're using. Note If |
acw-ug-213 | acw-ug.pdf | 213 | using. Ephemeral storage is used for the container root filesystem and any bind mount host volumes defined in the container image and task definition. The amount of ephemeral storage can’t be changed in a running task. This metric is only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Unit: Gigabytes (GB) Metrics collected by Container Insights 619 Amazon CloudWatch Metric name MemoryUtilized User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The memory being used by tasks in the resource ServiceName , ClusterName ClusterName that is specified by the dimension set that you're using. Note If you're using the Java ZGC garbage collector for your applicati on, this metric might be inaccurate. Unit: Megabytes Metrics collected by Container Insights 620 Amazon CloudWatch Metric name MemoryReserved User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The memory that is reserved by tasks in the ServiceName , ClusterName ClusterName resource that is specified by the dimension set that you're using. This metric is collected based on the memory reservation defined in the task definition, for example, at the task or all containers level. If this is not specified in the task definition, then the instance memory reservation is used. Unit: Megabytes NetworkRxBytes TaskDefinitionFami ly , ClusterName The number of bytes received by the resource ServiceName , ClusterName ClusterName that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second Metrics collected by Container Insights 621 Amazon CloudWatch Metric name NetworkTxBytes User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The number of bytes transmitted by the ServiceName , ClusterName ClusterName PendingTaskCount ServiceName , ClusterName RunningTaskCount ServiceName , ClusterName resource that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. This metric is available only for containers in tasks using the awsvpc or bridge network modes. Unit: Bytes/Second The number of tasks currently in the PENDING state. Unit: Count The number of tasks currently in the RUNNING state. Unit: Count Metrics collected by Container Insights 622 Amazon CloudWatch Metric name RestartCount User Guide Dimensions Description ClusterName ClusterName , ServiceName The number of times a container in an Amazon ECS task has been restarted. ClusterName , TaskDefinitionFami ly This metric is collected only for containers that have a restart policy ServiceCount ClusterName enabled. Unit: Count The number of services in the cluster. Unit: Count StorageReadBytes TaskDefinitionFami ly , ClusterName The number of bytes read from storage on the ServiceName , ClusterName ClusterName instance in the resource that is specified by the dimensions that you're using. This does not include read bytes for your storage devices. This metric is obtained from the Docker runtime. Unit: Bytes Metrics collected by Container Insights 623 Amazon CloudWatch Metric name StorageWriteBytes User Guide Dimensions Description TaskDefinitionFami ly , ClusterName The number of bytes written to storage in the ServiceName , ClusterName ClusterName TaskCount ClusterName resource that is specified by the dimensions that you're using. This metric is obtained from the Docker runtime. Unit: Bytes The number of tasks running in the cluster. Unit: Count TaskSetCount ServiceName , ClusterName The number of task sets in the service. Unit: Count Note The EphemeralStorageReserved and EphemeralStorageUtilized metrics are only available for tasks that run on Fargate Linux platform version 1.4.0 or later. Fargate reserves space on disk. It is only used by Fargate. You aren't billed for it. It isn't shown in these metrics. However, you can see this additional storage in other tools such as df. The following metrics are available when you complete the steps in Deploying the CloudWatch agent to collect EC2 instance-level metrics on Amazon ECS Metric name Dimensions instance_ cpu_limit ClusterName Description The maximum number of CPU Metrics collected by Container Insights 624 Amazon CloudWatch User Guide Metric name Dimensions instance_ cpu_reser ved_capacity ClusterName InstanceId , ContainerInstanceId , ClusterName instance_ cpu_usage _total instance_ cpu_utili zation ClusterName ClusterName InstanceId , ContainerInstanceId , ClusterName Description units that can be assigned to a single EC2 Instance in the cluster. Unit: None The percentage of CPU currently being reserved on a single EC2 instance in the cluster. Unit: Percent The number of CPU units being used on a Single EC2 instance in the cluster. Unit: None The total percentag e of CPU units being used on a single EC2 instance in the cluster. Unit: Percent Metrics collected by Container Insights 625 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ filesyste m_utilization ClusterName InstanceId , ContainerInstanceId , ClusterName instance_ memory_limit ClusterName instance_ memory_re served_ca pacity ClusterName InstanceId , ContainerInstanceId , ClusterName The total percentag e of file system capacity being used on a single EC2 instance in the cluster. Unit: Percent The maximum amount of memory, in bytes, |
acw-ug-214 | acw-ug.pdf | 214 | Percent The number of CPU units being used on a Single EC2 instance in the cluster. Unit: None The total percentag e of CPU units being used on a single EC2 instance in the cluster. Unit: Percent Metrics collected by Container Insights 625 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ filesyste m_utilization ClusterName InstanceId , ContainerInstanceId , ClusterName instance_ memory_limit ClusterName instance_ memory_re served_ca pacity ClusterName InstanceId , ContainerInstanceId , ClusterName The total percentag e of file system capacity being used on a single EC2 instance in the cluster. Unit: Percent The maximum amount of memory, in bytes, that can be assigned to a single EC2 Instance in this cluster. Unit: Bytes The percentage of Memory currently being reserved on a single EC2 Instance in the cluster. Unit: Percent Metrics collected by Container Insights 626 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ memory_ut ilization ClusterName InstanceId , ContainerInstanceId , ClusterName The total percentag e of memory being used on a single EC2 Instance in the cluster. Note If you're using the Java ZGC garbage collector for your applicati on, this metric might be inaccurate. Unit: Percent Metrics collected by Container Insights 627 Amazon CloudWatch User Guide Metric name Dimensions Description instance_ memory_wo rking_set ClusterName instance_ network_t otal_bytes ClusterName instance_ number_of _running_tasks ClusterName The amount of memory, in bytes, being used on a single EC2 Instance in the cluster. Note If you're using the Java ZGC garbage collector for your applicati on, this metric might be inaccurate. Unit: Bytes The total number of bytes per second transmitted and received over the network on a single EC2 Instance in the cluster. Unit: Bytes/second The number of running tasks on a single EC2 Instance in the cluster. Unit: Count Metrics collected by Container Insights 628 Amazon CloudWatch User Guide Amazon EKS and Kubernetes Container Insights with enhanced observability metrics The following tables list the metrics and dimensions that Container Insights with enhanced observability collects for Amazon EKS and Kubernetes. These metrics are in the ContainerInsights namespace. For more information, see Metrics. If you do not see any Container Insights with enhanced observability metrics in your console, be sure that you have completed the setup of Container Insights with enhanced observability. Metrics do not appear before Container Insights with enhanced observability has been set up completely. For more information, see Setting up Container Insights. If you are using version 1.5.0 or later of the Amazon EKS add-on or version 1.300035.0 of the CloudWatch agent, most metrics listed in the following table are collected for both Linux and Windows nodes. See the Metric Name column of the table to see which metrics are not collected for Windows. With the earlier version of Container Insights which delivers aggregated metrics at Cluster and Service level, the metrics are charged as custom metrics. With Container Insights with enhanced observability for Amazon EKS, Container Insights metrics are charged per observation instead of being charged per metric stored or log ingested. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing. Note On Windows, network metrics such as pod_network_rx_bytes and pod_network_tx_bytes are not collected for host process containers. On RedHat OpenShift on AWS (ROSA) clusters , diskio metrics such as node_diskio_io_serviced_total and node_diskio_io_service_bytes_total are not collected. Metric name Dimensions Description cluster_failed_nod ClusterName e_count The number of failed worker nodes in the cluster. A node is considered failed if it is suffering from any node Metrics collected by Container Insights 629 Amazon CloudWatch User Guide Metric name Dimensions Description cluster_node_count ClusterName namespace_number_o Namespace ClusterName f_running_pods ClusterName node_cpu_limit ClusterName ClusterName , InstanceI d , NodeName conditions. For more informati on, see Conditions in the Kubernetes documentation. The total number of worker nodes in the cluster. The number of pods running per namespace in the resource that is specified by the dimensions that you're using. The maximum number of CPU units that can be assigned to a single node in this cluster. Metrics collected by Container Insights 630 Amazon CloudWatch User Guide Metric name Dimensions Description node_cpu_reserved_ NodeName, ClusterName , capacity InstanceId ClusterName The percentage of CPU units that are reserved for node components, such as kubelet, kube-proxy, and Docker. Formula: node_cpu_ request / node_cpu_ limit Note node_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_cpu_usage_total ClusterName The number of CPU units being used on the nodes in ClusterName , InstanceI d , NodeName the cluster. node_cpu_utilization NodeName, ClusterName , InstanceId ClusterName The total percentage of CPU units being used on the nodes in the cluster. Formula: node_cpu_ usage_total / node_cpu_limit Metrics collected by Container Insights 631 Amazon CloudWatch User Guide Metric name Dimensions Description node_filesystem_ut NodeName, ClusterName , ilization InstanceId ClusterName The total percentage of |
acw-ug-215 | acw-ug.pdf | 215 | not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_cpu_usage_total ClusterName The number of CPU units being used on the nodes in ClusterName , InstanceI d , NodeName the cluster. node_cpu_utilization NodeName, ClusterName , InstanceId ClusterName The total percentage of CPU units being used on the nodes in the cluster. Formula: node_cpu_ usage_total / node_cpu_limit Metrics collected by Container Insights 631 Amazon CloudWatch User Guide Metric name Dimensions Description node_filesystem_ut NodeName, ClusterName , ilization InstanceId ClusterName The total percentage of file system capacity being used on nodes in the cluster. Formula: node_file system_usage / node_filesystem_ca pacity Note node_file system_usage and node_file system_capacity are not reported directly as metrics, but are fields in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_memory_limit ClusterName ClusterName , InstanceI d , NodeName The maximum amount of memory, in bytes, that can be assigned to a single node in this cluster. Metrics collected by Container Insights 632 Amazon CloudWatch User Guide Metric name Dimensions Description node_filesystem_in ClusterName odes It is not available on Windows. ClusterName , InstanceI d , NodeName node_filesystem_in ClusterName odes_free It is not available on Windows. ClusterName , InstanceI d , NodeName The total number of inodes (used and unused) on a node. The number of unused inodes on a node. node_gpu_limit ClusterName The total number of GPU(s) available on the node. ClusterName , InstanceI d , NodeName node_gpu_usage_total ClusterName The number of GPU(s) being used by the running pods on ClusterName , InstanceI d , NodeName the node. node_gpu_reserved_ ClusterName capacity ClusterName , InstanceI d , NodeName Metrics collected by Container Insights 633 Amazon CloudWatch User Guide Metric name Dimensions Description node_memory_reserv NodeName, ClusterName , ed_capacity InstanceId ClusterName node_memory_utiliz NodeName, ClusterName , ation InstanceId ClusterName The percentage of memory currently being used on the nodes in the cluster. Formula: node_memo ry_request / node_memory_limit Note node_memo ry_request not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. The percentage of memory currently being used by the node or nodes. It is the percentage of node memory usage divided by the node memory limitation. Formula: node_memo ry_working_set / node_memory_limit . Metrics collected by Container Insights 634 Amazon CloudWatch User Guide Metric name Dimensions Description node_memory_workin ClusterName g_set ClusterName , InstanceI d , NodeName node_network_total NodeName, ClusterName , _bytes InstanceId ClusterName The amount of memory, in bytes, being used in the working set of the nodes in the cluster. The total number of bytes per second transmitted and received over the network per node in a cluster. Formula: node_netw ork_rx_bytes + node_network_tx_by tes Note node_netw ork_rx_bytes and node_netw ork_tx_bytes not reported directly are as metrics, but are fields in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_number_of_run NodeName, ClusterName , ning_containers InstanceId The number of running containers per node in a cluster. ClusterName Metrics collected by Container Insights 635 Amazon CloudWatch User Guide Metric name Dimensions Description node_number_of_run NodeName, ClusterName , ning_pods InstanceId The number of running pods per node in a cluster. ClusterName node_status_alloca ClusterName table_pods ClusterName , InstanceI d , NodeName node_status_capaci ClusterName ty_pods ClusterName , InstanceI d , NodeName node_status_condit ClusterName ion_ready ClusterName , InstanceI d , NodeName node_status_condit ClusterName ion_memory_pressure ClusterName , InstanceI d , NodeName node_status_condit ClusterName ion_pid_pressure ClusterName , InstanceI d , NodeName node_status_condit ClusterName ion_disk_pressure ClusterName , InstanceI d , NodeName The number of pods that can be assigned to a node based on its allocatable resources, which is defined as the remainder of a node's capacity after accounting for system daemons reservations and hard eviction thresholds. The number of pods that can be assigned to a node based on its capacity. Indicates whether the node status condition Ready is true for Amazon EC2 nodes. Indicates whether the node status condition MemoryPre ssure is true. Indicates whether the node status condition PIDPressu re is true. Indicates whether the node status condition OutOfDisk is true. Metrics collected by Container Insights 636 Amazon CloudWatch User Guide Metric name Dimensions Description node_status_condit ClusterName ion_unknown Indicates whether any of the node status conditions are ClusterName , InstanceI d , NodeName Unknown. node_interface_net ClusterName work_rx_dropped ClusterName , InstanceI d , NodeName node_interface_net ClusterName work_tx_dropped ClusterName , InstanceI d , NodeName node_diskio_io_ser ClusterName vice_bytes_total It is not available on Windows or on ROSA clusters. ClusterName , InstanceI d , NodeName node_diskio_io_ser ClusterName viced_total It is not available on Windows or on ROSA clusters. ClusterName , InstanceI d , NodeName The number of packets which were received and subsequen tly dropped |
acw-ug-216 | acw-ug.pdf | 216 | Metrics collected by Container Insights 636 Amazon CloudWatch User Guide Metric name Dimensions Description node_status_condit ClusterName ion_unknown Indicates whether any of the node status conditions are ClusterName , InstanceI d , NodeName Unknown. node_interface_net ClusterName work_rx_dropped ClusterName , InstanceI d , NodeName node_interface_net ClusterName work_tx_dropped ClusterName , InstanceI d , NodeName node_diskio_io_ser ClusterName vice_bytes_total It is not available on Windows or on ROSA clusters. ClusterName , InstanceI d , NodeName node_diskio_io_ser ClusterName viced_total It is not available on Windows or on ROSA clusters. ClusterName , InstanceI d , NodeName The number of packets which were received and subsequen tly dropped by a network interface on the node. The number of packets which were due to be transmitt ed but were dropped by a network interface on the node. The total number of bytes transferred by all I/O operations on the node. The total number of I/O operations on the node. Metrics collected by Container Insights 637 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_reserved_c PodName, Namespace , apacity ClusterName ClusterName The CPU capacity that is reserved per pod in a cluster. Formula: pod_cpu_r equest / node_cpu_ ClusterName , Namespace , PodName, FullPodName limit ClusterName , Namespace Note , Service pod_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. pod_cpu_utilization PodName, Namespace , ClusterName The percentage of CPU units being used by pods. Namespace , ClusterNa Formula: pod_cpu_u sage_total / node_cpu_limit me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName Metrics collected by Container Insights 638 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_utilizatio PodName, Namespace , n_over_pod_limit ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName The percentage of CPU units being used by pods relative to the pod limit. Formula: pod_cpu_u sage_total / pod_cpu_limit pod_memory_reserve PodName, Namespace , d_capacity ClusterName The percentage of memory that is reserved for pods. ClusterName Formula: pod_memor y_request / node_memo ClusterName , Namespace , PodName, FullPodName ry_limit ClusterName , Namespace Note , Service pod_memor y_request is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 639 Amazon CloudWatch User Guide Metric name Dimensions Description pod_memory_utiliza PodName, Namespace , tion ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName pod_memory_utiliza PodName, Namespace , tion_over_pod_limit ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName The percentage of memory currently being used by the pod or pods. Formula: pod_memor y_working_set / node_memory_limit The percentage of memory that is being used by pods relative to the pod limit. If any containers in the pod don't have a memory limit defined, this metric doesn't appear. Formula: pod_memor y_working_set / pod_memory_limit Metrics collected by Container Insights 640 Amazon CloudWatch User Guide Metric name Dimensions Description pod_network_rx_bytes PodName, Namespace , ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName The number of bytes per second being received over the network by the pod. Formula: sum(pod_i nterface_network_r x_bytes) Note pod_inter face_netw ork_rx_bytes not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 641 Amazon CloudWatch User Guide Metric name Dimensions Description pod_network_tx_bytes PodName, Namespace , ClusterName Namespace, ClusterNa me Service, Namespace , ClusterName ClusterName ClusterName , Namespace , PodName, FullPodName The number of bytes per second being transmitted over the network by the pod. Formula: sum(pod_i nterface_network_t x_bytes) Note pod_inter face_netw ork_tx_bytes not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 642 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_request ClusterName The CPU requests for the pod. PodName, Namespace , Formula: sum(conta ClusterName iner_cpu_request) Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Note pod_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 643 Amazon CloudWatch User Guide Metric name Dimensions Description pod_memory_request ClusterName PodName, Namespace , ClusterName The memory requests for the pod. Formula: sum(conta iner_memory_reques Namespace , ClusterNa me , Service t) ClusterName , Namespace , PodName, FullPodName Note pod_memor y_request is not reported directly as a metric, but is a field in performan ce |
acw-ug-217 | acw-ug.pdf | 217 | me , Service ClusterName , Namespace , PodName, FullPodName Note pod_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 643 Amazon CloudWatch User Guide Metric name Dimensions Description pod_memory_request ClusterName PodName, Namespace , ClusterName The memory requests for the pod. Formula: sum(conta iner_memory_reques Namespace , ClusterNa me , Service t) ClusterName , Namespace , PodName, FullPodName Note pod_memor y_request is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 644 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_limit ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName The CPU limit defined for the containers in the pod. If any containers in the pod don't have a CPU limit defined, this metric doesn't appear. Formula: sum(conta iner_cpu_limit) Note pod_cpu_limit is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 645 Amazon CloudWatch User Guide Metric name Dimensions Description pod_memory_limit ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service The memory limit defined for the containers in the pod. If any containers in the pod don't have a memory limit defined, this metric doesn't appear. ClusterName , Namespace , PodName, FullPodName Formula: sum(conta iner_memory_limit) Note pod_cpu_limit is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Indicates that all containers in the pod have terminated, and at least one container has terminated with a non-zero status or was terminated by the system. pod_status_failed ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Metrics collected by Container Insights 646 Amazon CloudWatch User Guide Metric name Dimensions Description pod_status_ready ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Indicates that all containers in the pod are ready, having reached the condition of ContainerReady . pod_status_running ClusterName Indicates that all containers in the pod are running. PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_status_scheduled ClusterName Indicates that the pod has been scheduled to a node. PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Metrics collected by Container Insights 647 Amazon CloudWatch User Guide Metric name Dimensions Description pod_status_unknown ClusterName Indicates that status of the pod can't be obtained. PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_status_pending ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_status_succeeded ClusterName PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Indicates that the pod has been accepted by the cluster but one or more of the containers has not become ready yet. Indicates that all containers in the pod have successfully terminated and will not be restarted. Metrics collected by Container Insights 648 Amazon CloudWatch User Guide Metric name Dimensions Description pod_number_of_cont ClusterName ainers PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_number_of_runn ClusterName ing_containers PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_terminated PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Reports the number of containers defined in the pod specification. Reports the number of containers in the pod which are currently in the Running state. Reports the number of containers in the pod which are in the Terminated state. Metrics collected by Container Insights 649 Amazon CloudWatch User Guide Metric name Dimensions Description pod_container_stat ClusterName us_running PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting_reason_ crash_loop_back_off PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Reports the number of containers in the pod which are in the Running state. Reports the number of containers in the pod which are in the Waiting state. Reports the number of containers in the pod which are pending because of a CrashLoopBackOff error, where a container repeatedly fails to start. Metrics |
acw-ug-218 | acw-ug.pdf | 218 | me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting_reason_ crash_loop_back_off PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Reports the number of containers in the pod which are in the Running state. Reports the number of containers in the pod which are in the Waiting state. Reports the number of containers in the pod which are pending because of a CrashLoopBackOff error, where a container repeatedly fails to start. Metrics collected by Container Insights 650 Amazon CloudWatch User Guide Metric name Dimensions Description pod_container_stat ClusterName us_waiting_reason_ create_container_c onfig_error PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting_reason_ create_container_e rror PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting_reason_ image_pull_error PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName Reports the number of containers in the pod which are pending with the reason CreateContainerCon figError . This is because of an error while creating the container configuration. Reports the number of containers in the pod which are pending with the reason CreateContainerError because of an error while creating the container. Reports the number of containers in the pod which are pending because of ErrImagePull , ImagePullBackOff , or InvalidImageName . These situations are because of an error while pulling the container image. Metrics collected by Container Insights 651 Amazon CloudWatch User Guide Metric name Dimensions Description pod_container_stat ClusterName us_waiting_reason_ oom_killed PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat ClusterName us_waiting_reason_ start_error PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_container_stat us_terminated_reas on_oom_killed ContainerName , FullPodName , PodName, Namespace , ClusterNa me ContainerName , PodName, Namespace , ClusterNa me ClusterName Reports the number of containers in the pod which are in the Terminated state because of running out of memory (OOM killed). Reports the number of containers in the pod which are pending with the reason being StartError because of an error while starting the container. Indicates a pod was terminate d for exceeding the memory limit. This metric is only displayed when this issue occurs. Metrics collected by Container Insights 652 Amazon CloudWatch User Guide Metric name Dimensions Description The number of packets which were received and subsequently dropped a network interface for the pod. The number of packets which were due to be transmitted but were dropped for the pod. The memory in bytes that is currently being used by a pod. pod_interface_netw ClusterName ork_rx_dropped PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_interface_netw ClusterName ork_tx_dropped PodName, Namespace , ClusterName Namespace , ClusterNa me , Service ClusterName , Namespace , PodName, FullPodName pod_memory_working ClusterName _set ClusterName , Namespace , PodName ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName Metrics collected by Container Insights 653 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_usage_total ClusterName The number of CPU units used by a pod. ClusterName , Namespace , PodName ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName container_cpu_util ClusterName ization PodName, Namespace , ClusterName , Container Name PodName, Namespace , ClusterName , Container Name , FullPodName The percentage of CPU units being used by the container. Formula: container _cpu_usage_total / node_cpu_limit Note container _cpu_util ization is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 654 Amazon CloudWatch User Guide Metric name Dimensions Description container_cpu_util ClusterName ization_over_conta iner_limit PodName, Namespace , ClusterName , Container Name PodName, Namespace , ClusterName , Container Name , FullPodName The percentage of CPU units being used by the container relative to the container limit. If the container doesn't have a CPU limit defined, this metric doesn't appear. Formula: container _cpu_usage_total / container_cpu_limit Note container _cpu_util ization_o ver_conta iner_limit not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 655 Amazon CloudWatch User Guide Metric name Dimensions Description container_memory_u ClusterName tilization The percentage of memory units being used by the PodName, Namespace , ClusterName , Container container. Name PodName, Namespace , ClusterName , Container Name , FullPodName Formula: container _memory_working_se t / node_memo ry_limit Note container _memory_u tilization not reported directly is as a metric, but is a field in performan ce log events. For more information, |
acw-ug-219 | acw-ug.pdf | 219 | as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 655 Amazon CloudWatch User Guide Metric name Dimensions Description container_memory_u ClusterName tilization The percentage of memory units being used by the PodName, Namespace , ClusterName , Container container. Name PodName, Namespace , ClusterName , Container Name , FullPodName Formula: container _memory_working_se t / node_memo ry_limit Note container _memory_u tilization not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 656 Amazon CloudWatch User Guide Metric name Dimensions Description container_memory_u ClusterName tilization_over_co ntainer_limit PodName, Namespace , ClusterName , Container Name PodName, Namespace , ClusterName , Container Name , FullPodName The percentage of memory units being used by the container relative to the container limit. If the container doesn't have a memory limit defined, this metric doesn't appear. Formula: container _memory_working_se t / container _memory_limit Note container _memory_u tilizatio n_over_co ntainer_limit is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 657 Amazon CloudWatch User Guide Metric name Dimensions Description container_memory_f ClusterName ailures_total It is not available on Windows. PodName, Namespace , ClusterName , Container Name PodName, Namespace , ClusterName , Container Name , FullPodName The number of memory allocation failures experienc ed by the container. pod_number_of_cont PodName, Namespace , ainer_restarts ClusterName The total number of container restarts in a pod. service_number_of_ Service, Namespace , running_pods ClusterName The number of pods running the service or services in the ClusterName cluster. replicas_desired ClusterName PodName, Namespace , ClusterName replicas_ready ClusterName PodName, Namespace , ClusterName status_replicas_av ClusterName ailable PodName, Namespace , ClusterName The number of pods desired for a workload as defined in the workload specification. The number of pods for a workload that have reached the ready status. The number of pods for a workload which are available . A pod is available when it has been ready for the minReadySeconds defined in the workload specification. Metrics collected by Container Insights 658 Amazon CloudWatch User Guide Metric name Dimensions Description status_replicas_un ClusterName available PodName, Namespace , ClusterName apiserver_storage_ ClusterName objects The number of pods for a workload which are unavailab le. A pod is available when it has been ready for the minReadySeconds defined in the workload specification. Pods are unavailable if they have not met this criterion. The number of objects stored in etcd at the time of the last ClusterName , resource check. apiserver_storage_ ClusterName db_total_size_in_b ytes ClusterName , endpoint apiserver_request_ ClusterName total ClusterName , code, verb apiserver_request_ ClusterName duration_seconds ClusterName , verb Total size of the storage database file physically allocated in bytes. This metric is experimental and might change in future releases of Kubernetes. Unit: Bytes Meaningful statistics: Sum, Average, Minimum, Maximum The total number of API requests to the Kubernetes API server. Responce latency for API requests to the Kubernetes API server. Metrics collected by Container Insights 659 Amazon CloudWatch User Guide Metric name Dimensions Description apiserver_admissio ClusterName n_controller_admis sion_duration_seco nds ClusterName , operation rest_client_reques ClusterName t_duration_seconds ClusterName , operation rest_client_reques ClusterName ts_total ClusterName , code, method etcd_request_durat ClusterName ion_seconds ClusterName , operation apiserver_storage_ ClusterName size_bytes ClusterName , endpoint apiserver_longrunn ClusterName ing_requests ClusterName , resource Admission controller latency in seconds. An admission controller is code which intercepts requests to the Kubernetes API server. Reponse latency experienc ed by clients calling the Kubernetes API server. This metric is experimental and may change in future releases of Kubernetes. The total number of API requests to the Kubernetes API server made by clients. This metric is experimental and may change in future releases of Kubernetes. Response latency of API calls to Etcd. This metric is experimental and may change in future releases of Kubernetes. Size of the storage database file physically allocated in bytes. This metric is experimental and may change in future releases of Kubernetes. The number of active long- running requests to the Kubernetes API server. Metrics collected by Container Insights 660 Amazon CloudWatch User Guide Metric name Dimensions Description apiserver_current_ ClusterName inflight_requests ClusterName , request_k ind apiserver_admissio ClusterName n_webhook_admissio n_duration_seconds ClusterName , name apiserver_admissio ClusterName n_step_admission_d uration_seconds ClusterName , operation The number of requests that are being processed by Kubernetes API server. Admission webhook latency in seconds. Admission webhooks are HTTP callbacks that receive admission requests and do something with them. Admission sub-step latency in seconds. apiserver_requeste ClusterName d_deprecated_apis ClusterName , group Number of requests to deprecated APIs on the Kubernetes API server. apiserver_request_ ClusterName total_5xx ClusterName , code, verb apiserver_storage_ ClusterName list_duration_seco nds ClusterName |
acw-ug-220 | acw-ug.pdf | 220 | Metrics collected by Container Insights 660 Amazon CloudWatch User Guide Metric name Dimensions Description apiserver_current_ ClusterName inflight_requests ClusterName , request_k ind apiserver_admissio ClusterName n_webhook_admissio n_duration_seconds ClusterName , name apiserver_admissio ClusterName n_step_admission_d uration_seconds ClusterName , operation The number of requests that are being processed by Kubernetes API server. Admission webhook latency in seconds. Admission webhooks are HTTP callbacks that receive admission requests and do something with them. Admission sub-step latency in seconds. apiserver_requeste ClusterName d_deprecated_apis ClusterName , group Number of requests to deprecated APIs on the Kubernetes API server. apiserver_request_ ClusterName total_5xx ClusterName , code, verb apiserver_storage_ ClusterName list_duration_seco nds ClusterName , resource apiserver_flowcont ClusterName rol_request_concur rency_limit ClusterName , priority_ level Number of requests to the Kubernetes API server which were responded to with a 5XX HTTP response code. Response latency of listing objects from Etc. This metric is experimental and may change in future releases of Kubernetes. The number of threads used by the currently executing requests in the API Priority and Fairness subsystem. Metrics collected by Container Insights 661 Amazon CloudWatch User Guide Metric name Dimensions Description apiserver_flowcont ClusterName rol_rejected_reque sts_total ClusterName , reason apiserver_current_ ClusterName inqueue_requests ClusterName , request_k ind Number of requests rejected by API Priority and Fairness subsystem. This metric is experimental and may change in future releases of Kubernetes. The number queued requests queued by the Kubernete s API server. This metric is experimental and may change in future releases of Kubernetes. NVIDIA GPU metrics Beginning with version 1.300034.0 of the CloudWatch agent, Container Insights with enhanced observability for Amazon EKS collects NVIDIA GPU metrics from EKS workloads by default. The CloudWatch agent must be installed using the CloudWatch Observability EKS add-on version v1.3.0-eksbuild.1 or later. For more information, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add-on or the Helm chart. These NVIDIA GPU metrics that are collected are listed in the table in this section. For Container Insights to collect NVIDIA GPU metrics, you must meet the following prerequisites: • You must be using Container Insights with enhanced observability for Amazon EKS, with the Amazon CloudWatch Observability EKS add-on version v1.3.0-eksbuild.1 or later. • The NVIDIA device plugin for Kubernetes must be installed in the cluster. • The NVIDIA container toolkit must be installed on the nodes of the cluster. For example, the Amazon EKS optimized accelerated AMIs are built with the necessary components. You can opt out of collecting NVIDIA GPU metrics by setting the accelerated_compute_metrics option in the beginn CloudWatch agent configuration file to false. For more information and an example opt-out configuration, see (Optional) Additional configuration. Metrics collected by Container Insights 662 Amazon CloudWatch User Guide Metric name Dimensions Description container ClusterName _gpu_memo ry_total The total frame buffer size, in bytes, on the GPU(s) allocated to the ClusterName , Namespace , PodName, ContainerName container. ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice container ClusterName _gpu_memo ry_used ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice container ClusterName _gpu_memo ry_utiliz ation ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName The bytes of frame buffer used on the GPU(s) allocated to the container. The percentage of frame buffer used of the GPU(s) allocated to the container. Metrics collected by Container Insights 663 Amazon CloudWatch User Guide Metric name Dimensions Description ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice container ClusterName _gpu_powe r_draw ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice container ClusterName _gpu_temp erature The power usage in watts of the GPU(s) allocated to the container. The temperature in degrees celsius of the GPU(s) allocated to the ClusterName , Namespace , PodName, ContainerName container. ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice Metrics collected by Container Insights 664 Amazon CloudWatch User Guide Metric name Dimensions Description container ClusterName _gpu_util ization ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice node_gpu_ ClusterName memory_to tal ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice node_gpu_ ClusterName memory_us ed ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice The percentage utilization of the GPU(s) allocated to the container. The total frame buffer size, in bytes, on the GPU(s) allocated to the node. The bytes of frame buffer used on the GPU(s) allocated to the node. Metrics collected by Container Insights 665 Amazon CloudWatch User Guide Metric name Dimensions Description node_gpu_ ClusterName memory_ut ilization ClusterName , InstanceId , NodeName ClusterName , |
acw-ug-221 | acw-ug.pdf | 221 | , ContainerName , GpuDevice node_gpu_ ClusterName memory_to tal ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice node_gpu_ ClusterName memory_us ed ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice The percentage utilization of the GPU(s) allocated to the container. The total frame buffer size, in bytes, on the GPU(s) allocated to the node. The bytes of frame buffer used on the GPU(s) allocated to the node. Metrics collected by Container Insights 665 Amazon CloudWatch User Guide Metric name Dimensions Description node_gpu_ ClusterName memory_ut ilization ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice node_gpu_ ClusterName power_draw ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice node_gpu_ ClusterName temperatu re ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice node_gpu_ ClusterName utilizati on ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, GpuDevice The percentage of frame buffer used on the GPU(s) allocated to the node. The power usage in watts of the GPU(s) allocated to the node. The temperature in degrees celsius of the GPU(s) allocated to the node. The percentage utilization of the GPU(s) allocated to the node. Metrics collected by Container Insights 666 Amazon CloudWatch User Guide Metric name Dimensions Description The total frame buffer size, in bytes, on the GPU(s) allocated to the pod. The bytes of frame buffer used on the GPU(s) allocated to the pod. pod_gpu_m ClusterName emory_tot al ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName . GpuDevice pod_gpu_m ClusterName emory_used ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName . GpuDevice Metrics collected by Container Insights 667 Amazon CloudWatch User Guide Metric name Dimensions Description The percentage of frame buffer used of the GPU(s) allocated to the pod. The power usage in watts of the GPU(s) allocated to the pod. pod_gpu_m ClusterName emory_uti lization ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName . GpuDevice pod_gpu_p ClusterName ower_draw ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName . GpuDevice Metrics collected by Container Insights 668 Amazon CloudWatch User Guide Metric name Dimensions Description The temperature in degrees Celsius of the GPU(s) allocated to the pod. The percentage utilization of the GPU(s) allocated to the pod. pod_gpu_t ClusterName emperature ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName . GpuDevice pod_gpu_u ClusterName tilization ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , GpuDevice AWS Neuron metrics for AWS Trainium and AWS Inferentia Beginning with version 1.300036.0 of the CloudWatch agent, Container Insights with enhanced observability for Amazon EKS collects accelerated computing metrics from AWS Trainium and AWS Inferentia accelerators by default. The CloudWatch agent must be installed using the CloudWatch Observability EKS add-on version v1.5.0-eksbuild.1 or later. For more information about the add-on, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add- Metrics collected by Container Insights 669 Amazon CloudWatch User Guide on or the Helm chart. For more information about AWS Trainium, see AWS Trainium. For more information about AWS Inferentia, see AWS Inferentia. For Container Insights to collect AWS Neuron metrics, you must meet the following prerequisites: • You must be using Container Insights with enhanced observability for Amazon EKS, with the Amazon CloudWatch Observability EKS add-on version v1.5.0-eksbuild.1 or later. • The Neuron driver must be installed on the nodes of the cluster. • The Neuron device plugin must be installed on the cluster. For example, the Amazon EKS optimized accelerated AMIs are built with the necessary components. The metrics that are collected are listed in the table in this section. The metrics are collected for AWS Trainium, AWS Inferentia, and AWS Inferentia2. The CloudWatch agent collects these metrics from the Neuron monitor and does the necessary Kubernetes resource correlation to deliver metrics at the pod and container levels Metric name Dimensions Description NeuronCore utilization, during the captured period of the NeuronCore allocated to the container. Unit: Percent container ClusterName _neuronco re_utiliz ation ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronco re_memory _usage_co nstants ClusterName , Namespace , PodName, ContainerName The amount of device memory used for |
acw-ug-222 | acw-ug.pdf | 222 | Inferentia, and AWS Inferentia2. The CloudWatch agent collects these metrics from the Neuron monitor and does the necessary Kubernetes resource correlation to deliver metrics at the pod and container levels Metric name Dimensions Description NeuronCore utilization, during the captured period of the NeuronCore allocated to the container. Unit: Percent container ClusterName _neuronco re_utiliz ation ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronco re_memory _usage_co nstants ClusterName , Namespace , PodName, ContainerName The amount of device memory used for constants during training by the NeuronCore that is allocated to the container (or weights during inference). Metrics collected by Container Insights 670 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronco re_memory _usage_mo del_code ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronco re_memory _usage_mo del_share d_scratch pad ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore Description Unit: Bytes The amount of device memory used for the models' executable code by the NeuronCore that is allocated to the container. Unit: Bytes The amount of device memory used for the scratchpad shared of the models by the NeuronCore that is allocated to the container. This memory region is reserved for the models. Unit: Bytes Metrics collected by Container Insights 671 Amazon CloudWatch User Guide Metric name Dimensions Description The amount of device memory used for the Neuron runtime by the NeuronCore allocated to the container. Unit: Bytes The amount of device memory used for tensors by the NeuronCore allocated to the container. Unit: Bytes container ClusterName _neuronco re_memory _usage_ru ntime_mem ory ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronco re_memory _usage_te nsors ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore Metrics collected by Container Insights 672 Amazon CloudWatch User Guide Metric name Dimensions Description The total amount of memory used by the NeuronCore allocated to the container. Unit: Bytes The number of corrected and uncorrected ECC events for the on- chip SRAM and device memory of the Neuron device on the node. Unit: Count container ClusterName _neuronco re_memory _usage_to tal ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice , NeuronCore container ClusterName _neuronde vice_hw_e cc_events _total ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NeuronDev ice Metrics collected by Container Insights 673 Amazon CloudWatch User Guide Metric name Dimensions Description pod_neuro ClusterName ncore_uti lization ClusterName , Namespace The NeuronCore utilization during the captured period of the NeuronCore allocated to the pod. ClusterName , Namespace , Unit: Percent Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore pod_neuro ClusterName ncore_mem ory_usage _constants ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore The amount of device memory used for constants during training by the NeuronCore that is allocated to the pod (or weights during inference). Unit: Bytes Metrics collected by Container Insights 674 Amazon CloudWatch User Guide Metric name Dimensions Description pod_neuro ClusterName ncore_mem ory_usage _model_co de ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore pod_neuro ClusterName ncore_mem ory_usage _model_sh ared_scra tchpad ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore The amount of device memory used for the models' executable code by the NeuronCore that is allocated to the pod. Unit: Bytes The amount of device memory used for the scratchpad shared of the models by the NeuronCore that is allocated to the pod. This memory region is reserved for the models. Unit: Bytes Metrics collected by Container Insights 675 Amazon CloudWatch User Guide Metric name Dimensions Description The amount of device memory used for the Neuron runtime by the NeuronCore allocated to the pod. pod_neuro ClusterName ncore_mem ory_usage _runtime_ memory ClusterName , Namespace ClusterName , Namespace , Unit: Bytes Service ClusterName , |
acw-ug-223 | acw-ug.pdf | 223 | device memory used for the models' executable code by the NeuronCore that is allocated to the pod. Unit: Bytes The amount of device memory used for the scratchpad shared of the models by the NeuronCore that is allocated to the pod. This memory region is reserved for the models. Unit: Bytes Metrics collected by Container Insights 675 Amazon CloudWatch User Guide Metric name Dimensions Description The amount of device memory used for the Neuron runtime by the NeuronCore allocated to the pod. pod_neuro ClusterName ncore_mem ory_usage _runtime_ memory ClusterName , Namespace ClusterName , Namespace , Unit: Bytes Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore pod_neuro ClusterName ncore_mem ory_usage _tensors The amount of device memory used for tensors by the NeuronCore allocated to the pod. ClusterName , Namespace ClusterName , Namespace , Unit: Bytes Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore Metrics collected by Container Insights 676 Amazon CloudWatch User Guide Metric name Dimensions Description The total amount of memory used by the NeuronCore allocated to the pod. Unit: Bytes The number of corrected and uncorrected ECC events for the on- chip SRAM and device memory of the Neuron device allocated to a pod. Unit: Bytes pod_neuro ClusterName ncore_mem ory_usage _total ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice , NeuronCore pod_neuro ClusterName ndevice_h w_ecc_eve nts_total ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NeuronDevice Metrics collected by Container Insights 677 Amazon CloudWatch User Guide Metric name Dimensions Description node_neur ClusterName oncore_ut ilization ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore node_neur ClusterName oncore_me mory_usag e_constan ts ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore node_neur ClusterName oncore_me mory_usag e_model_c ode ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore The NeuronCore utilization during the captured period of the NeuronCore allocated to the node. Unit: Percent The amount of device memory used for constants during training by the NeuronCore that is allocated to the node (or weights during inference). Unit: Bytes The amount of device memory used for models' executable code by the NeuronCore that is allocated to the node. Unit: Bytes node_neur ClusterName oncore_me mory_usag e_model_s hared_scr atchpad ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore The amount of device memory used for the scratchpad shared of the models by the NeuronCore that is allocated to the node. This is a memory region reserved for the models. Unit: Bytes Metrics collected by Container Insights 678 Amazon CloudWatch User Guide Metric name Dimensions Description node_neur ClusterName oncore_me mory_usag e_runtime _memory ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore node_neur ClusterName oncore_me mory_usag e_tensors ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore node_neur ClusterName oncore_me mory_usag e_total ClusterName , InstanceId , NodeName ClusterName , InstanceT ype , InstanceId , NodeName, NeuronDevice , NeuronCore node_neur ClusterName on_execut ion_error s_total ClusterName , InstanceId , NodeName The amount of device memory used for the Neuron runtime by the NeuronCore that is allocated to the node. Unit: Bytes The amount of device memory used for tensors by the NeuronCore that is allocated to the node. Unit: Bytes The total amount of memory used by the NeuronCore that is allocated to the node. Unit: Bytes The total number of execution errors on the node. This is calculated by the CloudWatch agent by aggregati ng the errors of the following types: generic, numerical , transient , model, runtime, and hardware Unit: Count Metrics collected by Container Insights 679 Amazon CloudWatch User Guide Metric name Dimensions Description node_neur ClusterName The total Neuron device memory usage in bytes on the node. ClusterName , InstanceId , NodeName Unit: Bytes ondevice_ runtime_m emory_use d_bytes node_neur ClusterName on_execut ion_laten cy ClusterName , InstanceId , NodeName In seconds, the latency for an execution on the node as measured by the Neuron runtime. Unit: Seconds node_neur ClusterName ondevice_ hw_ecc_ev ents_total ClusterName , InstanceId , NodeName The number of corrected and uncorrected ECC events for the on- chip SRAM and device memory of the Neuron device on the node. ClusterName , InstanceId , NodeName, NeuronDevice Unit: Count AWS Elastic Fabric Adapter (EFA) metrics Beginning with version 1.300037.0 of the CloudWatch agent, Container Insights with enhanced observability for Amazon EKS collects AWS Elastic Fabric Adapter (EFA) metrics from Amazon EKS clusters on Linux instances. The CloudWatch agent must |
acw-ug-224 | acw-ug.pdf | 224 | NodeName In seconds, the latency for an execution on the node as measured by the Neuron runtime. Unit: Seconds node_neur ClusterName ondevice_ hw_ecc_ev ents_total ClusterName , InstanceId , NodeName The number of corrected and uncorrected ECC events for the on- chip SRAM and device memory of the Neuron device on the node. ClusterName , InstanceId , NodeName, NeuronDevice Unit: Count AWS Elastic Fabric Adapter (EFA) metrics Beginning with version 1.300037.0 of the CloudWatch agent, Container Insights with enhanced observability for Amazon EKS collects AWS Elastic Fabric Adapter (EFA) metrics from Amazon EKS clusters on Linux instances. The CloudWatch agent must be installed using the CloudWatch Observability EKS add-on version v1.5.2-eksbuild.1 or later. For more information about the add-on, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add- on or the Helm chart. For more information about AWS Elastic Fabric Adapter, see Elastic Fabric Adapter. For Container Insights to collect AWS Elastic Fabric adapter metrics, you must meet the following prerequisites: • You must be using Container Insights with enhanced observability for Amazon EKS, with the Amazon CloudWatch Observability EKS add-on version v1.5.2-eksbuild.1 or later. Metrics collected by Container Insights 680 Amazon CloudWatch User Guide • The EFA device plugin must be installed on the cluster. For more information, see aws-efa-k8s- device-plugin on GitHub. The metrics that are collected are listed in the following table. Metric name Dimensions Description The number of bytes per second received by the EFA device(s) allocated to the container. Unit: Bytes/Second The number of bytes per second transmitted by the EFA device(s) allocated to the container. Unit: Bytes/Second container ClusterName _efa_rx_b ytes ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId container ClusterName _efa_tx_b ytes ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId container ClusterName _efa_rx_d ropped ClusterName , Namespace , PodName, ContainerName The number of packets that were received and then dropped by the EFA device(s) allocated to the container. Metrics collected by Container Insights 681 Amazon CloudWatch User Guide Metric name Dimensions Description Unit: Count/Second ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId container ClusterName _efa_rdma _read_byt es ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId container ClusterName _efa_rdma _write_by tes ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId The number of bytes per second received using remote direct memory access read operations by the EFA device(s) allocated to the container. Unit: Bytes/Second The number of bytes per second transmitted using remote direct memory access read operations by the EFA device(s) allocated to the container. Unit: Bytes/Second Metrics collected by Container Insights 682 Amazon CloudWatch User Guide Metric name Dimensions Description container ClusterName _efa_rdma _write_re cv_bytes ClusterName , Namespace , PodName, ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName ClusterName , Namespace , PodName, FullPodName , ContainerName , NetworkIn terfaceId The number of bytes per second received during remote direct memory access write operations by the EFA device(s) allocated to the container. Unit: Bytes/Second pod_efa_r ClusterName x_bytes ClusterName , Namespace The number of bytes per second received by the EFA device(s) allocated to the pod. ClusterName , Namespace , Unit: Bytes/Second Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId Metrics collected by Container Insights 683 Amazon CloudWatch User Guide Metric name Dimensions Description pod_efa_t ClusterName x_bytes ClusterName , Namespace The number of bytes per second transmitted by the EFA device(s) allocated to the pod. ClusterName , Namespace , Unit: Bytes/Second Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId pod_efa_r ClusterName x_dropped ClusterName , Namespace The number of packets that were received and then dropped by the EFA device(s) allocated to the pod. ClusterName , Namespace , Unit: Count/Second Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId Metrics collected by Container Insights 684 Amazon CloudWatch User Guide Metric name Dimensions Description The number of bytes per second received using remote direct memory access read operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second The number of bytes per second transmitted using remote direct memory access read operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second pod_efa_r ClusterName dma_read_ bytes ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName |
acw-ug-225 | acw-ug.pdf | 225 | Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId Metrics collected by Container Insights 684 Amazon CloudWatch User Guide Metric name Dimensions Description The number of bytes per second received using remote direct memory access read operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second The number of bytes per second transmitted using remote direct memory access read operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second pod_efa_r ClusterName dma_read_ bytes ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId pod_efa_r ClusterName dma_write _bytes ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId Metrics collected by Container Insights 685 Amazon CloudWatch User Guide Metric name Dimensions Description The number of bytes per second received during remote direct memory access write operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second pod_efa_r ClusterName dma_write _recv_byt es ClusterName , Namespace ClusterName , Namespace , Service ClusterName , Namespace , PodName ClusterName , Namespace , PodName, FullPodName ClusterName , Namespace , PodName, FullPodName , NetworkInterfaceId node_efa_ ClusterName rx_bytes ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId node_efa_ ClusterName tx_bytes ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId The number of bytes per second received by the EFA device(s) allocated to the node. Unit: Bytes/Second The number of bytes per second transmitted by the EFA device(s) allocated to the node. Unit: Bytes/Second Metrics collected by Container Insights 686 Amazon CloudWatch User Guide Metric name Dimensions Description node_efa_ ClusterName rx_dropped ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId node_efa_ ClusterName rdma_read _bytes ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId node_efa_ ClusterName rdma_writ e_bytes ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId node_efa_ ClusterName rdma_writ e_recv_by tes ClusterName , InstanceId , NodeName ClusterName , InstanceId , InstanceType , NodeName, NetworkInterfaceId The number of packets that were received and then dropped by the EFA device(s) allocated to the node. Unit: Count/Second The number of bytes per second received using remote direct memory access read operations by the EFA device(s) allocated to the node. Unit: Bytes/Second The number of bytes per second transmitted using remote direct memory access read operations by the EFA device(s) allocated to the pod. Unit: Bytes/Second The number of bytes per second received during remote direct memory access write operations by the EFA device(s) allocated to the node. Unit: Bytes/Second Metrics collected by Container Insights 687 Amazon CloudWatch User Guide Amazon SageMaker AI HyperPod metrics Beginning with version v2.0.1-eksbuild.1 of the the CloudWatch Observability EKS add-on, Container Insights with enhanced observability for Amazon EKS automatically collects Amazon SageMaker AI HyperPod metrics from Amazon EKS clusters. For more information about the add- on, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add-on or the Helm chart. For more information about Amazon SageMaker AI HyperPod, see Amazon SageMaker AI HyperPod. The metrics that are collected are listed in the following table. Metric name Dimensions Description hyperpod_ ClusterName node_heal th_status _unschedu lable ClusterName , InstanceId , NodeName hyperpod_ ClusterName node_heal th_status _schedula ble ClusterName , InstanceId , NodeName hyperpod_ ClusterName node_heal th_status _unschedu lable_pen ClusterName , InstanceId , NodeName Indicates if a node is labeled as Unschedulable by Amazon SageMaker AI HyperPod. This means that the node is running deep health checks and is not available for running workloads. Unit: Count Indicates if a node is labeled as Schedulable by Amazon SageMaker AI HyperPod. This means that the node has passed basic health checks or deep health checks and is available for running workloads. Unit: Count Indicates if a node is labeled as UnschedulablePendi ngReplacement This means that the node has by HyperPod. failed deep health checks or health monitoring agent checks and requires a replacement. Metrics collected by Container Insights 688 Amazon CloudWatch User Guide Metric name Dimensions Description ding_repl acement hyperpod_ ClusterName ClusterName , InstanceId , NodeName node_heal th_status _unschedu lable_pen ding_rebo ot If automatic node recovery is enabled, the node will be automatic ally replaced by Amazon SageMaker AI HyperPod. Unit: Count Indicates if a node is labeled as UnschedulablePendi ngReboot by Amazon SageMaker AI HyperPod. This means that the node is running deep health checks and requires a reboot. If automatic node recovery is enabled, the node will be automatic ally rebooted by Amazon SageMaker AI HyperPod. Unit: Count Amazon EKS and Kubernetes Container Insights metrics The following tables list the metrics and dimensions that Container Insights collects for Amazon EKS and |
acw-ug-226 | acw-ug.pdf | 226 | InstanceId , NodeName node_heal th_status _unschedu lable_pen ding_rebo ot If automatic node recovery is enabled, the node will be automatic ally replaced by Amazon SageMaker AI HyperPod. Unit: Count Indicates if a node is labeled as UnschedulablePendi ngReboot by Amazon SageMaker AI HyperPod. This means that the node is running deep health checks and requires a reboot. If automatic node recovery is enabled, the node will be automatic ally rebooted by Amazon SageMaker AI HyperPod. Unit: Count Amazon EKS and Kubernetes Container Insights metrics The following tables list the metrics and dimensions that Container Insights collects for Amazon EKS and Kubernetes. These metrics are in the ContainerInsights namespace. For more information, see Metrics. If you do not see any Container Insights metrics in your console, be sure that you have completed the setup of Container Insights. Metrics do not appear before Container Insights has been set up completely. For more information, see Setting up Container Insights. Metric name Dimensions Description cluster_failed_nod ClusterName e_count The number of failed worker nodes in the cluster. A node is considered failed if it is Metrics collected by Container Insights 689 Amazon CloudWatch User Guide Metric name Dimensions Description cluster_node_count ClusterName namespace_number_o Namespace ClusterName f_running_pods ClusterName node_cpu_limit ClusterName suffering from any node conditions. For more informati on, see Conditions in the Kubernetes documentation. The total number of worker nodes in the cluster. The number of pods running per namespace in the resource that is specified by the dimensions that you're using. The maximum number of CPU units that can be assigned to a single node in this cluster. Metrics collected by Container Insights 690 Amazon CloudWatch User Guide Metric name Dimensions Description node_cpu_reserved_ NodeName, ClusterName , capacity InstanceId ClusterName node_cpu_usage_total ClusterName node_cpu_utilization NodeName, ClusterName , InstanceId ClusterName The percentage of CPU units that are reserved for node components, such as kubelet, kube-proxy, and Docker. Formula: node_cpu_ request / node_cpu_ limit Note node_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. The number of CPU units being used on the nodes in the cluster. The total percentage of CPU units being used on the nodes in the cluster. Formula: node_cpu_ usage_total / node_cpu_limit Metrics collected by Container Insights 691 Amazon CloudWatch User Guide Metric name Dimensions Description node_gpu_limit ClusterName The total number of GPU(s) available on the node. ClusterName , InstanceI d , NodeName node_gpu_usage_total ClusterName The number of GPU(s) being used by the running pods on ClusterName , InstanceI d , NodeName the node. node_gpu_reserved_ ClusterName capacity ClusterName , InstanceI d , NodeName The percentage of GPU currently being reserved on the node. The formula is, node_gpu_request / node_gpu_limit . Note node_gpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 692 Amazon CloudWatch User Guide Metric name Dimensions Description node_filesystem_ut NodeName, ClusterName , ilization InstanceId ClusterName node_memory_limit ClusterName The total percentage of file system capacity being used on nodes in the cluster. Formula: node_file system_usage / node_filesystem_ca pacity Note node_file system_usage and node_file system_capacity are not reported directly as metrics, but are fields in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. The maximum amount of memory, in bytes, that can be assigned to a single node in this cluster. Metrics collected by Container Insights 693 Amazon CloudWatch User Guide Metric name Dimensions Description node_memory_reserv NodeName, ClusterName , ed_capacity InstanceId ClusterName node_memory_utiliz NodeName, ClusterName , ation InstanceId ClusterName The percentage of memory currently being used on the nodes in the cluster. Formula: node_memo ry_request / node_memory_limit Note node_memo ry_request not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. The percentage of memory currently being used by the node or nodes. It is the percentage of node memory usage divided by the node memory limitation. Formula: node_memo ry_working_set / node_memory_limit . Metrics collected by Container Insights 694 Amazon CloudWatch User Guide Metric name Dimensions Description node_memory_workin ClusterName g_set node_network_total NodeName, ClusterName , _bytes InstanceId ClusterName The amount of memory, in bytes, being used in the working set of the nodes in the cluster. The total number of bytes per second transmitted and received over the network per node in a cluster. Formula: node_netw ork_rx_bytes + node_network_tx_by tes Note node_netw ork_rx_bytes and node_netw ork_tx_bytes not reported directly are as metrics, but are fields in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_number_of_run NodeName, ClusterName |
acw-ug-227 | acw-ug.pdf | 227 | Insights 694 Amazon CloudWatch User Guide Metric name Dimensions Description node_memory_workin ClusterName g_set node_network_total NodeName, ClusterName , _bytes InstanceId ClusterName The amount of memory, in bytes, being used in the working set of the nodes in the cluster. The total number of bytes per second transmitted and received over the network per node in a cluster. Formula: node_netw ork_rx_bytes + node_network_tx_by tes Note node_netw ork_rx_bytes and node_netw ork_tx_bytes not reported directly are as metrics, but are fields in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. node_number_of_run NodeName, ClusterName , ning_containers InstanceId The number of running containers per node in a cluster. ClusterName Metrics collected by Container Insights 695 Amazon CloudWatch User Guide Metric name Dimensions Description node_number_of_run NodeName, ClusterName , ning_pods InstanceId The number of running pods per node in a cluster. ClusterName pod_cpu_reserved_c PodName, Namespace , apacity ClusterName ClusterName The CPU capacity that is reserved per pod in a cluster. Formula: pod_cpu_r equest / node_cpu_ limit Note pod_cpu_request is not reported directly as a metric, but is a field in performance log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. pod_cpu_utilization PodName, Namespace , ClusterName The percentage of CPU units being used by pods. Namespace , ClusterNa Formula: pod_cpu_u sage_total / node_cpu_limit me Service, Namespace , ClusterName ClusterName Metrics collected by Container Insights 696 Amazon CloudWatch User Guide Metric name Dimensions Description pod_cpu_utilizatio PodName, Namespace , n_over_pod_limit ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName pod_gpu_request ClusterName ClusterName , Namespace , PodName ClusterName , FullPodNa me , Namespace , PodName pod_gpu_limit ClusterName ClusterName , Namespace , PodName ClusterName , FullPodNa me , Namespace , PodName The percentage of CPU units being used by pods relative to the pod limit. Formula: pod_cpu_u sage_total / pod_cpu_limit The GPU requests for the pod. This value must always be equal to pod_gpu_limit . The maximum number of GPU(s) that can be assigned to the pod in a node. pod_gpu_usage_total ClusterName The number of GPU(s) being allocated on the pod. ClusterName , Namespace , PodName ClusterName , FullPodNa me , Namespace , PodName Metrics collected by Container Insights 697 Amazon CloudWatch User Guide Metric name Dimensions Description pod_gpu_reserved_c ClusterName apacity ClusterName , Namespace , PodName ClusterName , FullPodNa me , Namespace , PodName The percentage of GPU currently being reserved for the pod. The formula is - pod_gpu_request / node_gpu_reserved_capacity. pod_memory_reserve PodName, Namespace , d_capacity ClusterName The percentage of memory that is reserved for pods. ClusterName Formula: pod_memor y_request / node_memo ry_limit Note pod_memor y_request is not reported directly as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 698 Amazon CloudWatch User Guide Metric name Dimensions Description pod_memory_utiliza PodName, Namespace , tion ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName pod_memory_utiliza PodName, Namespace , tion_over_pod_limit ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName The percentage of memory currently being used by the pod or pods. Formula: pod_memor y_working_set / node_memory_limit The percentage of memory that is being used by pods relative to the pod limit. If any containers in the pod don't have a memory limit defined, this metric doesn't appear. Formula: pod_memor y_working_set / pod_memory_limit Metrics collected by Container Insights 699 Amazon CloudWatch User Guide Metric name Dimensions Description pod_network_rx_bytes PodName, Namespace , ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName The number of bytes per second being received over the network by the pod. Formula: sum(pod_i nterface_network_r x_bytes) Note pod_inter face_netw ork_rx_bytes not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. Metrics collected by Container Insights 700 Amazon CloudWatch User Guide Metric name Dimensions Description pod_network_tx_bytes PodName, Namespace , ClusterName Namespace , ClusterNa me Service, Namespace , ClusterName ClusterName The number of bytes per second being transmitted over the network by the pod. Formula: sum(pod_i nterface_network_t x_bytes) Note pod_inter face_netw ork_tx_bytes not reported directly is as a metric, but is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. pod_number_of_cont PodName, Namespace , ainer_restarts ClusterName The total number of container restarts in a pod. service_number_of_ Service, Namespace , running_pods ClusterName The number of pods running the service or services in the cluster. ClusterName Kueue metrics Beginning with version v2.4.0-eksbuild.1 of the the CloudWatch Observability EKS add-on, Container Insights for Amazon EKS supports collecting Kueue metrics from Amazon EKS clusters. Metrics collected by Container Insights 701 Amazon CloudWatch User Guide For more information about the add-on, see |
acw-ug-228 | acw-ug.pdf | 228 | is a field in performan ce log events. For more information, see Relevant fields in performance log events for Amazon EKS and Kubernetes. pod_number_of_cont PodName, Namespace , ainer_restarts ClusterName The total number of container restarts in a pod. service_number_of_ Service, Namespace , running_pods ClusterName The number of pods running the service or services in the cluster. ClusterName Kueue metrics Beginning with version v2.4.0-eksbuild.1 of the the CloudWatch Observability EKS add-on, Container Insights for Amazon EKS supports collecting Kueue metrics from Amazon EKS clusters. Metrics collected by Container Insights 701 Amazon CloudWatch User Guide For more information about the add-on, see Install the CloudWatch agent with the Amazon CloudWatch Observability EKS add-on or the Helm chart. For information about enabling the metrics, see Enable Kueue metrics to enable them. The Kueue metrics that are collected are listed in the following table. These metrics are published into the ContainerInsights/Prometheus namespace in CloudWatch. Some of these metrics use the following dimensions: • ClusterQueue is the name of the ClusterQueue • The possible values of Status are active and inadmissible • The possible values of Reason are Preempted, PodsReadyTimeout, AdmissionCheck, ClusterQueueStopped, and InactiveWorkload • Flavor is the referenced flavor. • Resource refers to cluster computer resources, such as cpu, memory, gpu, and so on. Metric name Dimensions Description kueue_pen ClusterName , ClusterQueue , The number of pending workloads. ding_work Status loads ClusterName , ClusterQueue ClusterName , Status ClusterName kueue_evi ClusterName , ClusterQueue , cted_work Reason The total number of evicted workloads. loads_tot al ClusterName , ClusterQueue ClusterName , Reason ClusterName kueue_adm itted_act ClusterName , ClusterQueue ClusterName The number of admitted workloads that are active (unsuspended and not finished). Metrics collected by Container Insights 702 Amazon CloudWatch User Guide Metric name Dimensions Description ive_workl oads kueue_clu ster_queu e_resourc e_usage kueue_clu ster_queu e_nominal _quota ClusterName , ClusterQueue , Resource, Flavor Reports the total resource usage of the ClusterQueue. ClusterName , ClusterQueue , Resource ClusterName , ClusterQueue , Flavor ClusterName , ClusterQueue ClusterName ClusterName , ClusterQueue , Resource, Flavor Reports the resource quota of the ClusterQueue. ClusterName , ClusterQueue , Resource ClusterName , ClusterQueue , Flavor ClusterName , ClusterQueue ClusterName Container Insights performance log reference This section includes reference information about how Container Insights uses performance log events to collect metrics. When you deploy Container Insights, it automatically creates a log group for the performance log events. You don't need to create this log group yourself. Topics • Container Insights performance log events for Amazon ECS Performance log reference 703 Amazon CloudWatch User Guide • Container Insights performance log events for Amazon EKS and Kubernetes • Relevant fields in performance log events for Amazon EKS and Kubernetes Container Insights performance log events for Amazon ECS The following are examples of the performance log events that Container Insights collects from Amazon ECS. These logs are in CloudWatch Logs, in a log group named /aws/ecs/ containerinsights/CLUSTER_NAME/performance. Within that log group, each container instance will has a log stream named AgentTelemetry-CONTAINER_INSTANCE_ID. You can query these logs using queries such as { $.Type = "Container" } to view all container log events. Type: Container { "Version":"0", "Type":"Container", "ContainerName":"sleep", "TaskId":"7ac4dfba69214411b4783a3b8189c9ba", "TaskDefinitionFamily":"sleep360", "TaskDefinitionRevision":"1", "ContainerInstanceId":"0d7650e6dec34c1a9200f72098071e8f", "EC2InstanceId":"i-0c470579dbcdbd2f3", "ClusterName":"MyCluster", "Image":"busybox", "ContainerKnownStatus":"RUNNING", "Timestamp":1623963900000, "CpuUtilized":0.0, "CpuReserved":10.0, "MemoryUtilized":0, "MemoryReserved":10, "StorageReadBytes":0, "StorageWriteBytes":0, "NetworkRxBytes":0, "NetworkRxDropped":0, "NetworkRxErrors":0, "NetworkRxPackets":14, "NetworkTxBytes":0, "NetworkTxDropped":0, Performance log reference 704 Amazon CloudWatch "NetworkTxErrors":0, "NetworkTxPackets":0 } Type: Task User Guide Even though the units for StorageReadBytes and StorageWriteBytes are in Bytes/ Second, the values represent the cumulative number of bytes read from and written to storage, respectively. { "Version": "0", "Type": "Task", "TaskId": "7ac4dfba69214411b4783a3b8189c9ba", "TaskDefinitionFamily": "sleep360", "TaskDefinitionRevision": "1", "ContainerInstanceId": "0d7650e6dec34c1a9200f72098071e8f", "EC2InstanceId": "i-0c470579dbcdbd2f3", "ClusterName": "MyCluster", "AccountID": "637146863587", "Region": "us-west-2", "AvailabilityZone": "us-west-2b", "KnownStatus": "RUNNING", "LaunchType": "EC2", "PullStartedAt": 1623963608201, "PullStoppedAt": 1623963610065, "CreatedAt": 1623963607094, "StartedAt": 1623963610382, "Timestamp": 1623963900000, "CpuUtilized": 0.0, "CpuReserved": 10.0, "MemoryUtilized": 0, "MemoryReserved": 10, "StorageReadBytes": 0, "StorageWriteBytes": 0, "NetworkRxBytes": 0, "NetworkRxDropped": 0, "NetworkRxErrors": 0, "NetworkRxPackets": 14, "NetworkTxBytes": 0, "NetworkTxDropped": 0, "NetworkTxErrors": 0, "NetworkTxPackets": 0, Performance log reference 705 Amazon CloudWatch User Guide "EBSFilesystemUtilized": 10, "EBSFilesystemSize": 20, "CloudWatchMetrics": [ { "Namespace": "ECS/ContainerInsights", "Metrics": [ { "Name": "CpuUtilized", "Unit": "None" }, { "Name": "CpuReserved", "Unit": "None" }, { "Name": "MemoryUtilized", "Unit": "Megabytes" }, { "Name": "MemoryReserved", "Unit": "Megabytes" }, { "Name": "StorageReadBytes", "Unit": "Bytes/Second" }, { "Name": "StorageWriteBytes", "Unit": "Bytes/Second" }, { "Name": "NetworkRxBytes", "Unit": "Bytes/Second" }, { "Name": "NetworkTxBytes", "Unit": "Bytes/Second" }, { "Name": "EBSFilesystemSize", "Unit": "Gigabytes" }, { "Name": "EBSFilesystemUtilzed", Performance log reference 706 Amazon CloudWatch User Guide "Unit": "Gigabytes" } ], "Dimensions": [ ["ClusterName"], [ "ClusterName", "TaskDefinitionFamily" ] ] } ] } Type: Service { "Version": "0", "Type": "Service", "ServiceName": "myCIService", "ClusterName": "myCICluster", "Timestamp": 1561586460000, "DesiredTaskCount": 2, "RunningTaskCount": 2, "PendingTaskCount": 0, "DeploymentCount": 1, "TaskSetCount": 0, "CloudWatchMetrics": [ { "Namespace": "ECS/ContainerInsights", "Metrics": [ { "Name": "DesiredTaskCount", "Unit": "Count" }, { "Name": "RunningTaskCount", "Unit": "Count" }, { "Name": "PendingTaskCount", "Unit": "Count" }, Performance log reference 707 User Guide Amazon CloudWatch { "Name": |
acw-ug-229 | acw-ug.pdf | 229 | "NetworkRxBytes", "Unit": "Bytes/Second" }, { "Name": "NetworkTxBytes", "Unit": "Bytes/Second" }, { "Name": "EBSFilesystemSize", "Unit": "Gigabytes" }, { "Name": "EBSFilesystemUtilzed", Performance log reference 706 Amazon CloudWatch User Guide "Unit": "Gigabytes" } ], "Dimensions": [ ["ClusterName"], [ "ClusterName", "TaskDefinitionFamily" ] ] } ] } Type: Service { "Version": "0", "Type": "Service", "ServiceName": "myCIService", "ClusterName": "myCICluster", "Timestamp": 1561586460000, "DesiredTaskCount": 2, "RunningTaskCount": 2, "PendingTaskCount": 0, "DeploymentCount": 1, "TaskSetCount": 0, "CloudWatchMetrics": [ { "Namespace": "ECS/ContainerInsights", "Metrics": [ { "Name": "DesiredTaskCount", "Unit": "Count" }, { "Name": "RunningTaskCount", "Unit": "Count" }, { "Name": "PendingTaskCount", "Unit": "Count" }, Performance log reference 707 User Guide Amazon CloudWatch { "Name": "DeploymentCount", "Unit": "Count" }, { "Name": "TaskSetCount", "Unit": "Count" } ], "Dimensions": [ [ "ServiceName", "ClusterName" ] ] } ] } Type: Volume { "Version": "0", "Type": "Volume", "TaskDefinitionFamily": "myCITaskDef", "TaskId": "7ac4dfba69214411b4783a3b8189c9ba", "ClusterName": "myCICluster", "ServiceName": "myCIService", "VolumeId": "vol-1233436545ff708cb", "InstanceId": "i-0c470579dbcdbd2f3", "LaunchType": "EC2", "VolumeName": "MyVolumeName", "EBSFilesystemUtilized": 10, "EBSFilesystemSize": 20, "CloudWatchMetrics": [ { "Namespace": "ECS/ContainerInsights", "Metrics": [ { "Name": "EBSFilesystemSize", "Unit": "Gigabytes" }, { Performance log reference 708 Amazon CloudWatch User Guide "Name": "EBSFilesystemUtilzed", "Unit": "Gigabytes" } ], "Dimensions": [ ["ClusterName"], [ "VolumeName", "TaskDefinitionFamily", "ClusterName" ], [ "ServiceName", "ClusterName" ] ] } ] } Type: Cluster { "Version": "0", "Type": "Cluster", "ClusterName": "myCICluster", "Timestamp": 1561587300000, "TaskCount": 5, "ContainerInstanceCount": 5, "ServiceCount": 2, "CloudWatchMetrics": [ { "Namespace": "ECS/ContainerInsights", "Metrics": [ { "Name": "TaskCount", "Unit": "Count" }, { "Name": "ContainerInstanceCount", "Unit": "Count" }, { Performance log reference 709 Amazon CloudWatch User Guide "Name": "ServiceCount", "Unit": "Count" } ], "Dimensions": [ [ "ClusterName" ] ] } ] } Container Insights performance log events for Amazon EKS and Kubernetes The following are examples of the performance log events that Container Insights collects from Amazon EKS and Kubernetes clusters. Type: Node { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Percent", "Name": "node_cpu_utilization" }, { "Unit": "Percent", "Name": "node_memory_utilization" }, { "Unit": "Bytes/Second", "Name": "node_network_total_bytes" }, { "Unit": "Percent", "Name": "node_cpu_reserved_capacity" }, { Performance log reference 710 Amazon CloudWatch User Guide "Unit": "Percent", "Name": "node_memory_reserved_capacity" }, { "Unit": "Count", "Name": "node_number_of_running_pods" }, { "Unit": "Count", "Name": "node_number_of_running_containers" } ], "Dimensions": [ [ "NodeName", "InstanceId", "ClusterName" ] ], "Namespace": "ContainerInsights" }, { "Metrics": [ { "Unit": "Percent", "Name": "node_cpu_utilization" }, { "Unit": "Percent", "Name": "node_memory_utilization" }, { "Unit": "Bytes/Second", "Name": "node_network_total_bytes" }, { "Unit": "Percent", "Name": "node_cpu_reserved_capacity" }, { "Unit": "Percent", "Name": "node_memory_reserved_capacity" }, { Performance log reference 711 Amazon CloudWatch User Guide "Unit": "Count", "Name": "node_number_of_running_pods" }, { "Unit": "Count", "Name": "node_number_of_running_containers" }, { "Name": "node_cpu_usage_total" }, { "Name": "node_cpu_limit" }, { "Unit": "Bytes", "Name": "node_memory_working_set" }, { "Unit": "Bytes", "Name": "node_memory_limit" } ], "Dimensions": [ [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "Sources": [ "cadvisor", "/proc", "pod", "calculated" ], "Timestamp": "1567096682364", "Type": "Node", "Version": "0", "kubernetes": { Performance log reference 712 Amazon CloudWatch User Guide "host": "ip-192-168-75-26.us-west-2.compute.internal" }, "node_cpu_limit": 4000, "node_cpu_request": 1130, "node_cpu_reserved_capacity": 28.249999999999996, "node_cpu_usage_system": 33.794636630852764, "node_cpu_usage_total": 136.47852169244098, "node_cpu_usage_user": 71.67075111567326, "node_cpu_utilization": 3.4119630423110245, "node_memory_cache": 3103297536, "node_memory_failcnt": 0, "node_memory_hierarchical_pgfault": 0, "node_memory_hierarchical_pgmajfault": 0, "node_memory_limit": 16624865280, "node_memory_mapped_file": 406646784, "node_memory_max_usage": 4230746112, "node_memory_pgfault": 0, "node_memory_pgmajfault": 0, "node_memory_request": 1115684864, "node_memory_reserved_capacity": 6.7109407818311055, "node_memory_rss": 798146560, "node_memory_swap": 0, "node_memory_usage": 3901444096, "node_memory_utilization": 6.601302600149552, "node_memory_working_set": 1097457664, "node_network_rx_bytes": 35918.392817386324, "node_network_rx_dropped": 0, "node_network_rx_errors": 0, "node_network_rx_packets": 157.67565245448117, "node_network_total_bytes": 68264.20276554905, "node_network_tx_bytes": 32345.80994816272, "node_network_tx_dropped": 0, "node_network_tx_errors": 0, "node_network_tx_packets": 154.21455923431654, "node_number_of_running_containers": 16, "node_number_of_running_pods": 13 } Type: NodeFS { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", Performance log reference 713 Amazon CloudWatch User Guide "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Percent", "Name": "node_filesystem_utilization" } ], "Dimensions": [ [ "NodeName", "InstanceId", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "EBSVolumeId": "aws://us-west-2b/vol-0a53108976d4a2fda", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "Sources": [ "cadvisor", "calculated" ], "Timestamp": "1567097939726", "Type": "NodeFS", "Version": "0", "device": "/dev/nvme0n1p1", "fstype": "vfs", "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal" }, "node_filesystem_available": 17298395136, "node_filesystem_capacity": 21462233088, "node_filesystem_inodes": 10484720, "node_filesystem_inodes_free": 10367158, "node_filesystem_usage": 4163837952, "node_filesystem_utilization": 19.400767547940255 Performance log reference 714 User Guide Amazon CloudWatch } Type: NodeDiskIO { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "ClusterName": "myCICluster", "EBSVolumeId": "aws://us-west-2b/vol-0a53108976d4a2fda", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "Sources": [ "cadvisor" ], "Timestamp": "1567096928131", "Type": "NodeDiskIO", "Version": "0", "device": "/dev/nvme0n1", "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal" }, "node_diskio_io_service_bytes_async": 9750.505814277016, "node_diskio_io_service_bytes_read": 0, "node_diskio_io_service_bytes_sync": 230.6174506688036, "node_diskio_io_service_bytes_total": 9981.123264945818, "node_diskio_io_service_bytes_write": 9981.123264945818, "node_diskio_io_serviced_async": 1.153087253344018, "node_diskio_io_serviced_read": 0, "node_diskio_io_serviced_sync": 0.03603397666700056, "node_diskio_io_serviced_total": 1.1891212300110185, "node_diskio_io_serviced_write": 1.1891212300110185 } Type: NodeNet { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "ClusterName": "myCICluster", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", Performance log reference 715 Amazon CloudWatch "Sources": [ "cadvisor", "calculated" ], "Timestamp": "1567096928131", "Type": "NodeNet", "Version": "0", "interface": "eni972f6bfa9a0", "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal" }, "node_interface_network_rx_bytes": 3163.008420864309, "node_interface_network_rx_dropped": 0, "node_interface_network_rx_errors": 0, "node_interface_network_rx_packets": 16.575629266820258, "node_interface_network_total_bytes": 3518.3935157426017, "node_interface_network_tx_bytes": 355.385094878293, "node_interface_network_tx_dropped": 0, "node_interface_network_tx_errors": 0, "node_interface_network_tx_packets": 3.9997714100370625 } Type: Pod { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Percent", "Name": "pod_cpu_utilization" }, { "Unit": "Percent", "Name": "pod_memory_utilization" }, { "Unit": "Bytes/Second", "Name": "pod_network_rx_bytes" }, { Performance log reference User Guide 716 Amazon CloudWatch User Guide "Unit": "Bytes/Second", "Name": "pod_network_tx_bytes" }, { "Unit": "Percent", "Name": "pod_cpu_utilization_over_pod_limit" }, { "Unit": "Percent", "Name": "pod_memory_utilization_over_pod_limit" |
acw-ug-230 | acw-ug.pdf | 230 | "ip-192-0-2-0.us-west-2.compute.internal", Performance log reference 715 Amazon CloudWatch "Sources": [ "cadvisor", "calculated" ], "Timestamp": "1567096928131", "Type": "NodeNet", "Version": "0", "interface": "eni972f6bfa9a0", "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal" }, "node_interface_network_rx_bytes": 3163.008420864309, "node_interface_network_rx_dropped": 0, "node_interface_network_rx_errors": 0, "node_interface_network_rx_packets": 16.575629266820258, "node_interface_network_total_bytes": 3518.3935157426017, "node_interface_network_tx_bytes": 355.385094878293, "node_interface_network_tx_dropped": 0, "node_interface_network_tx_errors": 0, "node_interface_network_tx_packets": 3.9997714100370625 } Type: Pod { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Percent", "Name": "pod_cpu_utilization" }, { "Unit": "Percent", "Name": "pod_memory_utilization" }, { "Unit": "Bytes/Second", "Name": "pod_network_rx_bytes" }, { Performance log reference User Guide 716 Amazon CloudWatch User Guide "Unit": "Bytes/Second", "Name": "pod_network_tx_bytes" }, { "Unit": "Percent", "Name": "pod_cpu_utilization_over_pod_limit" }, { "Unit": "Percent", "Name": "pod_memory_utilization_over_pod_limit" } ], "Dimensions": [ [ "PodName", "Namespace", "ClusterName" ], [ "Service", "Namespace", "ClusterName" ], [ "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" }, { "Metrics": [ { "Unit": "Percent", "Name": "pod_cpu_reserved_capacity" }, { "Unit": "Percent", "Name": "pod_memory_reserved_capacity" } ], Performance log reference 717 Amazon CloudWatch User Guide "Dimensions": [ [ "PodName", "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" }, { "Metrics": [ { "Unit": "Count", "Name": "pod_number_of_container_restarts" } ], "Dimensions": [ [ "PodName", "Namespace", "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "Namespace": "amazon-cloudwatch", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "PodName": "cloudwatch-agent-statsd", "Service": "cloudwatch-agent-statsd", "Sources": [ "cadvisor", "pod", "calculated" ], "Timestamp": "1567097351092", "Type": "Pod", "Version": "0", Performance log reference 718 User Guide Amazon CloudWatch "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal", "labels": { "app": "cloudwatch-agent-statsd", "pod-template-hash": "df44f855f" }, "namespace_name": "amazon-cloudwatch", "pod_id": "2f4ff5ac-c813-11e9-a31d-06e9dde32928", "pod_name": "cloudwatch-agent-statsd-df44f855f-ts4q2", "pod_owners": [ { "owner_kind": "Deployment", "owner_name": "cloudwatch-agent-statsd" } ], "service_name": "cloudwatch-agent-statsd" }, "pod_cpu_limit": 200, "pod_cpu_request": 200, "pod_cpu_reserved_capacity": 5, "pod_cpu_usage_system": 1.4504841104992765, "pod_cpu_usage_total": 5.817016867430125, "pod_cpu_usage_user": 1.1281543081661038, "pod_cpu_utilization": 0.14542542168575312, "pod_cpu_utilization_over_pod_limit": 2.9085084337150624, "pod_memory_cache": 8192, "pod_memory_failcnt": 0, "pod_memory_hierarchical_pgfault": 0, "pod_memory_hierarchical_pgmajfault": 0, "pod_memory_limit": 104857600, "pod_memory_mapped_file": 0, "pod_memory_max_usage": 25268224, "pod_memory_pgfault": 0, "pod_memory_pgmajfault": 0, "pod_memory_request": 104857600, "pod_memory_reserved_capacity": 0.6307275170893897, "pod_memory_rss": 22777856, "pod_memory_swap": 0, "pod_memory_usage": 25141248, "pod_memory_utilization": 0.10988455961791709, "pod_memory_utilization_over_pod_limit": 17.421875, "pod_memory_working_set": 18268160, "pod_network_rx_bytes": 9880.697124714186, "pod_network_rx_dropped": 0, Performance log reference 719 Amazon CloudWatch User Guide "pod_network_rx_errors": 0, "pod_network_rx_packets": 107.80005532263283, "pod_network_total_bytes": 10158.829201483635, "pod_network_tx_bytes": 278.13207676944796, "pod_network_tx_dropped": 0, "pod_network_tx_errors": 0, "pod_network_tx_packets": 1.146027574644318, "pod_number_of_container_restarts": 0, "pod_number_of_containers": 1, "pod_number_of_running_containers": 1, "pod_status": "Running" } Type: PodNet { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "ClusterName": "myCICluster", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "Namespace": "amazon-cloudwatch", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "PodName": "cloudwatch-agent-statsd", "Service": "cloudwatch-agent-statsd", "Sources": [ "cadvisor", "calculated" ], "Timestamp": "1567097351092", "Type": "PodNet", "Version": "0", "interface": "eth0", "kubernetes": { "host": "ip-192-168-75-26.us-west-2.compute.internal", "labels": { "app": "cloudwatch-agent-statsd", "pod-template-hash": "df44f855f" }, "namespace_name": "amazon-cloudwatch", "pod_id": "2f4ff5ac-c813-11e9-a31d-06e9dde32928", "pod_name": "cloudwatch-agent-statsd-df44f855f-ts4q2", "pod_owners": [ Performance log reference 720 User Guide Amazon CloudWatch { "owner_kind": "Deployment", "owner_name": "cloudwatch-agent-statsd" } ], "service_name": "cloudwatch-agent-statsd" }, "pod_interface_network_rx_bytes": 9880.697124714186, "pod_interface_network_rx_dropped": 0, "pod_interface_network_rx_errors": 0, "pod_interface_network_rx_packets": 107.80005532263283, "pod_interface_network_total_bytes": 10158.829201483635, "pod_interface_network_tx_bytes": 278.13207676944796, "pod_interface_network_tx_dropped": 0, "pod_interface_network_tx_errors": 0, "pod_interface_network_tx_packets": 1.146027574644318 } Type: Container { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers-NodeGroup- sample", "ClusterName": "myCICluster", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "Namespace": "amazon-cloudwatch", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "PodName": "cloudwatch-agent-statsd", "Service": "cloudwatch-agent-statsd", "Sources": [ "cadvisor", "pod", "calculated" ], "Timestamp": "1567097399912", "Type": "Container", "Version": "0", "container_cpu_limit": 200, "container_cpu_request": 200, "container_cpu_usage_system": 1.87958283771964, "container_cpu_usage_total": 6.159993652997942, "container_cpu_usage_user": 1.6707403001952357, Performance log reference 721 Amazon CloudWatch User Guide "container_cpu_utilization": 0.15399984132494854, "container_memory_cache": 8192, "container_memory_failcnt": 0, "container_memory_hierarchical_pgfault": 0, "container_memory_hierarchical_pgmajfault": 0, "container_memory_limit": 104857600, "container_memory_mapped_file": 0, "container_memory_max_usage": 24580096, "container_memory_pgfault": 0, "container_memory_pgmajfault": 0, "container_memory_request": 104857600, "container_memory_rss": 22736896, "container_memory_swap": 0, "container_memory_usage": 24453120, "container_memory_utilization": 0.10574541028701798, "container_memory_working_set": 17580032, "container_status": "Running", "kubernetes": { "container_name": "cloudwatch-agent", "docker": { "container_id": "8967b6b37da239dfad197c9fdea3e5dfd35a8a759ec86e2e4c3f7b401e232706" }, "host": "ip-192-168-75-26.us-west-2.compute.internal", "labels": { "app": "cloudwatch-agent-statsd", "pod-template-hash": "df44f855f" }, "namespace_name": "amazon-cloudwatch", "pod_id": "2f4ff5ac-c813-11e9-a31d-06e9dde32928", "pod_name": "cloudwatch-agent-statsd-df44f855f-ts4q2", "pod_owners": [ { "owner_kind": "Deployment", "owner_name": "cloudwatch-agent-statsd" } ], "service_name": "cloudwatch-agent-statsd" }, "number_of_container_restarts": 0 } Type: ContainerFS Performance log reference 722 Amazon CloudWatch User Guide { "AutoScalingGroupName": "eksctl-myCICluster-nodegroup-standard-workers- NodeGroup-1174PV2WHZAYU", "ClusterName": "myCICluster", "EBSVolumeId": "aws://us-west-2b/vol-0a53108976d4a2fda", "InstanceId": "i-1234567890123456", "InstanceType": "t3.xlarge", "Namespace": "amazon-cloudwatch", "NodeName": "ip-192-0-2-0.us-west-2.compute.internal", "PodName": "cloudwatch-agent-statsd", "Service": "cloudwatch-agent-statsd", "Sources": [ "cadvisor", "calculated" ], "Timestamp": "1567097399912", "Type": "ContainerFS", "Version": "0", "device": "/dev/nvme0n1p1", "fstype": "vfs", "kubernetes": { "container_name": "cloudwatch-agent", "docker": { "container_id": "8967b6b37da239dfad197c9fdea3e5dfd35a8a759ec86e2e4c3f7b401e232706" }, "host": "ip-192-168-75-26.us-west-2.compute.internal", "labels": { "app": "cloudwatch-agent-statsd", "pod-template-hash": "df44f855f" }, "namespace_name": "amazon-cloudwatch", "pod_id": "2f4ff5ac-c813-11e9-a31d-06e9dde32928", "pod_name": "cloudwatch-agent-statsd-df44f855f-ts4q2", "pod_owners": [ { "owner_kind": "Deployment", "owner_name": "cloudwatch-agent-statsd" } ], "service_name": "cloudwatch-agent-statsd" } Performance log reference 723 User Guide Amazon CloudWatch } Type: Cluster { "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Count", "Name": "cluster_node_count" }, { "Unit": "Count", "Name": "cluster_failed_node_count" } ], "Dimensions": [ [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "Sources": [ "apiserver" ], "Timestamp": "1567097534160", "Type": "Cluster", "Version": "0", "cluster_failed_node_count": 0, "cluster_node_count": 3 } Type: ClusterService { "CloudWatchMetrics": [ { "Metrics": [ { Performance log reference 724 Amazon CloudWatch User Guide "Unit": "Count", "Name": "service_number_of_running_pods" } ], "Dimensions": [ [ "Service", "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "Namespace": "amazon-cloudwatch", "Service": "cloudwatch-agent-statsd", "Sources": [ "apiserver" ], "Timestamp": "1567097534160", "Type": "ClusterService", "Version": "0", "kubernetes": { "namespace_name": "amazon-cloudwatch", "service_name": "cloudwatch-agent-statsd" }, "service_number_of_running_pods": 1 } Type: ClusterNamespace { "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Count", "Name": "namespace_number_of_running_pods" } Performance log reference 725 User Guide Amazon CloudWatch ], "Dimensions": [ [ "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "Namespace": "amazon-cloudwatch", "Sources": [ "apiserver" ], "Timestamp": "1567097594160", "Type": "ClusterNamespace", "Version": "0", "kubernetes": { |
acw-ug-231 | acw-ug.pdf | 231 | "Unit": "Count", "Name": "service_number_of_running_pods" } ], "Dimensions": [ [ "Service", "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "Namespace": "amazon-cloudwatch", "Service": "cloudwatch-agent-statsd", "Sources": [ "apiserver" ], "Timestamp": "1567097534160", "Type": "ClusterService", "Version": "0", "kubernetes": { "namespace_name": "amazon-cloudwatch", "service_name": "cloudwatch-agent-statsd" }, "service_number_of_running_pods": 1 } Type: ClusterNamespace { "CloudWatchMetrics": [ { "Metrics": [ { "Unit": "Count", "Name": "namespace_number_of_running_pods" } Performance log reference 725 User Guide Amazon CloudWatch ], "Dimensions": [ [ "Namespace", "ClusterName" ], [ "ClusterName" ] ], "Namespace": "ContainerInsights" } ], "ClusterName": "myCICluster", "Namespace": "amazon-cloudwatch", "Sources": [ "apiserver" ], "Timestamp": "1567097594160", "Type": "ClusterNamespace", "Version": "0", "kubernetes": { "namespace_name": "amazon-cloudwatch" }, "namespace_number_of_running_pods": 7 } Relevant fields in performance log events for Amazon EKS and Kubernetes For Amazon EKS and Kubernetes, the containerized CloudWatch agent emits data as performance log events. This enables CloudWatch to ingest and store high-cardinality data. CloudWatch uses the data in the performance log events to create aggregated CloudWatch metrics at the cluster, node, and pod levels without the need to lose granular details. The following table lists the fields in these performance log events that are relevant to the collection of Container Insights metric data. You can use CloudWatch Logs Insights to query for any of these fields to collect data or investigate issues. For more information, see Analyze Log Data With CloudWatch Logs Insights. Performance log reference 726 Amazon CloudWatch User Guide Type Log field Source Formula or notes Pod pod_cpu_utilization Calculated Formula: pod_cpu_u sage_tota l / node_cpu_ limit Pod pod_cpu_usage_total cadvisor pod_cpu_usage_total is reported in millicores. Pod pod_cpu_limit Calculated Formula: sum(conta iner_cpu_ limit) sum(conta iner_cpu_ limit) includes already-c ompleted pods. If any containers in the pod don't have a CPU limit defined, this field doesn't appear in the log event. This Performance log reference 727 Amazon CloudWatch User Guide Type Log field Source Formula or notes includes init containers. Pod pod_cpu_request Calculated Formula: sum(conta iner_cpu_ request) container _cpu_requ est isn't guaranteed to be set. Only the ones that are set are included in the sum. Pod pod_cpu_utilization_over_po Calculated Formula: d_limit pod_cpu_u sage_tota l / pod_cpu_l imit Pod pod_cpu_reserved_capacity Calculated Formula: pod_cpu_r equest / node_cpu_ limit Performance log reference 728 Amazon CloudWatch Type Log field Source User Guide Formula or notes Pod pod_memory_utilization Calculated Formula: pod_memor y_working _set / node_memo ry_limit It is the percentage of pod memory usage over the node memory limitation. Pod Pod pod_memory_working_set cadvisor pod_memory_limit Calculated Formula: sum(conta iner_memo ry_limit) If any containers in the pod don't have a memory limit defined, this field doesn't appear in the log event. This includes init containers. Performance log reference 729 Amazon CloudWatch Type Log field Source User Guide Formula or notes Pod pod_memory_request Calculated Formula: sum(conta iner_memo ry_reques t) container _memory_r equest isn't guaranteed to be set. Only the ones that are set are included in the sum. Pod pod_memory_utilization_over Calculated Formula: _pod_limit pod_memor y_working _set / pod_memor y_limit If any containers in the pod don't have a memory limit defined, this field doesn't appear in the log event. This includes init containers. Performance log reference 730 Amazon CloudWatch Type Log field Source User Guide Formula or notes Pod pod_memory_reserved_capacity Calculated Formula: pod_memor y_request / node_memo ry_limit Pod pod_network_tx_bytes Calculated Formula: sum(pod_i nterface_ network_t x_bytes) This data is available for all the network interfaces per pod. The CloudWatc h agent calculates the total and adds metric extraction rules. Pod pod_network_rx_bytes Calculated Formula: sum(pod_i nterface_ network_r x_bytes) Performance log reference 731 Amazon CloudWatch Type Log field Source User Guide Formula or notes Pod pod_network_total_bytes Calculated Formula: PodNet pod_interface_network_rx_by cadvisor tes PodNet pod_interface_network_tx_by cadvisor tes Container container_cpu_usage_total cadvisor Container container_cpu_limit cadvisor Container container_cpu_request cadvisor pod_netwo rk_rx_byt es + pod_netwo rk_tx_byt es This data is network rx bytes per second of a pod network interface. This data is network tx bytes per second of a pod network interface. Not guarantee d to be set. It's not emitted if it's not set. Not guarantee d to be set. It's not emitted if it's not set. Container container_memory_working_set cadvisor Performance log reference 732 Amazon CloudWatch User Guide Type Log field Source Container container_memory_limit pod Container container_memory_request pod Formula or notes Not guarantee d to be set. It's not emitted if it's not set. Not guarantee d to be set. It's not emitted if it's not set. Node node_cpu_utilization Calculated Formula: node_cpu_ usage_tot al / node_cpu_ limit Node Node node_cpu_usage_total node_cpu_limit cadvisor /proc Performance log reference 733 Amazon CloudWatch Type Log field Source User Guide Formula or notes Node node_cpu_request Calculated Formula: sum(pod_c pu_reques t) For cronjobs, node_cpu_ request also includes requests from completed pods. This can lead to a high value for node_cpu_ reserved_ capacity . Node node_cpu_reserved_capacity Calculated Formula: node_cpu_ request / node_cpu_ limit Node node_memory_utilization Calculated Formula: node_memo ry_workin g_set / node_memo ry_limit Node Node node_memory_working_set node_memory_limit cadvisor /proc Performance log reference 734 Amazon |
acw-ug-232 | acw-ug.pdf | 232 | to be set. It's not emitted if it's not set. Node node_cpu_utilization Calculated Formula: node_cpu_ usage_tot al / node_cpu_ limit Node Node node_cpu_usage_total node_cpu_limit cadvisor /proc Performance log reference 733 Amazon CloudWatch Type Log field Source User Guide Formula or notes Node node_cpu_request Calculated Formula: sum(pod_c pu_reques t) For cronjobs, node_cpu_ request also includes requests from completed pods. This can lead to a high value for node_cpu_ reserved_ capacity . Node node_cpu_reserved_capacity Calculated Formula: node_cpu_ request / node_cpu_ limit Node node_memory_utilization Calculated Formula: node_memo ry_workin g_set / node_memo ry_limit Node Node node_memory_working_set node_memory_limit cadvisor /proc Performance log reference 734 Amazon CloudWatch Type Log field Source User Guide Formula or notes Node node_memory_request Calculated Formula: sum(pod_m emory_req uest) Node node_memory_reserved_capaci Calculated Formula: ty node_memo ry_reques t / node_memo ry_limit Node node_network_rx_bytes Calculated Formula: sum(node_ interface _network_ rx_bytes) Node node_network_tx_bytes Calculated Formula: sum(node_ interface _network_ tx_bytes) Node node_network_total_bytes Calculated Formula: node_netw ork_rx_by tes + node_netw ork_tx_by tes Node node_number_of_running_pods Pod List Performance log reference 735 Amazon CloudWatch Type Log field Source Node node_number_of_running_cont Pod List ainers NodeNet node_interface_network_rx_b cadvisor ytes NodeNet node_interface_network_tx_b cadvisor ytes User Guide Formula or notes This data is network rx bytes per second of a worker node network interface. This data is network tx bytes per second of a worker node network interface. NodeFS node_filesystem_capacity NodeFS node_filesystem_usage cadvisor cadvisor NodeFS node_filesystem_utilization Calculated Formula: node_file system_us age / node_file system_ca pacity This data is available per device name. Performance log reference 736 Amazon CloudWatch Type Log field Source User Guide Formula or notes Cluster Cluster cluster_failed_node_count API Server cluster_node_count API Server Service service_number_of_running_p API Server ods Namespace namespace_number_of_running API Server _pods Metrics calculation examples This section includes examples that show how some of the values in the preceding table are calculated. Suppose that you have a cluster in the following state. Node1 node_cpu_limit = 4 node_cpu_usage_total = 3 Pod1 pod_cpu_usage_total = 2 Container1 container_cpu_limit = 1 container_cpu_request = 1 container_cpu_usage_total = 0.8 Container2 container_cpu_limit = null container_cpu_request = null container_cpu_usage_total = 1.2 Pod2 pod_cpu_usage_total = 0.4 Container3 Performance log reference 737 Amazon CloudWatch User Guide container_cpu_limit = 1 container_cpu_request = 0.5 container_cpu_usage_total = 0.4 Node2 node_cpu_limit = 8 node_cpu_usage_total = 1.5 Pod3 pod_cpu_usage_total = 1 Container4 container_cpu_limit = 2 container_cpu_request = 2 container_cpu_usage_total = 1 The following table shows how pod CPU metrics are calculated using this data. Metric Formula Pod1 Pod2 Pod3 pod_cpu_u tilization pod_cpu_u tilizatio n_over_po d_limit pod_cpu_r eserved_c apacity pod_cpu_usage_tota l / node_cpu_limit 2 / 4 = 50% 0.4 / 4 = 10% 1 / 8 = 12.5% pod_cpu_usage_tota l / sum(conta iner_cpu_limit) 0.4 / 1 = 40% 1 / 2 = 50% N/A because CPU limit for Container 2 isn't defined sum(container_cpu_ request) / node_cpu_ (1 + 0) / 4 = 25% 0.5 / 4 = 12.5% 2 / 8 = 25% limit The following table shows how node CPU metrics are calculated using this data. Performance log reference 738 Amazon CloudWatch User Guide Metric Formula Node1 Node2 node_cpu_utilizati node_cpu_usage_total / 3 / 4 = 75% 1.5 / 8 = on node_cpu_limit node_cpu_reserved_ sum(pod_cpu_request) / capacity node_cpu_limit 1.5 / 4 = 37.5% 18.75% 2 / 8 = 25% Container Insights Prometheus metrics monitoring CloudWatch Container Insights monitoring for Prometheus automates the discovery of Prometheus metrics from containerized systems and workloads. Prometheus is an open-source systems monitoring and alerting toolkit. For more information, see What is Prometheus? in the Prometheus documentation. Discovering Prometheus metrics is supported for Amazon Elastic Container Service, Amazon Elastic Kubernetes Service and Kubernetes clusters running on Amazon EC2 instances. The Prometheus counter, gauge, and summary metric types are collected. For Amazon ECS and Amazon EKS clusters, both the EC2 and Fargate launch types are supported. Container Insights automatically collects metrics from several workloads, and you can configure it to collect metrics from any workload. You can adopt Prometheus as an open-source and open-standard method to ingest custom metrics in CloudWatch. The CloudWatch agent with Prometheus support discovers and collects Prometheus metrics to monitor, troubleshoot, and alarm on application performance degradation and failures faster. This also reduces the number of monitoring tools required to improve observability. Container Insights Prometheus support involves pay-per-use of metrics and logs, including collecting, storing, and analyzing. For more information, see Amazon CloudWatch Pricing. Pre-built dashboards for some workloads The Container Insights Prometheus solution includes pre-built dashboards for the popular workloads that are listed in this section. For sample configurations for these workloads, see (Optional) Set up sample containerized Amazon ECS workloads for Prometheus metric testing and (Optional) Set up sample containerized Amazon EKS workloads for Prometheus metric testing. Container Insights Prometheus metrics monitoring 739 Amazon CloudWatch User Guide You can also configure Container Insights to collect Prometheus metrics from other containerized services and applications by editing the agent configuration file. Workloads with pre-built dashboards for Amazon EKS clusters |
acw-ug-233 | acw-ug.pdf | 233 | information, see Amazon CloudWatch Pricing. Pre-built dashboards for some workloads The Container Insights Prometheus solution includes pre-built dashboards for the popular workloads that are listed in this section. For sample configurations for these workloads, see (Optional) Set up sample containerized Amazon ECS workloads for Prometheus metric testing and (Optional) Set up sample containerized Amazon EKS workloads for Prometheus metric testing. Container Insights Prometheus metrics monitoring 739 Amazon CloudWatch User Guide You can also configure Container Insights to collect Prometheus metrics from other containerized services and applications by editing the agent configuration file. Workloads with pre-built dashboards for Amazon EKS clusters and Kubernetes clusters running on Amazon EC2 instances: • AWS App Mesh • NGINX • Memcached • Java/JMX • HAProxy Workloads with pre-built dashboards for Amazon ECS clusters: • AWS App Mesh • Java/JMX • NGINX • NGINX Plus Set up and configure Prometheus metrics collection on Amazon ECS clusters To collect Prometheus metrics from Amazon ECS clusters, you can use the CloudWatch agent as a collector or use the AWS Distro for OpenTelemetry collector. For information about using the AWS Distro for OpenTelemetry collector, see https://aws-otel.github.io/docs/getting-started/container- insights/ecs-prometheus. The following sections explain how to use the CloudWatch agent as the collector to retrieve Prometheus metrics. You install the CloudWatch agent with Prometheus monitoring on clusters running Amazon ECS, and you can optionally configure the agent to scrape additional targets. These sections also provide optional tutorials for setting up sample workloads to use for testing with Prometheus monitoring. Container Insights on Amazon ECS supports the following launch type and network mode combinations for Prometheus metrics: Container Insights Prometheus metrics monitoring 740 Amazon CloudWatch User Guide Amazon ECS launch type Network modes supported EC2 (Linux) Fargate bridge, host, and awsvpc awsvpc VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of the security group for the CloudWatch agent must allow the CloudWatch agent to connect to the Prometheus workloads' port by private IP. Topics • Install the CloudWatch agent with Prometheus metrics collection on Amazon ECS clusters • Scraping additional Prometheus sources and importing those metrics • (Optional) Set up sample containerized Amazon ECS workloads for Prometheus metric testing Install the CloudWatch agent with Prometheus metrics collection on Amazon ECS clusters This section explains how to set up the CloudWatch agent with Prometheus monitoring in a cluster running Amazon ECS. After you do this, the agent automatically scrapes and imports metrics for the following workloads running in that cluster. • AWS App Mesh • Java/JMX You can also configure the agent to scrape and import metrics from additional Prometheus workloads and sources. Set up IAM roles You need two IAM roles for the CloudWatch agent task definition. If you specify CreateIAMRoles=True in the AWS CloudFormation stack to have Container Insights create these roles for you, the roles will be created with the correct permissions. If you want to create them yourself or use existing roles, the following roles and permissions are required. Container Insights Prometheus metrics monitoring 741 Amazon CloudWatch User Guide • CloudWatch agent ECS task role— The CloudWatch agent container uses this role. It must include the CloudWatchAgentServerPolicy policy and a customer-managed policy which contains the following read-only permissions: • ec2:DescribeInstances • ecs:ListTasks • ecs:ListServices • ecs:DescribeContainerInstances • ecs:DescribeServices • ecs:DescribeTasks • ecs:DescribeTaskDefinition • CloudWatch agent ECS task execution role— This is the role that Amazon ECS requires to launch and execute your containers. Ensure that your task execution role has the AmazonSSMReadOnlyAccess, AmazonECSTaskExecutionRolePolicy, and CloudWatchAgentServerPolicy policies attached. If you want to store more sensitive data for Amazon ECS to use, see Specifying sensitive data. Install the CloudWatch agent with Prometheus monitoring by using AWS CloudFormation You use AWS CloudFormation to install the CloudWatch agent with Prometheus monitoring for Amazon ECS clusters. The following list shows the parameters you will use in the AWS CloudFormation template. • ECSClusterName— Specifies the target Amazon ECS cluster. • CreateIAMRoles— Specify True to create new roles for the Amazon ECS task role and Amazon ECS task execution role. Specify False to reuse existing roles. • TaskRoleName— If you specified True for CreateIAMRoles, this specifies the name to use for the new Amazon ECS task role. If you specified False for CreateIAMRoles, this specifies the existing role to use as the Amazon ECS task role. • ExecutionRoleName— If you specified True for CreateIAMRoles, this specifies the name to use for the new Amazon ECS task execution role. If you specified False for CreateIAMRoles, this specifies the existing role to use as the Amazon ECS task execution role. • ECSNetworkMode— If you are using EC2 launch type, specify the network mode here. It must be either bridge or host. |
acw-ug-234 | acw-ug.pdf | 234 | you specified True for CreateIAMRoles, this specifies the name to use for the new Amazon ECS task role. If you specified False for CreateIAMRoles, this specifies the existing role to use as the Amazon ECS task role. • ExecutionRoleName— If you specified True for CreateIAMRoles, this specifies the name to use for the new Amazon ECS task execution role. If you specified False for CreateIAMRoles, this specifies the existing role to use as the Amazon ECS task execution role. • ECSNetworkMode— If you are using EC2 launch type, specify the network mode here. It must be either bridge or host. • ECSLaunchType— Specify either fargate or EC2. Container Insights Prometheus metrics monitoring 742 Amazon CloudWatch User Guide • SecurityGroupID— If the ECSNetworkMode is awsvpc, specify the security group ID here. • SubnetID— If the ECSNetworkMode is awsvpc, specify the subnet ID here. Command samples This section includes sample AWS CloudFormation commands to install Container Insights with Prometheus monitoring in various scenarios. Create AWS CloudFormation stack for an Amazon ECS cluster in bridge network mode export AWS_PROFILE=your_aws_config_profile_eg_default export AWS_DEFAULT_REGION=your_aws_region_eg_ap-southeast-1 export ECS_CLUSTER_NAME=your_ec2_ecs_cluster_name export ECS_NETWORK_MODE=bridge export CREATE_IAM_ROLES=True export ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name export ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/cwagent- prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for-bridge-host.yaml aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=${ECS_CLUSTER_NAME} \ ParameterKey=CreateIAMRoles,ParameterValue=${CREATE_IAM_ROLES} \ ParameterKey=ECSNetworkMode,ParameterValue=${ECS_NETWORK_MODE} \ ParameterKey=TaskRoleName,ParameterValue=${ECS_TASK_ROLE_NAME} \ ParameterKey=ExecutionRoleName,ParameterValue= ${ECS_EXECUTION_ROLE_NAME} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Create AWS CloudFormation stack for an Amazon ECS cluster in host network mode export AWS_PROFILE=your_aws_config_profile_eg_default export AWS_DEFAULT_REGION=your_aws_region_eg_ap-southeast-1 export ECS_CLUSTER_NAME=your_ec2_ecs_cluster_name export ECS_NETWORK_MODE=host export CREATE_IAM_ROLES=True Container Insights Prometheus metrics monitoring 743 Amazon CloudWatch User Guide export ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name export ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/cwagent- prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for-bridge-host.yaml aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=${ECS_CLUSTER_NAME} \ ParameterKey=CreateIAMRoles,ParameterValue=${CREATE_IAM_ROLES} \ ParameterKey=ECSNetworkMode,ParameterValue=${ECS_NETWORK_MODE} \ ParameterKey=TaskRoleName,ParameterValue=${ECS_TASK_ROLE_NAME} \ ParameterKey=ExecutionRoleName,ParameterValue= ${ECS_EXECUTION_ROLE_NAME} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Create AWS CloudFormation stack for an Amazon ECS cluster in awsvpc network mode export AWS_PROFILE=your_aws_config_profile_eg_default export AWS_DEFAULT_REGION=your_aws_region_eg_ap-southeast-1 export ECS_CLUSTER_NAME=your_ec2_ecs_cluster_name export ECS_LAUNCH_TYPE=EC2 export CREATE_IAM_ROLES=True export ECS_CLUSTER_SECURITY_GROUP=your_security_group_eg_sg-xxxxxxxxxx export ECS_CLUSTER_SUBNET=your_subnet_eg_subnet-xxxxxxxxxx export ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name export ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/cwagent- prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for-awsvpc.yaml aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-${ECS_LAUNCH_TYPE}-awsvpc \ --template-body file://cwagent-ecs-prometheus-metric-for-awsvpc.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=${ECS_CLUSTER_NAME} \ ParameterKey=CreateIAMRoles,ParameterValue=${CREATE_IAM_ROLES} \ ParameterKey=ECSLaunchType,ParameterValue=${ECS_LAUNCH_TYPE} \ Container Insights Prometheus metrics monitoring 744 Amazon CloudWatch User Guide ParameterKey=SecurityGroupID,ParameterValue= ${ECS_CLUSTER_SECURITY_GROUP} \ ParameterKey=SubnetID,ParameterValue=${ECS_CLUSTER_SUBNET} \ ParameterKey=TaskRoleName,ParameterValue=${ECS_TASK_ROLE_NAME} \ ParameterKey=ExecutionRoleName,ParameterValue= ${ECS_EXECUTION_ROLE_NAME} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Create AWS CloudFormation stack for a Fargate cluster in awsvpc network mode export AWS_PROFILE=your_aws_config_profile_eg_default export AWS_DEFAULT_REGION=your_aws_region_eg_ap-southeast-1 export ECS_CLUSTER_NAME=your_ec2_ecs_cluster_name export ECS_LAUNCH_TYPE=FARGATE export CREATE_IAM_ROLES=True export ECS_CLUSTER_SECURITY_GROUP=your_security_group_eg_sg-xxxxxxxxxx export ECS_CLUSTER_SUBNET=your_subnet_eg_subnet-xxxxxxxxxx export ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name export ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/cwagent- prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for-awsvpc.yaml aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-${ECS_LAUNCH_TYPE}-awsvpc \ --template-body file://cwagent-ecs-prometheus-metric-for-awsvpc.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=${ECS_CLUSTER_NAME} \ ParameterKey=CreateIAMRoles,ParameterValue=${CREATE_IAM_ROLES} \ ParameterKey=ECSLaunchType,ParameterValue=${ECS_LAUNCH_TYPE} \ ParameterKey=SecurityGroupID,ParameterValue= ${ECS_CLUSTER_SECURITY_GROUP} \ ParameterKey=SubnetID,ParameterValue=${ECS_CLUSTER_SUBNET} \ ParameterKey=TaskRoleName,ParameterValue=${ECS_TASK_ROLE_NAME} \ ParameterKey=ExecutionRoleName,ParameterValue= ${ECS_EXECUTION_ROLE_NAME} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Container Insights Prometheus metrics monitoring 745 Amazon CloudWatch User Guide AWS resources created by the AWS CloudFormation stack The following table lists the AWS resources that are created when you use AWS CloudFormation to set up Container Insights with Prometheus monitoring on an Amazon ECS cluster. Resource type AWS::SSM: :Parameter Resource name Comments AmazonCloudWatch-CWAgentConfig- $ECS_CLUSTER_NAME -$ECS_LAUNC H_TYPE -$ECS_NETWORK_MODE This is the CloudWatch agent with the default App Mesh and Java/JMX embedded metric format definition. AWS::SSM: :Parameter AmazonCloudWatch-Prometheus ConfigName-$ECS_CLUSTER_NAME - $ECS_LAUNCH_TYPE -$ECS_NETWO This is the Prometheus scraping configuration. The Amazon ECS task role. This is created only if you specified True for CREATE_IAM_ROLES . The Amazon ECS task execution role. This is created only if you specified True for CREATE_IAM_ROLES . RK_MODE $ECS_TASK_ROLE_NAME. ${ECS_EXECUTION_ROLE_NAME} AWS::IAM: :Role AWS::IAM: :Role AWS::ECS: :TaskDefi nition cwagent-prometheus-$ECS_CLUST ER_NAME -$ECS_LAUNCH_TYPE - $ECS_NETWORK_MODE AWS::ECS: :Service cwagent-prometheus-replica-service- $ECS_LAUNCH_TYPE -$ECS_NETWO RK_MODE Deleting the AWS CloudFormation stack for the CloudWatch agent with Prometheus monitoring To delete the CloudWatch agent from an Amazon ECS cluster, enter these commands. export AWS_PROFILE=your_aws_config_profile_eg_default Container Insights Prometheus metrics monitoring 746 Amazon CloudWatch User Guide export AWS_DEFAULT_REGION=your_aws_region_eg_ap-southeast-1 export CLOUDFORMATION_STACK_NAME=your_cloudformation_stack_name aws cloudformation delete-stack \ --stack-name ${CLOUDFORMATION_STACK_NAME} \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Scraping additional Prometheus sources and importing those metrics The CloudWatch agent with Prometheus monitoring needs two configurations to scrape the Prometheus metrics. One is for the standard Prometheus configurations as documented in <scrape_config> in the Prometheus documentation. The other is for the CloudWatch agent configuration. For Amazon ECS clusters, the configurations are integrated with the Parameter Store of AWS Systems Manager by the secrets in the Amazon ECS task definition: • The secret PROMETHEUS_CONFIG_CONTENT is for the Prometheus scrape configuration. • The secret CW_CONFIG_CONTENT is for the CloudWatch agent configuration. To scrape additional Prometheus metrics sources and import those metrics to CloudWatch, you modify both the Prometheus scrape configuration and the CloudWatch agent configuration, and then re-deploy the agent with the updated configuration. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of |
acw-ug-235 | acw-ug.pdf | 235 | Manager by the secrets in the Amazon ECS task definition: • The secret PROMETHEUS_CONFIG_CONTENT is for the Prometheus scrape configuration. • The secret CW_CONFIG_CONTENT is for the CloudWatch agent configuration. To scrape additional Prometheus metrics sources and import those metrics to CloudWatch, you modify both the Prometheus scrape configuration and the CloudWatch agent configuration, and then re-deploy the agent with the updated configuration. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of the security group for the CloudWatch agent must allow the CloudWatch agent to connect to the Prometheus workloads' port by private IP. Prometheus scrape configuration The CloudWatch agent supports the standard Prometheus scrape configurations as documented in <scrape_config> in the Prometheus documentation. You can edit this section to update the configurations that are already in this file, and add additional Prometheus scraping targets. By default, the sample configuration file contains the following global configuration lines: global: Container Insights Prometheus metrics monitoring 747 Amazon CloudWatch scrape_interval: 1m scrape_timeout: 10s User Guide • scrape_interval— Defines how frequently to scrape targets. • scrape_timeout— Defines how long to wait before a scrape request times out. You can also define different values for these settings at the job level, to override the global configurations. Prometheus scraping jobs The CloudWatch agent YAML files already have some default scraping jobs configured. For example, in the YAML files for Amazon ECS such as cwagent-ecs-prometheus-metric-for- bridge-host.yaml, the default scraping jobs are configured in the ecs_service_discovery section. "ecs_service_discovery": { "sd_frequency": "1m", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { }, "task_definition_list": [ { "sd_job_name": "ecs-appmesh-colors", "sd_metrics_ports": "9901", "sd_task_definition_arn_pattern": ".*:task-definition\/.*- ColorTeller-(white):[0-9]+", "sd_metrics_path": "/stats/prometheus" }, { "sd_job_name": "ecs-appmesh-gateway", "sd_metrics_ports": "9901", "sd_task_definition_arn_pattern": ".*:task-definition/.*- ColorGateway:[0-9]+", "sd_metrics_path": "/stats/prometheus" } ] } Each of these default targets are scraped, and the metrics are sent to CloudWatch in log events using embedded metric format. For more information, see Embedding metrics within logs. Container Insights Prometheus metrics monitoring 748 Amazon CloudWatch User Guide Log events from Amazon ECS clusters are stored in the /aws/ecs/ containerinsights/cluster_name/prometheus log group. Each scraping job is contained in a different log stream in this log group. To add a new scraping target, you add a new entry in the task_definition_list section under the ecs_service_discovery section. of the YAML file, and restart the agent. For an example of this process, see Tutorial for adding a new Prometheus scrape target: Prometheus API Server metrics. CloudWatch agent configuration for Prometheus The CloudWatch agent configuration file has a prometheus section under metrics_collected for the Prometheus scraping configuration. It includes the following configuration options: • cluster_name— specifies the cluster name to be added as a label in the log event. This field is optional. If you omit it, the agent can detect the Amazon ECS cluster name. • log_group_name— specifies the log group name for the scraped Prometheus metrics. This field is optional. If you omit it, CloudWatch uses /aws/ecs/containerinsights/cluster_name/ prometheus for logs from Amazon ECS clusters. • prometheus_config_path— specifies the Prometheus scrape configuration file path. If the value of this field starts with env: the Prometheus scrape configuration file contents will be retrieved from the container's environment variable. Do not change this field. • ecs_service_discovery— is the section to specify the configurations of the Amazon ECS Prometheus target auto-discovery functions. Two modes are supported to discover the Prometheus targets: discovery based on the container’s docker label or discovery based on the Amazon ECS task definition ARN regular expression. You can use the two modes together and the CloudWatch agent will de-duplicate the discovered targets based on: {private_ip}:{port}/ {metrics_path}. The ecs_service_discovery section can contain the following fields: • sd_frequency is the frequency to discover the Prometheus exporters. Specify a number and a unit suffix. For example, 1m for once per minute or 30s for once per 30 seconds. Valid unit suffixes are ns, us, ms, s, m, and h. This field is optional. The default is 60 seconds (1 minute). Container Insights Prometheus metrics monitoring 749 Amazon CloudWatch User Guide • sd_target_cluster is the target Amazon ECS cluster name for auto-discovery. This field is optional. The default is the name of the Amazon ECS cluster where the CloudWatch agent is installed. • sd_cluster_region is the target Amazon ECS cluster's Region. This field is optional. The default is the Region of the Amazon ECS cluster where the CloudWatch agent is installed. . • sd_result_file is the path of the YAML file for the Prometheus target results. The Prometheus scrape configuration will refer to this file. • docker_label is an optional section that you can use to specify the configuration for docker label-based service discovery. If you omit this section, docker label-based discovery is not used. This section can contain the following fields: • |
acw-ug-236 | acw-ug.pdf | 236 | Amazon ECS cluster where the CloudWatch agent is installed. • sd_cluster_region is the target Amazon ECS cluster's Region. This field is optional. The default is the Region of the Amazon ECS cluster where the CloudWatch agent is installed. . • sd_result_file is the path of the YAML file for the Prometheus target results. The Prometheus scrape configuration will refer to this file. • docker_label is an optional section that you can use to specify the configuration for docker label-based service discovery. If you omit this section, docker label-based discovery is not used. This section can contain the following fields: • sd_port_label is the container's docker label name that specifies the container port for Prometheus metrics. The default value is ECS_PROMETHEUS_EXPORTER_PORT. If the container does not have this docker label, the CloudWatch agent will skip it. • sd_metrics_path_label is the container's docker label name that specifies the Prometheus metrics path. The default value is ECS_PROMETHEUS_METRICS_PATH. If the container does not have this docker label, the agent assumes the default path /metrics. • sd_job_name_label is the container's docker label name that specifies the Prometheus scrape job name. The default value is job. If the container does not have this docker label, the CloudWatch agent uses the job name in the Prometheus scrape configuration. • task_definition_list is an optional section that you can use to specify the configuration of task definition-based service discovery. If you omit this section, task definition-based discovery is not used. This section can contain the following fields: • sd_task_definition_arn_pattern is the pattern to use to specify the Amazon ECS task definitions to discover. This is a regular expression. • sd_metrics_ports lists the containerPort for the Prometheus metrics. Separate the containerPorts with semicolons. • sd_container_name_pattern specifies the Amazon ECS task container names. This is a regular expression. • sd_metrics_path specifies the Prometheus metric path. If you omit this, the agent assumes the default path /metrics • sd_job_name specifies the Prometheus scrape job name. If you omit this field, the CloudWatch agent uses the job name in the Prometheus scrape configuration. Container Insights Prometheus metrics monitoring 750 Amazon CloudWatch User Guide • service_name_list_for_tasks is an optional section that you can use to specify the configuration of service name-based discovery. If you omit this section, service name-based discovery is not used. This section can contain the following fields: • sd_service_name_pattern is the pattern to use to specify the Amazon ECS service where tasks are to be discovered. This is a regular expression. • sd_metrics_ports Lists the containerPort for the Prometheus metrics. Separate multiple containerPorts with semicolons. • sd_container_name_pattern specifies the Amazon ECS task container names. This is a regular expression. • sd_metrics_path specifies the Prometheus metrics path. If you omit this, the agent assumes that the default path /metrics. • sd_job_name specifies the Prometheus scrape job name. If you omit this field, the CloudWatch agent uses the job name in the Prometheus scrape configuration. • metric_declaration— are sections that specify the array of logs with embedded metric format to be generated. There are metric_declaration sections for each Prometheus source that the CloudWatch agent imports from by default. These sections each include the following fields: • label_matcher is a regular expression that checks the value of the labels listed in source_labels. The metrics that match are enabled for inclusion in the embedded metric format sent to CloudWatch. If you have multiple labels specified in source_labels, we recommend that you do not use ^ or $ characters in the regular expression for label_matcher. • source_labels specifies the value of the labels that are checked by the label_matcher line. • label_separator specifies the separator to be used in the label_matcher line if multiple source_labels are specified. The default is ;. You can see this default used in the label_matcher line in the following example. • metric_selectors is a regular expression that specifies the metrics to be collected and sent to CloudWatch. • dimensions is the list of labels to be used as CloudWatch dimensions for each selected metric. See the following metric_declaration example. Container Insights Prometheus metrics monitoring 751 Amazon CloudWatch User Guide "metric_declaration": [ { "source_labels":[ "Service", "Namespace"], "label_matcher":"(.*node-exporter.*|.*kube-dns.*);kube-system$", "dimensions":[ ["Service", "Namespace"] ], "metric_selectors":[ "^coredns_dns_request_type_count_total$" ] } ] This example configures an embedded metric format section to be sent as a log event if the following conditions are met: • The value of Service contains either node-exporter or kube-dns. • The value of Namespace is kube-system. • The Prometheus metric coredns_dns_request_type_count_total contains both Service and Namespace labels. The log event that is sent includes the following highlighted section: { "CloudWatchMetrics":[ { "Metrics":[ { "Name":"coredns_dns_request_type_count_total" } ], "Dimensions":[ [ "Namespace", "Service" ] ], "Namespace":"ContainerInsights/Prometheus" } ], "Namespace":"kube-system", Container Insights Prometheus metrics monitoring 752 Amazon CloudWatch "Service":"kube-dns", "coredns_dns_request_type_count_total":2562, "eks_amazonaws_com_component":"kube-dns", "instance":"192.168.61.254:9153", "job":"kubernetes-service-endpoints", ... } Detailed guide for autodiscovery on Amazon ECS clusters User Guide Prometheus provides dozens |
acw-ug-237 | acw-ug.pdf | 237 | format section to be sent as a log event if the following conditions are met: • The value of Service contains either node-exporter or kube-dns. • The value of Namespace is kube-system. • The Prometheus metric coredns_dns_request_type_count_total contains both Service and Namespace labels. The log event that is sent includes the following highlighted section: { "CloudWatchMetrics":[ { "Metrics":[ { "Name":"coredns_dns_request_type_count_total" } ], "Dimensions":[ [ "Namespace", "Service" ] ], "Namespace":"ContainerInsights/Prometheus" } ], "Namespace":"kube-system", Container Insights Prometheus metrics monitoring 752 Amazon CloudWatch "Service":"kube-dns", "coredns_dns_request_type_count_total":2562, "eks_amazonaws_com_component":"kube-dns", "instance":"192.168.61.254:9153", "job":"kubernetes-service-endpoints", ... } Detailed guide for autodiscovery on Amazon ECS clusters User Guide Prometheus provides dozens of dynamic service-discovery mechanisms as described in <scrape_config>. However there is no built-in service discovery for Amazon ECS. The CloudWatch agent adds this mechanism. When the Amazon ECS Prometheus service discovery is enabled, the CloudWatch agent periodically makes the following API calls to Amazon ECS and Amazon EC2 frontends to retrieve the metadata of the running ECS tasks in the target ECS cluster. EC2:DescribeInstances ECS:ListTasks ECS:ListServices ECS:DescribeContainerInstances ECS:DescribeServices ECS:DescribeTasks ECS:DescribeTaskDefinition The metadata is used by the CloudWatch agent to scan the Prometheus targets within the ECS cluster. The CloudWatch agent supports three service discovery modes: • Container docker label-based service discovery • ECS task definition ARN regular expression-based service discovery • ECS service name regular expression-based service discovery All modes can be used together. CloudWatch agent de-duplicates the discovered targets based on: {private_ip}:{port}/{metrics_path}. All discovered targets are written into a result file specified by the sd_result_file configuration field within the CloudWatch agent container. The following is a sample result file: - targets: Container Insights Prometheus metrics monitoring 753 Amazon CloudWatch User Guide - 10.6.1.95:32785 labels: __metrics_path__: /metrics ECS_PROMETHEUS_EXPORTER_PORT: "9406" ECS_PROMETHEUS_JOB_NAME: demo-jar-ec2-bridge-dynamic ECS_PROMETHEUS_METRICS_PATH: /metrics InstanceType: t3.medium LaunchType: EC2 SubnetId: subnet-123456789012 TaskDefinitionFamily: demo-jar-ec2-bridge-dynamic-port TaskGroup: family:demo-jar-ec2-bridge-dynamic-port TaskRevision: "7" VpcId: vpc-01234567890 container_name: demo-jar-ec2-bridge-dynamic-port job: demo-jar-ec2-bridge-dynamic - targets: - 10.6.3.193:9404 labels: __metrics_path__: /metrics ECS_PROMETHEUS_EXPORTER_PORT_SUBSET_B: "9404" ECS_PROMETHEUS_JOB_NAME: demo-tomcat-ec2-bridge-mapped-port ECS_PROMETHEUS_METRICS_PATH: /metrics InstanceType: t3.medium LaunchType: EC2 SubnetId: subnet-123456789012 TaskDefinitionFamily: demo-tomcat-ec2-bridge-mapped-port TaskGroup: family:demo-jar-tomcat-bridge-mapped-port TaskRevision: "12" VpcId: vpc-01234567890 container_name: demo-tomcat-ec2-bridge-mapped-port job: demo-tomcat-ec2-bridge-mapped-port You can directly integrate this result file with Prometheus file-based service discovery. For more information about Prometheus file-based service discovery, see <file_sd_config>. Suppose the result file is written to /tmp/cwagent_ecs_auto_sd.yaml The following Prometheus scrape configuration will consume it. global: scrape_interval: 1m scrape_timeout: 10s scrape_configs: - job_name: cwagent-ecs-file-sd-config Container Insights Prometheus metrics monitoring 754 Amazon CloudWatch sample_limit: 10000 file_sd_configs: - files: [ "/tmp/cwagent_ecs_auto_sd.yaml" ] User Guide The CloudWatch agent also adds the following additional labels for the discovered targets. • container_name • TaskDefinitionFamily • TaskRevision • TaskGroup • StartedBy • LaunchType • job • __metrics_path__ • Docker labels When the cluster has the EC2 launch type, the following three labels are added. • InstanceType • VpcId • SubnetId Note Docker labels that don't match the regular expression [a-zA-Z_][a-zA-Z0-9_]* are filtered out. This matches the Prometheus conventions as listed in label_name in Configuration file in the Prometheus documentation. ECS service discovery configuration examples This section includes examples that demonstrate ECS service discovery. Example 1 "ecs_service_discovery": { Container Insights Prometheus metrics monitoring 755 Amazon CloudWatch "sd_frequency": "1m", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { } } User Guide This example enables docker label-based service discovery. The CloudWatch agent will query the ECS tasks’ metadata once per minute and write the discovered targets into the /tmp/ cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. The default value of sd_port_label in the docker_label section is ECS_PROMETHEUS_EXPORTER_PORT. If any running container in the ECS tasks has a ECS_PROMETHEUS_EXPORTER_PORT docker label, the CloudWatch agent uses its value as container port to scan all exposed ports of the container. If there is a match, the mapped host port plus the private IP of the container are used to construct the Prometheus exporter target in the following format: private_ip:host_port. The default value of sd_metrics_path_label in the docker_label section is ECS_PROMETHEUS_METRICS_PATH. If the container has this docker label, its value will be used as the __metrics_path__ . If the container does not have this label, the default value /metrics is used. The default value of sd_job_name_label in the docker_label section is job. If the container has this docker label, its value will be appended as one of the labels for the target to replace the default job name specified in the Prometheus configuration. The value of this docker label is used as the log stream name in the CloudWatch Logs log group. Example 2 "ecs_service_discovery": { "sd_frequency": "15s", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { "sd_port_label": "ECS_PROMETHEUS_EXPORTER_PORT_SUBSET_A", "sd_job_name_label": "ECS_PROMETHEUS_JOB_NAME" } } This example enables docker label-based service discovery. THe CloudWatch agent will query the ECS tasks’ metadata every 15 seconds and write the discovered targets into the /tmp/ Container Insights Prometheus metrics monitoring 756 Amazon CloudWatch User Guide cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. The containers with a docker label of ECS_PROMETHEUS_EXPORTER_PORT_SUBSET_A will be scanned. The value of the docker label ECS_PROMETHEUS_JOB_NAME is used |
acw-ug-238 | acw-ug.pdf | 238 | configuration. The value of this docker label is used as the log stream name in the CloudWatch Logs log group. Example 2 "ecs_service_discovery": { "sd_frequency": "15s", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { "sd_port_label": "ECS_PROMETHEUS_EXPORTER_PORT_SUBSET_A", "sd_job_name_label": "ECS_PROMETHEUS_JOB_NAME" } } This example enables docker label-based service discovery. THe CloudWatch agent will query the ECS tasks’ metadata every 15 seconds and write the discovered targets into the /tmp/ Container Insights Prometheus metrics monitoring 756 Amazon CloudWatch User Guide cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. The containers with a docker label of ECS_PROMETHEUS_EXPORTER_PORT_SUBSET_A will be scanned. The value of the docker label ECS_PROMETHEUS_JOB_NAME is used as the job name. Example 3 "ecs_service_discovery": { "sd_frequency": "5m", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "task_definition_list": [ { "sd_job_name": "java-prometheus", "sd_metrics_path": "/metrics", "sd_metrics_ports": "9404; 9406", "sd_task_definition_arn_pattern": ".*:task-definition/.*javajmx.*:[0-9]+" }, { "sd_job_name": "envoy-prometheus", "sd_metrics_path": "/stats/prometheus", "sd_container_name_pattern": "^envoy$", "sd_metrics_ports": "9901", "sd_task_definition_arn_pattern": ".*:task-definition/.*appmesh.*:23" } ] } This example enables ECS task definition ARN regular expression-based service discovery. The CloudWatch agent will query the ECS tasks’ metadata every five minutes and write the discovered targets into the /tmp/cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. Two task definition ARN regular expresion sections are defined: • For the first section, the ECS tasks with javajmx in their ECS task definition ARN are filtered for the container port scan. If the containers within these ECS tasks expose the container port on 9404 or 9406, the mapped host port along with the private IP of the container are used to create the Prometheus exporter targets. The value of sd_metrics_path sets __metrics_path__ to /metrics. So the CloudWatch agent will scrape the Prometheus metrics from private_ip:host_port/metrics, the scraped metrics are sent to the java-prometheus log stream in CloudWatch Logs in the log group /aws/ecs/ containerinsights/cluster_name/prometheus. Container Insights Prometheus metrics monitoring 757 Amazon CloudWatch User Guide • For the second section, the ECS tasks with appmesh in their ECS task definition ARN and with version of :23 are filtered for the container port scan. For containers with a name of envoy that expose the container port on 9901, the mapped host port along with the private IP of the container are used to create the Prometheus exporter targets. The value within these ECS tasks expose the container port on 9404 or 9406, the mapped host port along with the private IP of the container are used to create the Prometheus exporter targets. The value of sd_metrics_path sets __metrics_path__ to /stats/prometheus. So the CloudWatch agent will scrape the Prometheus metrics from private_ip:host_port/stats/prometheus, and send the scraped metrics to the envoy-prometheus log stream in CloudWatch Logs in the log group /aws/ecs/containerinsights/cluster_name/prometheus. Example 4 "ecs_service_discovery": { "sd_frequency": "5m", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "service_name_list_for_tasks": [ { "sd_job_name": "nginx-prometheus", "sd_metrics_path": "/metrics", "sd_metrics_ports": "9113", "sd_service_name_pattern": "^nginx-.*" }, { "sd_job_name": "haproxy-prometheus", "sd_metrics_path": "/stats/metrics", "sd_container_name_pattern": "^haproxy$", "sd_metrics_ports": "8404", "sd_service_name_pattern": ".*haproxy-service.*" } ] } This example enables ECS service name regular expression-based service discovery. The CloudWatch agent will query the ECS services’ metadata every five minutes and write the discovered targets into the /tmp/cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. Two service name regular expresion sections are defined: Container Insights Prometheus metrics monitoring 758 Amazon CloudWatch User Guide • For the first section, the ECS tasks that are associated with ECS services that have names matching the regular expression ^nginx-.* are filtered for the container port scan. If the containers within these ECS tasks expose the container port on 9113, the mapped host port along with the private IP of the container are used to create the Prometheus exporter targets. The value of sd_metrics_path sets __metrics_path__ to /metrics. So the CloudWatch agent will scrape the Prometheus metrics from private_ip:host_port/metrics, and the scraped metrics are sent to the nginx-prometheus log stream in CloudWatch Logs in the log group /aws/ecs/containerinsights/cluster_name/prometheus. • or the second section, the ECS tasks that are associated with ECS services that have names matching the regular expression .*haproxy-service.* are filtered for the container port scan. For containers with a name of haproxy expose the container port on 8404, the mapped host port along with the private IP of the container are used to create the Prometheus exporter targets. The value of sd_metrics_path sets __metrics_path__ to /stats/metrics. So the CloudWatch agent will scrape the Prometheus metrics from private_ip:host_port/ stats/metrics, and the scraped metrics are sent to the haproxy-prometheus log stream in CloudWatch Logs in the log group /aws/ecs/containerinsights/cluster_name/ prometheus. Example 5 "ecs_service_discovery": { "sd_frequency": "1m30s", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { "sd_port_label": "MY_PROMETHEUS_EXPORTER_PORT_LABEL", "sd_metrics_path_label": "MY_PROMETHEUS_METRICS_PATH_LABEL", "sd_job_name_label": "MY_PROMETHEUS_METRICS_NAME_LABEL" } "task_definition_list": [ { "sd_metrics_ports": "9150", "sd_task_definition_arn_pattern": "*memcached.*" } ] } Container Insights Prometheus metrics monitoring 759 Amazon CloudWatch User Guide This example enables both ECS service discovery modes. The CloudWatch agent will query the ECS tasks’ metadata every 90 seconds and write the discovered targets into the /tmp/ cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. For the docker-based service discovery configuration: • The ECS tasks with docker label MY_PROMETHEUS_EXPORTER_PORT_LABEL |
acw-ug-239 | acw-ug.pdf | 239 | to the haproxy-prometheus log stream in CloudWatch Logs in the log group /aws/ecs/containerinsights/cluster_name/ prometheus. Example 5 "ecs_service_discovery": { "sd_frequency": "1m30s", "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", "docker_label": { "sd_port_label": "MY_PROMETHEUS_EXPORTER_PORT_LABEL", "sd_metrics_path_label": "MY_PROMETHEUS_METRICS_PATH_LABEL", "sd_job_name_label": "MY_PROMETHEUS_METRICS_NAME_LABEL" } "task_definition_list": [ { "sd_metrics_ports": "9150", "sd_task_definition_arn_pattern": "*memcached.*" } ] } Container Insights Prometheus metrics monitoring 759 Amazon CloudWatch User Guide This example enables both ECS service discovery modes. The CloudWatch agent will query the ECS tasks’ metadata every 90 seconds and write the discovered targets into the /tmp/ cwagent_ecs_auto_sd.yaml file within the CloudWatch agent container. For the docker-based service discovery configuration: • The ECS tasks with docker label MY_PROMETHEUS_EXPORTER_PORT_LABEL will be filtered for Prometheus port scan. The target Prometheus container port is specified by the value of the label MY_PROMETHEUS_EXPORTER_PORT_LABEL. • The value of the docker label MY_PROMETHEUS_EXPORTER_PORT_LABEL is used for __metrics_path__. If the container does not have this docker label, the default value / metrics is used. • The value of the docker label MY_PROMETHEUS_EXPORTER_PORT_LABEL is used as the job label. If the container does not have this docker label, the job name defined in the Prometheus configuration is used. For the ECS task definition ARN regular expression-based service discovery configuration: • The ECS tasks with memcached in the ECS task definition ARN are filtered for container port scan. The target Prometheus container port is 9150 as defined by sd_metrics_ports. The default metrics path /metrics is used. The job name defined in the Prometheus configuration is used. (Optional) Set up sample containerized Amazon ECS workloads for Prometheus metric testing To test the Prometheus metric support in CloudWatch Container Insights, you can set up one or more of the following containerized workloads. The CloudWatch agent with Prometheus support automatically collects metrics from each of these workloads. To see the metrics that are collected by default, see Prometheus metrics collected by the CloudWatch agent. Topics • Sample App Mesh workload for Amazon ECS clusters • Sample Java/JMX workload for Amazon ECS clusters • Sample NGINX workload for Amazon ECS clusters • Sample NGINX Plus workload for Amazon ECS clusters • Tutorial for adding a new Prometheus scrape target: Memcached on Amazon ECS Container Insights Prometheus metrics monitoring 760 Amazon CloudWatch User Guide • Tutorial for scraping Redis OSS Prometheus metrics on Amazon ECS Fargate Sample App Mesh workload for Amazon ECS clusters To collect metrics from a sample Prometheus workload for Amazon ECS, you must be running Container Insights in the cluster. For information about installing Container Insights, see Setting up Container Insights on Amazon ECS. First, follow this walkthrough to deploy the sample color app on your Amazon ECS cluster. After you finish, you will have App Mesh Prometheus metrics exposed on port 9901. Next, follow these steps to install the CloudWatch agent with Prometheus monitoring on the same Amazon ECS cluster where you installed the color app. The steps in this section install the CloudWatch agent in bridge network mode. The environment variables ENVIRONMENT_NAME, AWS_PROFILE, and AWS_DEFAULT_REGION that you set in the walkthrough will also be used in the following steps. To install the CloudWatch agent with Prometheus monitoring for testing 1. Download the AWS CloudFormation template by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for- bridge-host.yaml 2. Set the network mode by entering the following commands. export ECS_CLUSTER_NAME=${ENVIRONMENT_NAME} export ECS_NETWORK_MODE=bridge 3. Create the AWS CloudFormation stack by entering the following commands. aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=${ECS_CLUSTER_NAME} \ ParameterKey=CreateIAMRoles,ParameterValue=True \ ParameterKey=ECSNetworkMode,ParameterValue=${ECS_NETWORK_MODE} \ ParameterKey=TaskRoleName,ParameterValue=CWAgent-Prometheus- TaskRole-${ECS_CLUSTER_NAME} \ Container Insights Prometheus metrics monitoring 761 Amazon CloudWatch User Guide ParameterKey=ExecutionRoleName,ParameterValue=CWAgent-Prometheus- ExecutionRole-${ECS_CLUSTER_NAME} \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} 4. (Optional) When the AWS CloudFormation stack is created, you see a CREATE_COMPLETE message. If you to check the status before you see that message, enter the following command. aws cloudformation describe-stacks \ --stack-name CWAgent-Prometheus-ECS-${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --query 'Stacks[0].StackStatus' \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Troubleshooting The steps in the walkthrough use jq to parse the output result of the AWS CLI. For more information about installing jq, see jq. Use the following command to set the default output format of your AWS CLI to JSON so jq can parse it correctly. $ aws configure When the response gets to Default output format, enter json. Uninstall the CloudWatch agent with Prometheus monitoring When you are finished testing, enter the following command to uninstall the CloudWatch agent by deleting the AWS CloudFormation stack. aws cloudformation delete-stack \ --stack-name CWAgent-Prometheus-ECS-${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Sample Java/JMX workload for Amazon ECS clusters JMX Exporter is an official Prometheus exporter that can scrape and expose JMX mBeans as Prometheus metrics. For more information, see prometheus/jmx_exporter. Container Insights Prometheus metrics monitoring 762 Amazon CloudWatch User Guide The CloudWatch agent with Prometheus support scrapes the Java/JMX Prometheus metrics based on the service discovery configuration in the Amazon ECS cluster. |
acw-ug-240 | acw-ug.pdf | 240 | Uninstall the CloudWatch agent with Prometheus monitoring When you are finished testing, enter the following command to uninstall the CloudWatch agent by deleting the AWS CloudFormation stack. aws cloudformation delete-stack \ --stack-name CWAgent-Prometheus-ECS-${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --region ${AWS_DEFAULT_REGION} \ --profile ${AWS_PROFILE} Sample Java/JMX workload for Amazon ECS clusters JMX Exporter is an official Prometheus exporter that can scrape and expose JMX mBeans as Prometheus metrics. For more information, see prometheus/jmx_exporter. Container Insights Prometheus metrics monitoring 762 Amazon CloudWatch User Guide The CloudWatch agent with Prometheus support scrapes the Java/JMX Prometheus metrics based on the service discovery configuration in the Amazon ECS cluster. You can configure the JMX Exporter to expose the metrics on a different port or metrics_path. If you do change the port or path, update the default ecs_service_discovery section in the CloudWatch agent configuration. To collect metrics from a sample Prometheus workload for Amazon ECS, you must be running Container Insights in the cluster. For information about installing Container Insights, see Setting up Container Insights on Amazon ECS. To install the Java/JMX sample workload for Amazon ECS clusters 1. Follow the steps in these sections to create your Docker images. • Example: Java Jar Application Docker image with Prometheus metrics • Example: Apache Tomcat Docker image with Prometheus metrics 2. Specify the following two docker labels in the Amazon ECS task definition file. You can then run the task definition as an Amazon ECS service or Amazon ECS task in the cluster. • Set ECS_PROMETHEUS_EXPORTER_PORT to point to the containerPort where the Prometheus metrics are exposed. • Set Java_EMF_Metrics to true. The CloudWatch agent uses this flag to generated the embedded metric format in the log event. The following is an example: { "family": "workload-java-ec2-bridge", "taskRoleArn": "{{task-role-arn}}", "executionRoleArn": "{{execution-role-arn}}", "networkMode": "bridge", "containerDefinitions": [ { "name": "tomcat-prometheus-workload-java-ec2-bridge-dynamic-port", "image": "your_docker_image_tag_for_tomcat_with_prometheus_metrics", "portMappings": [ { "hostPort": 0, "protocol": "tcp", "containerPort": 9404 Container Insights Prometheus metrics monitoring 763 User Guide Amazon CloudWatch } ], "dockerLabels": { "ECS_PROMETHEUS_EXPORTER_PORT": "9404", "Java_EMF_Metrics": "true" } } ], "requiresCompatibilities": [ "EC2" ], "cpu": "256", "memory": "512" } The default setting of the CloudWatch agent in the AWS CloudFormation template enables both docker label-based service discovery and task definition ARN-based service discovery. To view these default settings, see line 65 of the CloudWatch agent YAML configuration file. The containers with the ECS_PROMETHEUS_EXPORTER_PORT label will be auto-discovered based on the specified container port for Prometheus scraping. The default setting of the CloudWatch agent also has the metric_declaration setting for Java/JMX at line 112 of the same file. All docker labels of the target containers will be added as additional labels in the Prometheus metrics and sent to CloudWatch Logs. For the Java/JMX containers with docker label Java_EMF_Metrics=“true”, the embedded metric format will be generated. Sample NGINX workload for Amazon ECS clusters The NGINX Prometheus exporter can scrape and expose NGINX data as Prometheus metrics. This example uses the exporter in tandem with the NGINX reverse proxy service for Amazon ECS. For more information about the NGINX Prometheus exporter, see nginx-prometheus-exporter on Github. For more information about the NGINX reverse proxy, see ecs-nginx-reverse-proxy on Github. The CloudWatch agent with Prometheus support scrapes the NGINX Prometheus metrics based on the service discovery configuration in the Amazon ECS cluster. You can configure the NGINX Prometheus Exporter to expose the metrics on a different port or path. If you change the port or path, update the ecs_service_discovery section in the CloudWatch agent configuration file. Container Insights Prometheus metrics monitoring 764 Amazon CloudWatch User Guide Install the NGINX reverse proxy sample workload for Amazon ECS clusters Follow these steps to install the NGINX reverse proxy sample workload. Create the Docker images To create the Docker images for the NGINX reverse proxy sample workload 1. Download the following folder from the NGINX reverse proxy repo: https://github.com/ awslabs/ecs-nginx-reverse-proxy/tree/master/reverse-proxy/. 2. Find the app directory and build an image from that directory: docker build -t web-server-app ./path-to-app-directory 3. Build a custom image for NGINX. First, create a directory with the following two files: • A sample Dockerfile: FROM nginx COPY nginx.conf /etc/nginx/nginx.conf • An nginx.conf file, modified from https://github.com/awslabs/ecs-nginx-reverse-proxy/ tree/master/reverse-proxy/: events { worker_connections 768; } http { # Nginx will handle gzip compression of responses from the app server gzip on; gzip_proxied any; gzip_types text/plain application/json; gzip_min_length 1000; server{ listen 8080; location /stub_status { stub_status on; } } Container Insights Prometheus metrics monitoring 765 Amazon CloudWatch server { listen 80; User Guide # Nginx will reject anything not matching /api location /api { # Reject requests with unsupported HTTP method if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE)$) { return 405; } # Only requests matching the whitelist expectations will # get sent to the application server proxy_pass http://app:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; } } } Note stub_status must be enabled on the |
acw-ug-241 | acw-ug.pdf | 241 | gzip_proxied any; gzip_types text/plain application/json; gzip_min_length 1000; server{ listen 8080; location /stub_status { stub_status on; } } Container Insights Prometheus metrics monitoring 765 Amazon CloudWatch server { listen 80; User Guide # Nginx will reject anything not matching /api location /api { # Reject requests with unsupported HTTP method if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE)$) { return 405; } # Only requests matching the whitelist expectations will # get sent to the application server proxy_pass http://app:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; } } } Note stub_status must be enabled on the same port that nginx-prometheus- exporter is configured to scrape metrics from. In our example task definition, nginx-prometheus-exporter is configured to scrape metrics from port 8080. 4. Build an image from files in your new directory: docker build -t nginx-reverse-proxy ./path-to-your-directory 5. Upload your new images to an image repository for later use. Create the task definition to run NGINX and the web server app in Amazon ECS Next, you set up the task definition. This task definition enables the collection and export of NGINX Prometheus metrics. The NGINX container tracks input from the app, and exposes that data to port 8080, as set in nginx.conf. Container Insights Prometheus metrics monitoring 766 Amazon CloudWatch User Guide The NGINX prometheus exporter container scrapes these metrics, and posts them to port 9113, for use in CloudWatch. To set up the task definition for the NGINX sample Amazon ECS workload 1. Create a task definition JSON file with the following content. Replace your-customized- nginx-iamge with the image URI for your customized NGINX image, and replace your-web- server-app-image with the image URI for your web server app image. { "containerDefinitions": [ { "name": "nginx", "image": "your-customized-nginx-image", "memory": 256, "cpu": 256, "essential": true, "portMappings": [ { "containerPort": 80, "protocol": "tcp" } ], "links": [ "app" ] }, { "name": "app", "image": "your-web-server-app-image", "memory": 256, "cpu": 256, "essential": true }, { "name": "nginx-prometheus-exporter", "image": "docker.io/nginx/nginx-prometheus-exporter:0.8.0", "memory": 256, "cpu": 256, "essential": true, "command": [ "-nginx.scrape-uri", "http://nginx:8080/stub_status" Container Insights Prometheus metrics monitoring 767 Amazon CloudWatch User Guide ], "links":[ "nginx" ], "portMappings":[ { "containerPort": 9113, "protocol": "tcp" } ] } ], "networkMode": "bridge", "placementConstraints": [], "family": "nginx-sample-stack" } 2. Register the task definition by entering the following command. aws ecs register-task-definition --cli-input-json file://path-to-your-task- definition-json 3. Create a service to run the task by entering the following command: Be sure not to change the service name. We will be running a CloudWatch agent service using a configuration that searches for tasks using the name patterns of the services that started them. For example, for the CloudWatch agent to find the task launched by this command, you can specify the value of sd_service_name_pattern to be ^nginx-service$. The next section provides more details. aws ecs create-service \ --cluster your-cluster-name \ --service-name nginx-service \ --task-definition nginx-sample-stack:1 \ --desired-count 1 Configure the CloudWatch agent to scrape NGINX Prometheus metrics The final step is to configure the CloudWatch agent to scrape the NGINX metrics. In this example, the CloudWatch agent discovers the task via the service name pattern, and the port 9113, where the exporter exposes the prometheus metrics for NGINX. With the task discovered and the metrics Container Insights Prometheus metrics monitoring 768 Amazon CloudWatch User Guide available, the CloudWatch agent begins posting the collected metrics to the log stream nginx- prometheus-exporter. To configure the CloudWatch agent to scrape the NGINX metrics 1. Download the latest version of the necessary YAML file by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for- bridge-host.yaml 2. Open the file with a text editor, and find the full CloudWatch agent confguration in the value key in the resource:CWAgentConfigSSMParameter section. Then, in the ecs_service_discovery section, add the following service_name_list_for_tasks section. "service_name_list_for_tasks": [ { "sd_job_name": "nginx-prometheus-exporter", "sd_metrics_path": "/metrics", "sd_metrics_ports": "9113", "sd_service_name_pattern": "^nginx-service$" } ], 3. In the same file, add the following section in the metric_declaration section to allow NGINX metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["job"], "label_matcher": ".*nginx.*", "dimensions": [["ClusterName", "TaskDefinitionFamily", "ServiceName"]], "metric_selectors": [ "^nginx_.*$" ] }, 4. If you don't already have the CloudWatch agent deployed in this cluster, skip to step 8. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by using AWS CloudFormation, you can create a change set by entering the following commands: Container Insights Prometheus metrics monitoring 769 Amazon CloudWatch User Guide ECS_CLUSTER_NAME=your_cluster_name AWS_REGION=your_aws_region ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION \ --change-set-name nginx-scraping-support 5. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation. 6. Revew the newly-created changeset nginx-scraping-support. You should see one change applied to the CWAgentConfigSSMParameter resource. Run the changeset and restart the CloudWatch agent task by entering |
acw-ug-242 | acw-ug.pdf | 242 | the Amazon ECS cluster by using AWS CloudFormation, you can create a change set by entering the following commands: Container Insights Prometheus metrics monitoring 769 Amazon CloudWatch User Guide ECS_CLUSTER_NAME=your_cluster_name AWS_REGION=your_aws_region ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION \ --change-set-name nginx-scraping-support 5. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation. 6. Revew the newly-created changeset nginx-scraping-support. You should see one change applied to the CWAgentConfigSSMParameter resource. Run the changeset and restart the CloudWatch agent task by entering the following command: aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 0 \ --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 7. Wait about 10 seconds, and then enter the following command. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 1 \ --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 8. If you are installing the CloudWatch agent with Prometheus metric collecting on the cluster for the first time, enter the following commands. ECS_CLUSTER_NAME=your_cluster_name Container Insights Prometheus metrics monitoring 770 Amazon CloudWatch User Guide AWS_REGION=your_aws_region ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION Viewing your NGINX metrics and logs You can now view the NGINX metrics being collected. To view the metrics for your sample NGINX workload 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the Region where your cluster is running, choose Metrics in the left navigation pane. Find the ContainerInsights/Prometheus namespace to see the metrics. To see the CloudWatch Logs events, choose Log groups in the navigation pane. The events are in the log group /aws/containerinsights/your_cluster_name/prometheus, in the log stream nginx-prometheus-exporter. Sample NGINX Plus workload for Amazon ECS clusters NGINX Plus is the commerical version of NGINX. You must have a licence to use it. For more information, see NGINX Plus The NGINX Prometheus exporter can scrape and expose NGINX data as Prometheus metrics. This example uses the exporter in tandem with the NGINX Plus reverse proxy service for Amazon ECS. Container Insights Prometheus metrics monitoring 771 Amazon CloudWatch User Guide For more information about the NGINX Prometheus exporter, see nginx-prometheus-exporter on Github. For more information about the NGINX reverse proxy, see ecs-nginx-reverse-proxy on Github. The CloudWatch agent with Prometheus support scrapes the NGINX Plus Prometheus metrics based on the service discovery configuration in the Amazon ECS cluster. You can configure the NGINX Prometheus Exporter to expose the metrics on a different port or path. If you change the port or path, update the ecs_service_discovery section in the CloudWatch agent configuration file. Install the NGINX Plus reverse proxy sample workload for Amazon ECS clusters Follow these steps to install the NGINX reverse proxy sample workload. Create the Docker images To create the Docker images for the NGINX Plus reverse proxy sample workload 1. Download the following folder from the NGINX reverse proxy repo: https://github.com/ awslabs/ecs-nginx-reverse-proxy/tree/master/reverse-proxy/. 2. Find the app directory and build an image from that directory: docker build -t web-server-app ./path-to-app-directory 3. Build a custom image for NGINX Plus. Before you can build the image for NGINX Plus, you need to obtain the key named nginx-repo.key and the SSL certificate nginx-repo.crt for your licensed NGINX Plus. Create a directory and store in it your nginx-repo.key and nginx-repo.crt files. In the directory that you just created, create the following two files: • A sample Dockerfile with the following content. This docker file is adopted from a sample file provided at https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing- nginx-docker/#docker_plus_image. The important change that we make is that we load a separate file, called nginx.conf, which will be created in the next step. FROM debian:buster-slim LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>“ # Define NGINX versions for NGINX Plus and NGINX Plus modules Container Insights Prometheus metrics monitoring 772 Amazon CloudWatch User Guide # Uncomment this block and the versioned nginxPackages block in the main RUN # instruction to install a specific release # ENV NGINX_VERSION 21 # ENV NJS_VERSION 0.3.9 # ENV PKG_RELEASE 1~buster # Download certificate and key from the customer portal (https://cs.nginx.com (https://cs.nginx.com/)) # and copy to the build context COPY nginx-repo.crt /etc/ssl/nginx/ COPY nginx-repo.key /etc/ssl/nginx/ # COPY nginx.conf /etc/ssl/nginx/nginx.conf RUN set -x \ # Create nginx user/group first, to be consistent throughout Docker variants && addgroup --system --gid 101 nginx \ && adduser --system --disabled-login --ingroup nginx --no-create-home --home / nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx \ && apt-get update \ && apt-get install --no-install-recommends --no-install-suggests -y ca- certificates gnupg1 \ && \ NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \ found=''; \ for server in \ ha.pool.sks-keyservers.net (http://ha.pool.sks-keyservers.net/) \ hkp://keyserver.ubuntu.com:80 \ hkp://p80.pool.sks-keyservers.net:80 \ pgp.mit.edu (http://pgp.mit.edu/) \ ; do \ echo "Fetching GPG key $NGINX_GPGKEY from $server"; \ apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; |
acw-ug-243 | acw-ug.pdf | 243 | nginx.conf /etc/ssl/nginx/nginx.conf RUN set -x \ # Create nginx user/group first, to be consistent throughout Docker variants && addgroup --system --gid 101 nginx \ && adduser --system --disabled-login --ingroup nginx --no-create-home --home / nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx \ && apt-get update \ && apt-get install --no-install-recommends --no-install-suggests -y ca- certificates gnupg1 \ && \ NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \ found=''; \ for server in \ ha.pool.sks-keyservers.net (http://ha.pool.sks-keyservers.net/) \ hkp://keyserver.ubuntu.com:80 \ hkp://p80.pool.sks-keyservers.net:80 \ pgp.mit.edu (http://pgp.mit.edu/) \ ; do \ echo "Fetching GPG key $NGINX_GPGKEY from $server"; \ apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \ done; \ test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \ apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \ # Install the latest release of NGINX Plus and/or NGINX Plus modules # Uncomment individual modules if necessary # Use versioned packages over defaults to specify a release && nginxPackages=" \ nginx-plus \ # nginx-plus=${NGINX_VERSION}-${PKG_RELEASE} \ # nginx-plus-module-xslt \ Container Insights Prometheus metrics monitoring 773 Amazon CloudWatch User Guide # nginx-plus-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} \ # nginx-plus-module-geoip \ # nginx-plus-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} \ # nginx-plus-module-image-filter \ # nginx-plus-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} \ # nginx-plus-module-perl \ # nginx-plus-module-perl=${NGINX_VERSION}-${PKG_RELEASE} \ # nginx-plus-module-njs \ # nginx-plus-module-njs=${NGINX_VERSION}+${NJS_VERSION}-${PKG_RELEASE} \ " \ && echo "Acquire::https::plus-pkgs.nginx.com::Verify-Peer \"true\";" >> /etc/apt/ apt.conf.d/90nginx \ && echo "Acquire::https::plus-pkgs.nginx.com::Verify-Host \"true\";" >> /etc/apt/ apt.conf.d/90nginx \ && echo "Acquire::https::plus-pkgs.nginx.com::SslCert \"/etc/ssl/nginx/nginx- repo.crt\";" >> /etc/apt/apt.conf.d/90nginx \ && echo "Acquire::https::plus-pkgs.nginx.com::SslKey \"/etc/ssl/nginx/nginx- repo.key\";" >> /etc/apt/apt.conf.d/90nginx \ && printf "deb https://plus-pkgs.nginx.com/debian buster nginx-plus\n" > /etc/ apt/sources.list.d/nginx-plus.list \ && apt-get update \ && apt-get install --no-install-recommends --no-install-suggests -y \ $nginxPackages \ gettext-base \ curl \ && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/ apt/sources.list.d/nginx-plus.list \ && rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx # Forward request logs to Docker log collector RUN ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 STOPSIGNAL SIGTERM CMD ["nginx", "-g", "daemon off;"] • An nginx.conf file, modified from https://github.com/awslabs/ecs-nginx-reverse-proxy/ tree/master/reverse-proxy/nginx. Container Insights Prometheus metrics monitoring 774 Amazon CloudWatch User Guide events { worker_connections 768; } http { # Nginx will handle gzip compression of responses from the app server gzip on; gzip_proxied any; gzip_types text/plain application/json; gzip_min_length 1000; upstream backend { zone name 10m; server app:3000 weight=2; server app2:3000 weight=1; } server{ listen 8080; location /api { api write=on; } } match server_ok { status 100-599; } server { listen 80; status_zone zone; # Nginx will reject anything not matching /api location /api { # Reject requests with unsupported HTTP method if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE)$) { return 405; } # Only requests matching the whitelist expectations will # get sent to the application server proxy_pass http://backend; health_check uri=/lorem-ipsum match=server_ok; proxy_http_version 1.1; Container Insights Prometheus metrics monitoring 775 Amazon CloudWatch User Guide proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; } } } 4. Build an image from files in your new directory: docker build -t nginx-plus-reverse-proxy ./path-to-your-directory 5. Upload your new images to an image repository for later use. Create the task definition to run NGINX Plus and the web server app in Amazon ECS Next, you set up the task definition. This task definition enables the collection and export of NGINX Plus Prometheus metrics. The NGINX container tracks input from the app, and exposes that data to port 8080, as set in nginx.conf. The NGINX prometheus exporter container scrapes these metrics, and posts them to port 9113, for use in CloudWatch. To set up the task definition for the NGINX sample Amazon ECS workload 1. Create a task definition JSON file with the following content. Replace your-customized- nginx-plus-image with the image URI for your customized NGINX Plus image, and replace your-web-server-app-image with the image URI for your web server app image. { "containerDefinitions": [ { "name": "nginx", "image": "your-customized-nginx-plus-image", "memory": 256, "cpu": 256, "essential": true, "portMappings": [ { "containerPort": 80, "protocol": "tcp" Container Insights Prometheus metrics monitoring 776 Amazon CloudWatch User Guide } ], "links": [ "app", "app2" ] }, { "name": "app", "image": "your-web-server-app-image", "memory": 256, "cpu": 128, "essential": true }, { "name": "app2", "image": "your-web-server-app-image", "memory": 256, "cpu": 128, "essential": true }, { "name": "nginx-prometheus-exporter", "image": "docker.io/nginx/nginx-prometheus-exporter:0.8.0", "memory": 256, "cpu": 256, "essential": true, "command": [ "-nginx.plus", "-nginx.scrape-uri", "http://nginx:8080/api" ], "links":[ "nginx" ], "portMappings":[ { "containerPort": 9113, "protocol": "tcp" } ] } ], "networkMode": "bridge", Container Insights Prometheus metrics monitoring 777 Amazon CloudWatch User Guide "placementConstraints": [], "family": "nginx-plus-sample-stack" } 2. Register the task definition: aws ecs register-task-definition --cli-input-json file://path-to-your-task- definition-json 3. Create a service to run the task by entering the following command: aws ecs create-service \ --cluster your-cluster-name \ --service-name nginx-plus-service \ --task-definition nginx-plus-sample-stack:1 \ --desired-count 1 Be sure not to change the service name. We will be running a CloudWatch agent service using a configuration that searches for tasks using the name patterns of |
acw-ug-244 | acw-ug.pdf | 244 | "-nginx.scrape-uri", "http://nginx:8080/api" ], "links":[ "nginx" ], "portMappings":[ { "containerPort": 9113, "protocol": "tcp" } ] } ], "networkMode": "bridge", Container Insights Prometheus metrics monitoring 777 Amazon CloudWatch User Guide "placementConstraints": [], "family": "nginx-plus-sample-stack" } 2. Register the task definition: aws ecs register-task-definition --cli-input-json file://path-to-your-task- definition-json 3. Create a service to run the task by entering the following command: aws ecs create-service \ --cluster your-cluster-name \ --service-name nginx-plus-service \ --task-definition nginx-plus-sample-stack:1 \ --desired-count 1 Be sure not to change the service name. We will be running a CloudWatch agent service using a configuration that searches for tasks using the name patterns of the services that started them. For example, for the CloudWatch agent to find the task launched by this command, you can specify the value of sd_service_name_pattern to be ^nginx-plus-service$. The next section provides more details. Configure the CloudWatch agent to scrape NGINX Plus Prometheus metrics The final step is to configure the CloudWatch agent to scrape the NGINX metrics. In this example, the CloudWatch agent discovers the task via the service name pattern, and the port 9113, where the exporter exposes the prometheus metrics for NGINX. With the task discovered and the metrics available, the CloudWatch agent begins posting the collected metrics to the log stream nginx- prometheus-exporter. To configure the CloudWatch agent to scrape the NGINX metrics 1. Download the latest version of the necessary YAML file by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for- bridge-host.yaml Container Insights Prometheus metrics monitoring 778 Amazon CloudWatch User Guide 2. Open the file with a text editor, and find the full CloudWatch agent confguration in the value key in the resource:CWAgentConfigSSMParameter section. Then, in the ecs_service_discovery section, add the following service_name_list_for_tasks section. "service_name_list_for_tasks": [ { "sd_job_name": "nginx-plus-prometheus-exporter", "sd_metrics_path": "/metrics", "sd_metrics_ports": "9113", "sd_service_name_pattern": "^nginx-plus.*" } ], 3. In the same file, add the following section in the metric_declaration section to allow NGINX Plus metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["job"], "label_matcher": "^nginx-plus.*", "dimensions": [["ClusterName", "TaskDefinitionFamily", "ServiceName"]], "metric_selectors": [ "^nginxplus_connections_accepted$", "^nginxplus_connections_active$", "^nginxplus_connections_dropped$", "^nginxplus_connections_idle$", "^nginxplus_http_requests_total$", "^nginxplus_ssl_handshakes$", "^nginxplus_ssl_handshakes_failed$", "^nginxplus_up$", "^nginxplus_upstream_server_health_checks_fails$" ] }, { "source_labels": ["job"], "label_matcher": "^nginx-plus.*", "dimensions": [["ClusterName", "TaskDefinitionFamily", "ServiceName", "upstream"]], "metric_selectors": [ "^nginxplus_upstream_server_response_time$" ] }, Container Insights Prometheus metrics monitoring 779 Amazon CloudWatch { "source_labels": ["job"], "label_matcher": "^nginx-plus.*", User Guide "dimensions": [["ClusterName", "TaskDefinitionFamily", "ServiceName", "code"]], "metric_selectors": [ "^nginxplus_upstream_server_responses$", "^nginxplus_server_zone_responses$" ] }, 4. If you don't already have the CloudWatch agent deployed in this cluster, skip to step 8. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by using AWS CloudFormation, you can create a change set by entering the following commands: ECS_CLUSTER_NAME=your_cluster_name AWS_REGION=your_aws_region ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION \ --change-set-name nginx-plus-scraping-support 5. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation. 6. Revew the newly-created changeset nginx-plus-scraping-support. You should see one change applied to the CWAgentConfigSSMParameter resource. Run the changeset and restrt the CloudWatch agent task by entering the following command: aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 0 \ Container Insights Prometheus metrics monitoring 780 Amazon CloudWatch User Guide --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 7. Wait about 10 seconds, and then enter the following command. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 1 \ --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 8. If you are installing the CloudWatch agent with Prometheus metric collecting on the cluster for the first time, enter the following commands. ECS_CLUSTER_NAME=your_cluster_name AWS_REGION=your_aws_region ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION Viewing your NGINX Plus metrics and logs You can now view the NGINX Plus metrics being collected. To view the metrics for your sample NGINX workload 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the Region where your cluster is running, choose Metrics in the left navigation pane. Find the ContainerInsights/Prometheus namespace to see the metrics. Container Insights Prometheus metrics monitoring 781 Amazon CloudWatch User Guide 3. To see the CloudWatch Logs events, choose Log groups in the navigation pane. The events are in the log group /aws/containerinsights/your_cluster_name/prometheus, in the log stream nginx-plus-prometheus-exporter. Tutorial for adding a new Prometheus scrape target: Memcached on Amazon ECS This tutorial provides a hands-on introduction to scrape the Prometheus metrics of a sample Memcached application on an Amazon Amazon ECS cluster with the EC2 launch type. The Memcached Prometheus exporter target will be auto-discovered by the CloudWatch agent by ECS task definition-based service discovery. Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) |
acw-ug-245 | acw-ug.pdf | 245 | stream nginx-plus-prometheus-exporter. Tutorial for adding a new Prometheus scrape target: Memcached on Amazon ECS This tutorial provides a hands-on introduction to scrape the Prometheus metrics of a sample Memcached application on an Amazon Amazon ECS cluster with the EC2 launch type. The Memcached Prometheus exporter target will be auto-discovered by the CloudWatch agent by ECS task definition-based service discovery. Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. For more infromation, see What is Memcached? The memchached_exporter (Apache License 2.0) is one of the Prometheus official exporters. By default the memcache_exporter serves on port 0.0.0.0:9150 at /metrics. The Docker images in the following two Docker Hub repositories are used in this tutorial: • Memcached • prom/memcached-exporter Prerequisite To collect metrics from a sample Prometheus workload for Amazon ECS, you must be running Container Insights in the cluster. For information about installing Container Insights, see Setting up Container Insights on Amazon ECS. Topics • Set the Amazon ECS EC2 cluster environment variables • Install the sample Memcached workload • Configure the CloudWatch agent to scrape Memcached Prometheus metrics • Viewing your Memcached metrics Container Insights Prometheus metrics monitoring 782 Amazon CloudWatch User Guide Set the Amazon ECS EC2 cluster environment variables To set the Amazon ECS EC2 cluster environment variables 1. Install the Amazon ECS CLI if you haven't already done so. For more information, see Installing the Amazon ECS CLI. 2. Set the new Amazon ECS cluster name and Region. For example: ECS_CLUSTER_NAME=ecs-ec2-memcached-tutorial AWS_DEFAULT_REGION=ca-central-1 3. (Optional) If you don't already have an Amazon ECS cluster with the EC2 launch type where you want to install the sample Memcached workload and CloudWatch agent, you can create one by entering the following command. ecs-cli up --capability-iam --size 1 \ --instance-type t3.medium \ --cluster $ECS_CLUSTER_NAME \ --region $AWS_REGION The expected result of this command is as follows: WARN[0000] You will not be able to SSH into your EC2 instances without a key pair. INFO[0000] Using recommended Amazon Linux 2 AMI with ECS Agent 1.44.4 and Docker version 19.03.6-ce INFO[0001] Created cluster cluster=ecs-ec2-memcached- tutorial region=ca-central-1 INFO[0002] Waiting for your cluster resources to be created... INFO[0002] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS INFO[0063] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS INFO[0124] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS VPC created: vpc-xxxxxxxxxxxxxxxxx Security Group created: sg-xxxxxxxxxxxxxxxxx Subnet created: subnet-xxxxxxxxxxxxxxxxx Subnet created: subnet-xxxxxxxxxxxxxxxxx Cluster creation succeeded. Container Insights Prometheus metrics monitoring 783 Amazon CloudWatch User Guide Install the sample Memcached workload To install the sample Memcached workload which exposes the Prometheus metrics 1. Download the Memcached AWS CloudFormation template by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/sample_traffic/memcached/memcached-traffic-sample.yaml 2. Set the IAM role names to be created for Memcached by entering the following commands. MEMCACHED_ECS_TASK_ROLE_NAME=memcached-prometheus-demo-ecs-task-role-name MEMCACHED_ECS_EXECUTION_ROLE_NAME=memcached-prometheus-demo-ecs-execution-role-name 3. Install the sample Memcached workload by entering the following command. This sample installs the workload in host network mode. MEMCACHED_ECS_NETWORK_MODE=host aws cloudformation create-stack --stack-name Memcached-Prometheus-Demo-ECS- $ECS_CLUSTER_NAME-EC2-$MEMCACHED_ECS_NETWORK_MODE \ --template-body file://memcached-traffic-sample.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=ECSNetworkMode,ParameterValue= $MEMCACHED_ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue= $MEMCACHED_ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $MEMCACHED_ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION The AWS CloudFormation stack creates four resources: • One ECS task role • One ECS task execution role • One Memcached task definition • One Memcached service Container Insights Prometheus metrics monitoring 784 Amazon CloudWatch User Guide In the Memcached task definition, two containers are defined: • The primary container runs a simple Memcached application and opens port 11211 for access. • The other container runs the Redis OSS exporter process to expose the Prometheus metrics on port 9150. This is the container to be discovered and scraped by the CloudWatch agent. Configure the CloudWatch agent to scrape Memcached Prometheus metrics To configure the CloudWatch agent to scrape Memcached Prometheus metrics 1. Download the latest version of cwagent-ecs-prometheus-metric-for-awsvpc.yaml by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for- awsvpc.yaml 2. Open the file with a text editor, and find the full CloudWatch agent configuration behind the value key in the resource:CWAgentConfigSSMParameter section. Then, in the ecs_service_discovery section, add the following configuration into the task_definition_list section. { "sd_job_name": "ecs-memcached", "sd_metrics_ports": "9150", "sd_task_definition_arn_pattern": ".*:task-definition/memcached-prometheus- demo.*:[0-9]+" }, For the metric_declaration section, the default setting does not allow any Memcached metrics. Add the following section to allow Memcached metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["container_name"], "label_matcher": "memcached-exporter-.*", "dimensions": [["ClusterName", "TaskDefinitionFamily"]], "metric_selectors": [ Container Insights Prometheus metrics monitoring 785 Amazon CloudWatch User Guide "^memcached_current_(bytes|items|connections)$", "^memcached_items_(reclaimed|evicted)_total$", "^memcached_(written|read)_bytes_total$", "^memcached_limit_bytes$", "^memcached_commands_total$" ] }, { "source_labels": ["container_name"], "label_matcher": "memcached-exporter-.*", "dimensions": [["ClusterName", "TaskDefinitionFamily","status","command"], ["ClusterName", "TaskDefinitionFamily","command"]], "metric_selectors": [ "^memcached_commands_total$" ] }, 3. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by AWS CloudFormation, you can create a change set by entering the following commands. ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True |
acw-ug-246 | acw-ug.pdf | 246 | the metric_declaration section, the default setting does not allow any Memcached metrics. Add the following section to allow Memcached metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["container_name"], "label_matcher": "memcached-exporter-.*", "dimensions": [["ClusterName", "TaskDefinitionFamily"]], "metric_selectors": [ Container Insights Prometheus metrics monitoring 785 Amazon CloudWatch User Guide "^memcached_current_(bytes|items|connections)$", "^memcached_items_(reclaimed|evicted)_total$", "^memcached_(written|read)_bytes_total$", "^memcached_limit_bytes$", "^memcached_commands_total$" ] }, { "source_labels": ["container_name"], "label_matcher": "memcached-exporter-.*", "dimensions": [["ClusterName", "TaskDefinitionFamily","status","command"], ["ClusterName", "TaskDefinitionFamily","command"]], "metric_selectors": [ "^memcached_commands_total$" ] }, 3. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by AWS CloudFormation, you can create a change set by entering the following commands. ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION \ --change-set-name memcached-scraping-support 4. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation. 5. Review the newly created changeset memcached-scraping-support. You should see one change applied to the CWAgentConfigSSMParameter resource. Execute the changeset and restart the CloudWatch agent task by entering the following commands. Container Insights Prometheus metrics monitoring 786 Amazon CloudWatch User Guide aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 0 \ --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 6. Wait about 10 seconds, and then enter the following command. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 1 \ --service cwagent-prometheus-replica-service-EC2-$ECS_NETWORK_MODE \ --region $AWS_REGION 7. If you are installing the CloudWatch agent with Prometheus metric collecting for the cluster for the first time, please enter the following commands: ECS_NETWORK_MODEE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION Viewing your Memcached metrics This tutorial sends the following metrics to the ECS/ContainerInsights/Prometheus namespace in CloudWatch. You can use the CloudWatch console to see the metrics in that namespace. Container Insights Prometheus metrics monitoring 787 Amazon CloudWatch User Guide Metric name Dimensions memcached ClusterName , TaskDefinitionFamily _current_items memcached _current_ connections memcached _limit_bytes ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily memcached ClusterName , TaskDefinitionFamily _current_bytes memcached _written_ bytes_total memcached _read_byt es_total memcached _items_ev icted_total memcached _items_re claimed_total memcached _commands _total ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily, command ClusterName , TaskDefinitionFamily, status, command Container Insights Prometheus metrics monitoring 788 Amazon CloudWatch Note User Guide The value of the command dimension can be: delete, get, cas, set, decr, touch, incr, or flush. The value of the status dimension can be hit, miss, or badval. You can also create a CloudWatch dashboard for your Memcached Prometheus metrics. To create a dashboard for Memcached Prometheus metrics 1. Create environment variables, replacing the values below to match your deployment. DASHBOARD_NAME=your_memcached_cw_dashboard_name ECS_TASK_DEF_FAMILY=memcached-prometheus-demo-$ECS_CLUSTER_NAME-EC2- $MEMCACHED_ECS_NETWORK_MOD 2. Enter the following command to create the dashboard. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/ecs-task-definition-templates/deployment-mode/ replica-service/cwagent-prometheus/sample_cloudwatch_dashboards/memcached/ cw_dashboard_memcached.json \ | sed "s/{{YOUR_AWS_REGION}}/$AWS_REGION/g" \ | sed "s/{{YOUR_CLUSTER_NAME}}/$ECS_CLUSTER_NAME/g" \ | sed "s/{{YOUR_TASK_DEF_FAMILY}}/$ECS_TASK_DEF_FAMILY/g" \ | xargs -0 aws cloudwatch put-dashboard --dashboard-name ${DASHBOARD_NAME} --region $AWS_REGION --dashboard-body Tutorial for scraping Redis OSS Prometheus metrics on Amazon ECS Fargate This tutorial provides a hands-on introduction to scrape the Prometheus metrics of a sample Redis OSS application in an Amazon ECS Fargate cluster. The Redis OSS Prometheus exporter target will be auto-discovered by the CloudWatch agent with Prometheus metric support based on the container’s docker labels. Redis OSS (https://redis.io/) is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. For more information, see redis. Container Insights Prometheus metrics monitoring 789 Amazon CloudWatch User Guide redis_exporter (MIT License licensed) is used to expose the Redis OSS prometheus metrics on the specified port (default: 0.0.0.0:9121). For more information, see redis_exporter. The Docker images in the following two Docker Hub repositories are used in this tutorial: • redis • redis_exporter Prerequisite To collect metrics from a sample Prometheus workload for Amazon ECS, you must be running Container Insights in the cluster. For information about installing Container Insights, see Setting up Container Insights on Amazon ECS. Topics • Set the Amazon ECS Fargate cluster environment variable • Set the network environment variables for the Amazon ECS Fargate cluster • Install the sample Redis OSS workload • Configure the CloudWatch agent to scrape Redis OSS Prometheus metrics • Viewing your Redis OSS metrics Set the Amazon ECS Fargate cluster environment variable To set the Amazon ECS Fargate cluster environment variable 1. Install the Amazon ECS CLI if you haven't already done so. For more information, see Installing the Amazon ECS CLI. 2. Set the new Amazon ECS cluster name and Region. For example: ECS_CLUSTER_NAME=ecs-fargate-redis-tutorial AWS_DEFAULT_REGION=ca-central-1 3. (Optional) If you don't already have an Amazon ECS Fargate cluster where you want to install the sample Redis OSS workload and CloudWatch agent, you can create one by entering the following command. ecs-cli up --capability-iam \ Container Insights Prometheus |
acw-ug-247 | acw-ug.pdf | 247 | metrics • Viewing your Redis OSS metrics Set the Amazon ECS Fargate cluster environment variable To set the Amazon ECS Fargate cluster environment variable 1. Install the Amazon ECS CLI if you haven't already done so. For more information, see Installing the Amazon ECS CLI. 2. Set the new Amazon ECS cluster name and Region. For example: ECS_CLUSTER_NAME=ecs-fargate-redis-tutorial AWS_DEFAULT_REGION=ca-central-1 3. (Optional) If you don't already have an Amazon ECS Fargate cluster where you want to install the sample Redis OSS workload and CloudWatch agent, you can create one by entering the following command. ecs-cli up --capability-iam \ Container Insights Prometheus metrics monitoring 790 Amazon CloudWatch User Guide --cluster $ECS_CLUSTER_NAME \ --launch-type FARGATE \ --region $AWS_DEFAULT_REGION The expected result of this command is as follows: INFO[0000] Created cluster cluster=ecs-fargate-redis-tutorial region=ca-central-1 INFO[0001] Waiting for your cluster resources to be created... INFO[0001] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS VPC created: vpc-xxxxxxxxxxxxxxxxx Subnet created: subnet-xxxxxxxxxxxxxxxxx Subnet created: subnet-xxxxxxxxxxxxxxxxx Cluster creation succeeded. Set the network environment variables for the Amazon ECS Fargate cluster To set the network environment variables for the Amazon ECS Fargate cluster 1. Set your VPC and subnet ID of the Amazon ECS cluster. If you created a new cluster in the previous procedure, you'll see these values in the result of the final command. Otherwise, use the IDs of the existing cluster that you are going to use with Redis. ECS_CLUSTER_VPC=vpc-xxxxxxxxxxxxxxxxx ECS_CLUSTER_SUBNET_1=subnet-xxxxxxxxxxxxxxxxx ECS_CLUSTER_SUBNET_2=subnet-xxxxxxxxxxxxxxxxx 2. In this tutorial, we are going to install the Redis OSS application and the CloudWatch agent in the default security group of the Amazon ECS cluster’s VPC. The default security group allows all network connection within the same security group so the CloudWatch agent can scrape the Prometheus metrics exposed on the Redis OSS containers. In a real production environment, you might want to create dedicated security groups for the Redis OSS application and CloudWatch agent and set customized permissions for them. Enter the following command to get the default security group ID. aws ec2 describe-security-groups \ --filters Name=vpc-id,Values=$ECS_CLUSTER_VPC \ --region $AWS_DEFAULT_REGION Container Insights Prometheus metrics monitoring 791 Amazon CloudWatch User Guide Then set the Fargate cluster deafult security group variable by entering the following command, replacing my-default-security-group with the value you found from the previous command. ECS_CLUSTER_SECURITY_GROUP=my-default-security-group Install the sample Redis OSS workload To install the sample Redis OSS workload which exposes the Prometheus metrics 1. Download the Redis OSS AWS CloudFormation template by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/sample_traffic/redis/redis-traffic-sample.yaml 2. Set the IAM role names to be created for Redis OSS by entering the following commands. REDIS_ECS_TASK_ROLE_NAME=redis-prometheus-demo-ecs-task-role-name REDIS_ECS_EXECUTION_ROLE_NAME=redis-prometheus-demo-ecs-execution-role-name 3. Install the sample Redis OSS workload by entering the following command. aws cloudformation create-stack --stack-name Redis-Prometheus-Demo-ECS- $ECS_CLUSTER_NAME-fargate-awsvpc \ --template-body file://redis-traffic-sample.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=SecurityGroupID,ParameterValue= $ECS_CLUSTER_SECURITY_GROUP \ ParameterKey=SubnetID,ParameterValue=$ECS_CLUSTER_SUBNET_1 \ ParameterKey=TaskRoleName,ParameterValue=$REDIS_ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $REDIS_ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_DEFAULT_REGION The AWS CloudFormation stack creates four resources: Container Insights Prometheus metrics monitoring 792 Amazon CloudWatch • One ECS task role • One ECS task execution role • One Redis OSS task definition • One Redis OSS service User Guide In the Redis OSS task definition, two containers are defined: • The primary container runs a simple Redis OSS application and opens port 6379 for access. • The other container runs the Redis OSS exporter process to expose the Prometheus metrics on port 9121. This is the container to be discovered and scraped by the CloudWatch agent. The following docker label is defined so that the CloudWatch agent can discover this container based on it. ECS_PROMETHEUS_EXPORTER_PORT: 9121 Configure the CloudWatch agent to scrape Redis OSS Prometheus metrics To configure the CloudWatch agent to scrape Redis OSS Prometheus metrics 1. Download the latest version of cwagent-ecs-prometheus-metric-for-awsvpc.yaml by entering the following command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/ecs-task-definition-templates/deployment-mode/replica-service/ cwagent-prometheus/cloudformation-quickstart/cwagent-ecs-prometheus-metric-for- awsvpc.yaml 2. Open the file with a text editor, and find the full CloudWatch agent configuration behind the value key in the resource:CWAgentConfigSSMParameter section. Then, in the ecs_service_discovery section shown here, the docker_label- based service discovery is enabled with the default settings which are based on ECS_PROMETHEUS_EXPORTER_PORT, which matches the docker label we defined in the Redis OSS ECS task definition. So we do not need to make any changes in this section: ecs_service_discovery": { "sd_frequency": "1m", Container Insights Prometheus metrics monitoring 793 Amazon CloudWatch User Guide "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", * "docker_label": { },* ... For the metric_declaration section, the default setting does not allow any Redis OSS metrics. Add the following section to allow Redis OSS metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily"]], "metric_selectors": [ "^redis_net_(in|out)put_bytes_total$", "^redis_(expired|evicted)_keys_total$", "^redis_keyspace_(hits|misses)_total$", "^redis_memory_used_bytes$", "^redis_connected_clients$" ] }, { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily","cmd"]], "metric_selectors": [ "^redis_commands_total$" ] }, { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily","db"]], "metric_selectors": [ "^redis_db_keys$" ] }, 3. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by AWS CloudFormation, |
acw-ug-248 | acw-ug.pdf | 248 | 793 Amazon CloudWatch User Guide "sd_result_file": "/tmp/cwagent_ecs_auto_sd.yaml", * "docker_label": { },* ... For the metric_declaration section, the default setting does not allow any Redis OSS metrics. Add the following section to allow Redis OSS metrics. Be sure to follow the existing indentation pattern. { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily"]], "metric_selectors": [ "^redis_net_(in|out)put_bytes_total$", "^redis_(expired|evicted)_keys_total$", "^redis_keyspace_(hits|misses)_total$", "^redis_memory_used_bytes$", "^redis_connected_clients$" ] }, { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily","cmd"]], "metric_selectors": [ "^redis_commands_total$" ] }, { "source_labels": ["container_name"], "label_matcher": "^redis-exporter-.*$", "dimensions": [["ClusterName","TaskDefinitionFamily","db"]], "metric_selectors": [ "^redis_db_keys$" ] }, 3. If you already have the CloudWatch agent deployed in the Amazon ECS cluster by AWS CloudFormation, you can create a change set by entering the following commands. ECS_LAUNCH_TYPE=FARGATE Container Insights Prometheus metrics monitoring 794 Amazon CloudWatch CREATE_IAM_ROLES=True ECS_CLUSTER_SUBNET=$ECS_CLUSTER_SUBNET_1 ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name User Guide aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- $ECS_CLUSTER_NAME-$ECS_LAUNCH_TYPE-awsvpc \ --template-body file://cwagent-ecs-prometheus-metric-for-awsvpc.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSLaunchType,ParameterValue=$ECS_LAUNCH_TYPE \ ParameterKey=SecurityGroupID,ParameterValue= $ECS_CLUSTER_SECURITY_GROUP \ ParameterKey=SubnetID,ParameterValue=$ECS_CLUSTER_SUBNET \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} \ --change-set-name redis-scraping-support 4. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation. 5. Review the newly created changeset redis-scraping-support. You should see one change applied to the CWAgentConfigSSMParameter resource. Execute the changeset and restart the CloudWatch agent task by entering the following commands. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 0 \ --service cwagent-prometheus-replica-service-$ECS_LAUNCH_TYPE-awsvpc \ --region ${AWS_DEFAULT_REGION} 6. Wait about 10 seconds, and then enter the following command. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 1 \ --service cwagent-prometheus-replica-service-$ECS_LAUNCH_TYPE-awsvpc \ --region ${AWS_DEFAULT_REGION} 7. If you are installing the CloudWatch agent with Prometheus metric collecting for the cluster for the first time, please enter the following commands: ECS_LAUNCH_TYPE=FARGATE Container Insights Prometheus metrics monitoring 795 Amazon CloudWatch CREATE_IAM_ROLES=True ECS_CLUSTER_SUBNET=$ECS_CLUSTER_SUBNET_1 ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name User Guide aws cloudformation create-stack --stack-name CWAgent-Prometheus-ECS- $ECS_CLUSTER_NAME-$ECS_LAUNCH_TYPE-awsvpc \ --template-body file://cwagent-ecs-prometheus-metric-for-awsvpc.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSLaunchType,ParameterValue=$ECS_LAUNCH_TYPE \ ParameterKey=SecurityGroupID,ParameterValue= $ECS_CLUSTER_SECURITY_GROUP \ ParameterKey=SubnetID,ParameterValue=$ECS_CLUSTER_SUBNET \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue= $ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region ${AWS_DEFAULT_REGION} Viewing your Redis OSS metrics This tutorial sends the following metrics to the ECS/ContainerInsights/Prometheus namespace in CloudWatch. You can use the CloudWatch console to see the metrics in that namespace. Metric Name Dimensions redis_net _input_by tes_total redis_net _output_b ytes_total redis_exp ired_keys _total ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily Container Insights Prometheus metrics monitoring 796 Amazon CloudWatch User Guide Metric Name Dimensions redis_evi cted_keys _total redis_key space_hit s_total redis_key space_mis ses_total ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily redis_mem ClusterName, TaskDefinitionFamily ory_used_bytes redis_con ClusterName, TaskDefinitionFamily nected_clients redis_com mands_total ClusterName , TaskDefinitionFamily cmd redis_db_keys ClusterName , TaskDefinitionFamily db , , Note The value of the cmd dimension can be: append, client, command, config, dbsize, flushall, get, incr, info, latency, or slowlog. The value of the db dimension can be db0 to db15. You can also create a CloudWatch dashboard for your Redis OSS Prometheus metrics. To create a dashboard for Redis OSS Prometheus metrics 1. Create environment variables, replacing the values below to match your deployment. Container Insights Prometheus metrics monitoring 797 Amazon CloudWatch User Guide DASHBOARD_NAME=your_cw_dashboard_name ECS_TASK_DEF_FAMILY=redis-prometheus-demo-$ECS_CLUSTER_NAME-fargate-awsvpc 2. Enter the following command to create the dashboard. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/sample_cloudwatch_dashboards/redis/cw_dashboard_redis.json \ | sed "s/{{YOUR_AWS_REGION}}/${REGION_NAME}/g" \ | sed "s/{{YOUR_CLUSTER_NAME}}/${CLUSTER_NAME}/g" \ | sed "s/{{YOUR_NAMESPACE}}/${NAMESPACE}/g" \ Set up and configure Prometheus metrics collection on Amazon EKS and Kubernetes clusters To collect Prometheus metrics from clusters running Amazon EKS or Kubernetes, you can use the CloudWatch agent as a collector or use the AWS Distro for OpenTelemetry collector. For information about using the AWS Distro for OpenTelemetry collector, see https://aws- otel.github.io/docs/getting-started/container-insights/eks-prometheus. The following sections explain how to collect Prometheus metrics using the CloudWatch agent. They explain how to install the CloudWatch agent with Prometheus monitoring on clusters running Amazon EKS or Kubernetes, and how to configure the agent to scrape additional targets. They also provide optional tutorials for setting up sample workloads to use for testing with Prometheus monitoring. Topics • Install the CloudWatch agent with Prometheus metrics collection on Amazon EKS and Kubernetes clusters Install the CloudWatch agent with Prometheus metrics collection on Amazon EKS and Kubernetes clusters This section explains how to set up the CloudWatch agent with Prometheus monitoring in a cluster running Amazon EKS or Kubernetes. After you do this, the agent automatically scrapes and imports metrics for the following workloads running in that cluster. • AWS App Mesh Container Insights Prometheus metrics monitoring 798 Amazon CloudWatch • NGINX • Memcached • Java/JMX • HAProxy • Fluent Bit User Guide You can also configure the agent to scrape and import additional Prometheus workloads and sources. Before following these steps to install the CloudWatch agent for Prometheus metric collection, you must have a cluster running on Amazon EKS or a Kubernetes cluster running on an Amazon EC2 instance. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress |
acw-ug-249 | acw-ug.pdf | 249 | metrics monitoring 798 Amazon CloudWatch • NGINX • Memcached • Java/JMX • HAProxy • Fluent Bit User Guide You can also configure the agent to scrape and import additional Prometheus workloads and sources. Before following these steps to install the CloudWatch agent for Prometheus metric collection, you must have a cluster running on Amazon EKS or a Kubernetes cluster running on an Amazon EC2 instance. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of the security group for the CloudWatch agent must allow the CloudWatch agent to connect to the Prometheus workloads' port by private IP. Topics • Install the CloudWatch agent with Prometheus metrics collection on Amazon EKS and Kubernetes clusters • Scraping additional Prometheus sources and importing those metrics • (Optional) Set up sample containerized Amazon EKS workloads for Prometheus metric testing Install the CloudWatch agent with Prometheus metrics collection on Amazon EKS and Kubernetes clusters This section explains how to set up the CloudWatch agent with Prometheus monitoring in a cluster running Amazon EKS or Kubernetes. After you do this, the agent automatically scrapes and imports metrics for the following workloads running in that cluster. • AWS App Mesh • NGINX • Memcached Container Insights Prometheus metrics monitoring 799 Amazon CloudWatch • Java/JMX • HAProxy • Fluent Bit User Guide You can also configure the agent to scrape and import additional Prometheus workloads and sources. Before following these steps to install the CloudWatch agent for Prometheus metric collection, you must have a cluster running on Amazon EKS or a Kubernetes cluster running on an Amazon EC2 instance. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of the security group for the CloudWatch agent must allow the CloudWatch agent to connect to the Prometheus workloads' port by private IP. Topics • Setting up IAM roles • Installing the CloudWatch agent to collect Prometheus metrics Setting up IAM roles The first step is to set up the necessary IAM role in the cluster. There are two methods: • Set up an IAM role for a service account, also known as a service role. This method works for both the EC2 launch type and the Fargate launch type. • Add an IAM policy to the IAM role used for the cluster. This works only for the EC2 launch type. Set up a service role (EC2 launch type and Fargate launch type) To set up a service role, enter the following command. Replace MyCluster with the name of the cluster. eksctl create iamserviceaccount \ --name cwagent-prometheus \ Container Insights Prometheus metrics monitoring 800 Amazon CloudWatch User Guide --namespace amazon-cloudwatch \ --cluster MyCluster \ --attach-policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy \ --approve \ --override-existing-serviceaccounts Add a policy to the node group's IAM role (EC2 launch type only) To set up the IAM policy in a node group for Prometheus support 1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. 2. In the navigation pane, choose Instances. 3. You need to find the prefix of the IAM role name for the cluster. To do this, select the check box next to the name of an instance that is in the cluster, and choose Actions, Security, Modify IAM Role. Then copy the prefix of the IAM role, such as eksctl-dev303-workshop- nodegroup. 4. Open the IAM console at https://console.aws.amazon.com/iam/. 5. In the navigation pane, choose Roles. 6. Use the search box to find the prefix that you copied earlier in this procedure, and choose that role. 7. Choose Attach policies. 8. Use the search box to find CloudWatchAgentServerPolicy. Select the check box next to CloudWatchAgentServerPolicy, and choose Attach policy. Installing the CloudWatch agent to collect Prometheus metrics You must install the CloudWatch agent in the cluster to collect the metrics. How to install the agent differs for Amazon EKS clusters and Kubernetes clusters. Delete previous versions of the CloudWatch agent with Prometheus support If you have already installed a version of the CloudWatch agent with Prometheus support in your cluster, you must delete that version by entering the following command. This is necessary only for previous versions of the agent with Prometheus support. You do not need to delete the CloudWatch agent that enables Container Insights without Prometheus support. kubectl delete deployment cwagent-prometheus -n amazon-cloudwatch Container Insights Prometheus metrics monitoring 801 Amazon CloudWatch User Guide Installing the CloudWatch agent on Amazon EKS clusters with the EC2 launch type To install the CloudWatch agent with Prometheus support on an Amazon EKS cluster, follow these steps. To install the CloudWatch agent with Prometheus support on an |
acw-ug-250 | acw-ug.pdf | 250 | with Prometheus support in your cluster, you must delete that version by entering the following command. This is necessary only for previous versions of the agent with Prometheus support. You do not need to delete the CloudWatch agent that enables Container Insights without Prometheus support. kubectl delete deployment cwagent-prometheus -n amazon-cloudwatch Container Insights Prometheus metrics monitoring 801 Amazon CloudWatch User Guide Installing the CloudWatch agent on Amazon EKS clusters with the EC2 launch type To install the CloudWatch agent with Prometheus support on an Amazon EKS cluster, follow these steps. To install the CloudWatch agent with Prometheus support on an Amazon EKS cluster 1. 2. Enter the following command to check whether the amazon-cloudwatch namespace has already been created: kubectl get namespace If amazon-cloudwatch is not displayed in the results, create it by entering the following command: kubectl create namespace amazon-cloudwatch 3. To deploy the agent with the default configuration and have it send data to the AWS Region that it is installed in, enter the following command: kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ service/cwagent-prometheus/prometheus-eks.yaml To have the agent send data to a different Region instead, follow these steps: a. Download the YAML file for the agent by entering the following command: curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch- container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/ service/cwagent-prometheus/prometheus-eks.yaml b. Open the file with a text editor, and search for the cwagentconfig.json block of the file. c. Add the highlighted lines, specifying the Region that you want: cwagentconfig.json: | { "agent": { "region": "us-east-2" }, Container Insights Prometheus metrics monitoring 802 Amazon CloudWatch User Guide "logs": { ... d. Save the file and deploy the agent using your updated file. kubectl apply -f prometheus-eks.yaml Installing the CloudWatch agent on Amazon EKS clusters with the Fargate launch type To install the CloudWatch agent with Prometheus support on an Amazon EKS cluster with the Fargate launch type, follow these steps. To install the CloudWatch agent with Prometheus support on an Amazon EKS cluster with the Fargate launch type 1. Enter the following command to create a Fargate profile for the CloudWatch agent so that it can run inside the cluster. Replace MyCluster with the name of the cluster. eksctl create fargateprofile --cluster MyCluster \ --name amazon-cloudwatch \ --namespace amazon-cloudwatch 2. To install the CloudWatch agent, enter the following command. Replace MyCluster with the name of the cluster. This name is used in the log group name that stores the log events collected by the agent, and is also used as a dimension for the metrics collected by the agent. Replace region with the name of the Region where you want the metrics to be sent. For example, us-west-1. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-eks-fargate.yaml | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" | kubectl apply -f - Installing the CloudWatch agent on a Kubernetes cluster To install the CloudWatch agent with Prometheus support on a cluster running Kubernetes, enter the following command: Container Insights Prometheus metrics monitoring 803 Amazon CloudWatch User Guide curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-k8s.yaml | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" | kubectl apply -f - Replace MyCluster with the name of the cluster. This name is used in the log group name that stores the log events collected by the agent, and is also used as a dimension for the metrics collected by the agent. Replace region with the name of the AWS Region where you want the metrics to be sent. For example, us-west-1. Verify that the agent is running On both Amazon EKS and Kubernetes clusters, you can enter the following command to confirm that the agent is running. kubectl get pod -l "app=cwagent-prometheus" -n amazon-cloudwatch If the results include a single CloudWatch agent pod in the Running state, the agent is running and collecting Prometheus metrics. By default the CloudWatch agent collects metrics for App Mesh, NGINX, Memcached, Java/JMX, and HAProxy every minute. For more information about those metrics, see Prometheus metrics collected by the CloudWatch agent. For instructions on how to see your Prometheus metrics in CloudWatch, see Viewing your Prometheus metrics You can also configure the CloudWatch agent to collect metrics from other Prometheus exporters. For more information, see Scraping additional Prometheus sources and importing those metrics. Scraping additional Prometheus sources and importing those metrics The CloudWatch agent with Prometheus monitoring needs two configurations to scrape the Prometheus metrics. One is for the standard Prometheus configurations as documented in <scrape_config> in the Prometheus documentation. The other is for the CloudWatch agent configuration. For Amazon EKS clusters, the configurations are defined in prometheus-eks.yaml (for the EC2 launch type) or prometheus-eks-fargate.yaml (for the Fargate launch type) as two config maps: Container Insights Prometheus metrics monitoring 804 Amazon CloudWatch User Guide • The name: prometheus-config section contains the settings for Prometheus scraping. • The name: prometheus-cwagentconfig section contains the configuration for the CloudWatch agent. You can use this section to configure how the Prometheus metrics are collected by CloudWatch. For example, |
acw-ug-251 | acw-ug.pdf | 251 | metrics. One is for the standard Prometheus configurations as documented in <scrape_config> in the Prometheus documentation. The other is for the CloudWatch agent configuration. For Amazon EKS clusters, the configurations are defined in prometheus-eks.yaml (for the EC2 launch type) or prometheus-eks-fargate.yaml (for the Fargate launch type) as two config maps: Container Insights Prometheus metrics monitoring 804 Amazon CloudWatch User Guide • The name: prometheus-config section contains the settings for Prometheus scraping. • The name: prometheus-cwagentconfig section contains the configuration for the CloudWatch agent. You can use this section to configure how the Prometheus metrics are collected by CloudWatch. For example, you specify which metrics are to be imported into CloudWatch, and define their dimensions. For Kubernetes clusters running on Amazon EC2 instances, the configurations are defined in the prometheus-k8s.yaml YAML file as two config maps: • The name: prometheus-config section contains the settings for Prometheus scraping. • The name: prometheus-cwagentconfig section contains the configuration for the CloudWatch agent. To scrape additional Prometheus metrics sources and import those metrics to CloudWatch, you modify both the Prometheus scrape configuration and the CloudWatch agent configuration, and then re-deploy the agent with the updated configuration. VPC security group requirements The ingress rules of the security groups for the Prometheus workloads must open the Prometheus ports to the CloudWatch agent for scraping the Prometheus metrics by the private IP. The egress rules of the security group for the CloudWatch agent must allow the CloudWatch agent to connect to the Prometheus workloads' port by private IP. Prometheus scrape configuration The CloudWatch agent supports the standard Prometheus scrape configurations as documented in <scrape_config> in the Prometheus documentation. You can edit this section to update the configurations that are already in this file, and add additional Prometheus scraping targets. By default, the sample configuration file contains the following global configuration lines: global: scrape_interval: 1m scrape_timeout: 10s • scrape_interval— Defines how frequently to scrape targets. • scrape_timeout— Defines how long to wait before a scrape request times out. Container Insights Prometheus metrics monitoring 805 Amazon CloudWatch User Guide You can also define different values for these settings at the job level, to override the global configurations. Prometheus scraping jobs The CloudWatch agent YAML files already have some default scraping jobs configured. For example, in prometheus-eks.yaml, the default scraping jobs are configured in the job_name lines in the scrape_configs section. In this file, the following default kubernetes-pod-jmx section scrapes JMX exporter metrics. - job_name: 'kubernetes-pod-jmx' sample_limit: 10000 metrics_path: /metrics kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__address__] action: keep regex: '.*:9404$' - action: labelmap regex: __meta_kubernetes_pod_label_(.+) - action: replace source_labels: - __meta_kubernetes_namespace target_label: Namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod_name - action: replace source_labels: - __meta_kubernetes_pod_container_name target_label: container_name - action: replace source_labels: - __meta_kubernetes_pod_controller_name target_label: pod_controller_name - action: replace source_labels: - __meta_kubernetes_pod_controller_kind target_label: pod_controller_kind - action: replace source_labels: - __meta_kubernetes_pod_phase Container Insights Prometheus metrics monitoring 806 Amazon CloudWatch User Guide target_label: pod_phase Each of these default targets are scraped, and the metrics are sent to CloudWatch in log events using embedded metric format. For more information, see Embedding metrics within logs. Log events from Amazon EKS and Kubernetes clusters are stored in the /aws/ containerinsights/cluster_name/prometheus log group in CloudWatch Logs. Log events from Amazon ECS clusters are stored in the /aws/ecs/containerinsights/cluster_name/prometheus log group. Each scraping job is contained in a different log stream in this log group. For example, the Prometheus scraping job kubernetes-pod-appmesh-envoy is defined for App Mesh. All App Mesh Prometheus metrics from Amazon EKS and Kubernetes clusters are sent to the log stream named /aws/containerinsights/cluster_name>prometheus/kubernetes-pod-appmesh-envoy/. To add a new scraping target, you add a new job_name section to the scrape_configs section of the YAML file, and restart the agent. For an example of this process, see Tutorial for adding a new Prometheus scrape target: Prometheus API Server metrics. CloudWatch agent configuration for Prometheus The CloudWatch agent configuration file has a prometheus section under metrics_collected for the Prometheus scraping configuration. It includes the following configuration options: • cluster_name— specifies the cluster name to be added as a label in the log event. This field is optional. If you omit it, the agent can detect the Amazon EKS or Kubernetes cluster name. • log_group_name— specifies the log group name for the scraped Prometheus metrics. This field is optional. If you omit it, CloudWatch uses /aws/containerinsights/cluster_name/ prometheus for logs from Amazon EKS and Kubernetes clusters. • prometheus_config_path— specifies the Prometheus scrape configuration file path. If the value of this field starts with env: the Prometheus scrape configuration file contents will be retrieved from the container's environment variable. Do not change this field. • ecs_service_discovery— is the section to specify the configuration for Amazon ECS Prometheus service discovery. For more information, see Detailed guide for autodiscovery on Amazon ECS clusters. The ecs_service_discovery section can contain the following fields: Container Insights |
acw-ug-252 | acw-ug.pdf | 252 | name for the scraped Prometheus metrics. This field is optional. If you omit it, CloudWatch uses /aws/containerinsights/cluster_name/ prometheus for logs from Amazon EKS and Kubernetes clusters. • prometheus_config_path— specifies the Prometheus scrape configuration file path. If the value of this field starts with env: the Prometheus scrape configuration file contents will be retrieved from the container's environment variable. Do not change this field. • ecs_service_discovery— is the section to specify the configuration for Amazon ECS Prometheus service discovery. For more information, see Detailed guide for autodiscovery on Amazon ECS clusters. The ecs_service_discovery section can contain the following fields: Container Insights Prometheus metrics monitoring 807 Amazon CloudWatch User Guide • sd_frequency is the frequency to discover the Prometheus exporters. Specify a number and a unit suffix. For example, 1m for once per minute or 30s for once per 30 seconds. Valid unit suffixes are ns, us, ms, s, m, and h. This field is optional. The default is 60 seconds (1 minute). • sd_target_cluster is the target Amazon ECS cluster name for auto-discovery. This field is optional. The default is the name of the Amazon ECS cluster where the CloudWatch agent is installed. • sd_cluster_region is the target Amazon ECS cluster's Region. This field is optional. The default is the Region of the Amazon ECS cluster where the CloudWatch agent is installed. . • sd_result_file is the path of the YAML file for the Prometheus target results. The Prometheus scrape configuration will refer to this file. • docker_label is an optional section that you can use to specify the configuration for docker label-based service discovery. If you omit this section, docker label-based discovery is not used. This section can contain the following fields: • sd_port_label is the container's docker label name that specifies the container port for Prometheus metrics. The default value is ECS_PROMETHEUS_EXPORTER_PORT. If the container does not have this docker label, the CloudWatch agent will skip it. • sd_metrics_path_label is the container's docker label name that specifies the Prometheus metrics path. The default value is ECS_PROMETHEUS_METRICS_PATH. If the container does not have this docker label, the agent assumes the default path /metrics. • sd_job_name_label is the container's docker label name that specifies the Prometheus scrape job name. The default value is job. If the container does not have this docker label, the CloudWatch agent uses the job name in the Prometheus scrape configuration. • task_definition_list is an optional section that you can use to specify the configuration of task definition-based service discovery. If you omit this section, task definition-based discovery is not used. This section can contain the following fields: • sd_task_definition_arn_pattern is the pattern to use to specify the Amazon ECS task definitions to discover. This is a regular expression. • sd_metrics_ports lists the containerPort for the Prometheus metrics. Separate the containerPorts with semicolons. • sd_container_name_pattern specifies the Amazon ECS task container names. This is a regular expression. Container Insights Prometheus metrics monitoring 808 Amazon CloudWatch User Guide • sd_metrics_path specifies the Prometheus metric path. If you omit this, the agent assumes the default path /metrics • sd_job_name specifies the Prometheus scrape job name. If you omit this field, the CloudWatch agent uses the job name in the Prometheus scrape configuration. • metric_declaration— are sections that specify the array of logs with embedded metric format to be generated. There are metric_declaration sections for each Prometheus source that the CloudWatch agent imports from by default. These sections each include the following fields: • label_matcher is a regular expression that checks the value of the labels listed in source_labels. The metrics that match are enabled for inclusion in the embedded metric format sent to CloudWatch. If you have multiple labels specified in source_labels, we recommend that you do not use ^ or $ characters in the regular expression for label_matcher. • source_labels specifies the value of the labels that are checked by the label_matcher line. • label_separator specifies the separator to be used in the label_matcher line if multiple source_labels are specified. The default is ;. You can see this default used in the label_matcher line in the following example. • metric_selectors is a regular expression that specifies the metrics to be collected and sent to CloudWatch. • dimensions is the list of labels to be used as CloudWatch dimensions for each selected metric. See the following metric_declaration example. "metric_declaration": [ { "source_labels":[ "Service", "Namespace"], "label_matcher":"(.*node-exporter.*|.*kube-dns.*);kube-system", "dimensions":[ ["Service", "Namespace"] ], "metric_selectors":[ "^coredns_dns_request_type_count_total$" ] } Container Insights Prometheus metrics monitoring 809 Amazon CloudWatch ] User Guide This example configures an embedded metric format section to be sent as a log event if the following conditions are met: • The value of Service contains either node-exporter or kube-dns. • The value of Namespace is kube-system. • The Prometheus metric coredns_dns_request_type_count_total contains both Service and Namespace labels. The log event that is sent |
acw-ug-253 | acw-ug.pdf | 253 | the list of labels to be used as CloudWatch dimensions for each selected metric. See the following metric_declaration example. "metric_declaration": [ { "source_labels":[ "Service", "Namespace"], "label_matcher":"(.*node-exporter.*|.*kube-dns.*);kube-system", "dimensions":[ ["Service", "Namespace"] ], "metric_selectors":[ "^coredns_dns_request_type_count_total$" ] } Container Insights Prometheus metrics monitoring 809 Amazon CloudWatch ] User Guide This example configures an embedded metric format section to be sent as a log event if the following conditions are met: • The value of Service contains either node-exporter or kube-dns. • The value of Namespace is kube-system. • The Prometheus metric coredns_dns_request_type_count_total contains both Service and Namespace labels. The log event that is sent includes the following highlighted section: { "CloudWatchMetrics":[ { "Metrics":[ { "Name":"coredns_dns_request_type_count_total" } ], "Dimensions":[ [ "Namespace", "Service" ] ], "Namespace":"ContainerInsights/Prometheus" } ], "Namespace":"kube-system", "Service":"kube-dns", "coredns_dns_request_type_count_total":2562, "eks_amazonaws_com_component":"kube-dns", "instance":"192.168.61.254:9153", "job":"kubernetes-service-endpoints", ... } Container Insights Prometheus metrics monitoring 810 Amazon CloudWatch User Guide Tutorial for adding a new Prometheus scrape target: Prometheus API Server metrics The Kubernetes API Server exposes Prometheus metrics on endpoints by default. The official example for the Kubernetes API Server scraping configuration is available on Github. The following tutorial shows how to do the following steps to begin importing Kubernetes API Server metrics into CloudWatch: • Adding the Prometheus scraping configuration for Kubernetes API Server to the CloudWatch agent YAML file. • Configuring the embedded metric format metrics definitions in the CloudWatch agent YAML file. • (Optional) Creating a CloudWatch dashboard for the Kubernetes API Server metrics. Note The Kubernetes API Server exposes gauge, counter, histogram, and summary metrics. In this release of Prometheus metrics support, CloudWatch imports only the metrics with gauge, counter, and summary types. To start collecting Kubernetes API Server Prometheus metrics in CloudWatch 1. Download the latest version of the prometheus-eks.yaml, prometheus-eks- fargate.yaml, or prometheus-k8s.yaml file by entering one of the following commands. For an Amazon EKS cluster with the EC2 launch type, enter the following command: curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-eks.yaml For an Amazon EKS cluster with the Fargate launch type, enter the following command: curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-eks-fargate.yaml For a Kubernetes cluster running on an Amazon EC2 instance, enter the following command: Container Insights Prometheus metrics monitoring 811 Amazon CloudWatch User Guide curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-k8s.yaml 2. Open the file with a text editor, find the prometheus-config section, and add the following section inside of that section. Then save the changes: # Scrape config for API servers - job_name: 'kubernetes-apiservers' kubernetes_sd_configs: - role: endpoints namespaces: names: - default scheme: https tls_config: ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt insecure_skip_verify: true bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token relabel_configs: - source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] action: keep regex: kubernetes;https - action: replace source_labels: - __meta_kubernetes_namespace target_label: Namespace - action: replace source_labels: - __meta_kubernetes_service_name target_label: Service 3. While you still have the YAML file open in the text editor, find the cwagentconfig.json section. Add the following subsection and save the changes. This section puts the API server metrics onto the CloudWatch agent allow list. Three types of API Server metrics are added to the allow list: • etcd object counts • API Server registration controller metrics • API Server request metrics Container Insights Prometheus metrics monitoring 812 Amazon CloudWatch User Guide {"source_labels": ["job", "resource"], "label_matcher": "^kubernetes-apiservers;(services|daemonsets.apps| deployments.apps|configmaps|endpoints|secrets|serviceaccounts|replicasets.apps)", "dimensions": [["ClusterName","Service","resource"]], "metric_selectors": [ "^etcd_object_counts$" ] }, {"source_labels": ["job", "name"], "label_matcher": "^kubernetes-apiservers;APIServiceRegistrationController$", "dimensions": [["ClusterName","Service","name"]], "metric_selectors": [ "^workqueue_depth$", "^workqueue_adds_total$", "^workqueue_retries_total$" ] }, {"source_labels": ["job","code"], "label_matcher": "^kubernetes-apiservers;2[0-9]{2}$", "dimensions": [["ClusterName","Service","code"]], "metric_selectors": [ "^apiserver_request_total$" ] }, {"source_labels": ["job"], "label_matcher": "^kubernetes-apiservers", "dimensions": [["ClusterName","Service"]], "metric_selectors": [ "^apiserver_request_total$" ] }, 4. If you already have the CloudWatch agent with Prometheus support deployed in the cluster, you must delete it by entering the following command: kubectl delete deployment cwagent-prometheus -n amazon-cloudwatch 5. Deploy the CloudWatch agent with your updated configuration by entering one of the following commands. For an Amazon EKS cluster with the EC2 launch type, enter: Container Insights Prometheus metrics monitoring 813 Amazon CloudWatch User Guide kubectl apply -f prometheus-eks.yaml For an Amazon EKS cluster with the Fargate launch type, enter the following command. Replace MyCluster and region with values to match your deployment. cat prometheus-eks-fargate.yaml \ | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" \ | kubectl apply -f - For a Kubernetes cluster, enter the following command. Replace MyCluster and region with values to match your deployment. cat prometheus-k8s.yaml \ | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" \ | kubectl apply -f - Once you have done this, you should see a new log stream named kubernetes-apiservers in the /aws/containerinsights/cluster_name/prometheus log group. This log stream should include log events with an embedded metric format definition like the following: { "CloudWatchMetrics":[ { "Metrics":[ { "Name":"apiserver_request_total" } ], "Dimensions":[ [ "ClusterName", "Service" ] ], "Namespace":"ContainerInsights/Prometheus" } ], "ClusterName":"my-cluster-name", "Namespace":"default", Container Insights Prometheus metrics monitoring 814 Amazon CloudWatch User Guide "Service":"kubernetes", "Timestamp":"1592267020339", "Version":"0", "apiserver_request_count":0, "apiserver_request_total":0, "code":"0", "component":"apiserver", "contentType":"application/json", "instance":"192.0.2.0:443", "job":"kubernetes-apiservers", "prom_metric_type":"counter", "resource":"pods", "scope":"namespace", "verb":"WATCH", "version":"v1" } You can view your metrics in the CloudWatch console in the ContainerInsights/Prometheus namespace. You can also optionally create |
acw-ug-254 | acw-ug.pdf | 254 | -f - Once you have done this, you should see a new log stream named kubernetes-apiservers in the /aws/containerinsights/cluster_name/prometheus log group. This log stream should include log events with an embedded metric format definition like the following: { "CloudWatchMetrics":[ { "Metrics":[ { "Name":"apiserver_request_total" } ], "Dimensions":[ [ "ClusterName", "Service" ] ], "Namespace":"ContainerInsights/Prometheus" } ], "ClusterName":"my-cluster-name", "Namespace":"default", Container Insights Prometheus metrics monitoring 814 Amazon CloudWatch User Guide "Service":"kubernetes", "Timestamp":"1592267020339", "Version":"0", "apiserver_request_count":0, "apiserver_request_total":0, "code":"0", "component":"apiserver", "contentType":"application/json", "instance":"192.0.2.0:443", "job":"kubernetes-apiservers", "prom_metric_type":"counter", "resource":"pods", "scope":"namespace", "verb":"WATCH", "version":"v1" } You can view your metrics in the CloudWatch console in the ContainerInsights/Prometheus namespace. You can also optionally create a CloudWatch dashboard for your Prometheus Kubernetes API Server metrics. (Optional) Creating a dashboard for Kubernetes API Server metrics To see Kubernetes API Server metrics in your dashboard, you must have first completed the steps in the previous sections to start collecting these metrics in CloudWatch. To create a dashboard for Kubernetes API Server metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Make sure you have the correct AWS Region selected. 3. In the navigation pane, choose Dashboards. 4. Choose Create Dashboard. Enter a name for the new dashboard, and choose Create dashboard. 5. In Add to this dashboard, choose Cancel. 6. Choose Actions, View/edit source. 7. Download the following JSON file: Kubernetes API Dashboard source. 8. Open the JSON file that you downloaded with a text editor, and make the following changes: • Replace all the {{YOUR_CLUSTER_NAME}} strings with the exact name of your cluster. Make sure not to add whitespaces before or after the text. Container Insights Prometheus metrics monitoring 815 Amazon CloudWatch User Guide • Replace all the {{YOUR_AWS_REGION}} strings with the name of the Region where the metrics are collected. For example us-west-2. Be sure not to add whitespaces before or after the text. 9. Copy the entire JSON blob and paste it into the text box in the CloudWatch console, replacing what is already in the box. 10. Choose Update, Save dashboard. (Optional) Set up sample containerized Amazon EKS workloads for Prometheus metric testing To test the Prometheus metric support in CloudWatch Container Insights, you can set up one or more of the following containerized workloads. The CloudWatch agent with Prometheus support automatically collects metrics from each of these workloads. To see the metrics that are collected by default, see Prometheus metrics collected by the CloudWatch agent. Before you can install any of these workloads, you must install Helm 3.x by entering the following commands: brew install helm For more information, see Helm. Topics • Set up AWS App Mesh sample workload for Amazon EKS and Kubernetes • Set up NGINX with sample traffic on Amazon EKS and Kubernetes • Set up memcached with a metric exporter on Amazon EKS and Kubernetes • Set up Java/JMX sample workload on Amazon EKS and Kubernetes • Set up HAProxy with a metric exporter on Amazon EKS and Kubernetes • Tutorial for adding a new Prometheus scrape target: Redis OSS on Amazon EKS and Kubernetes clusters Set up AWS App Mesh sample workload for Amazon EKS and Kubernetes Prometheus support in CloudWatch Container Insights supports AWS App Mesh. The following sections explain how to set up App Mesh. Topics Container Insights Prometheus metrics monitoring 816 Amazon CloudWatch User Guide • Set up AWS App Mesh sample workload on an Amazon EKS cluster with the EC2 launch type or a Kubernetes cluster • Set up AWS App Mesh sample workload on an Amazon EKS cluster with the Fargate launch type Set up AWS App Mesh sample workload on an Amazon EKS cluster with the EC2 launch type or a Kubernetes cluster Use these instructions if you are setting up App Mesh on a cluster running Amazon EKS with the EC2 launch type, or a Kubernetes cluster. Configure IAM permissions You must add the AWSAppMeshFullAccess policy to the IAM role for your Amazon EKS or Kubernetes node group. On Amazon EKS, this node group name looks similar to eksctl-integ- test-eks-prometheus-NodeInstanceRole-ABCDEFHIJKL. On Kubernetes, it might look similar to nodes.integ-test-kops-prometheus.k8s.local. Install App Mesh To install the App Mesh Kubernetes controller, follow the instructions in App Mesh Controller. Install a sample application aws-app-mesh-examples contains several Kubernetes App Mesh walkthroughs. For this tutorial, you install a sample color application that shows how http routes can use headers for matching incoming requests. To use a sample App Mesh application to test Container Insights 1. Install the application using these instructions: https://github.com/aws/aws-app-mesh- examples/tree/main/walkthroughs/howto-k8s-http-headers. 2. Launch a curler pod to generate traffic: kubectl -n default run -it curler --image=tutum/curl /bin/bash 3. Curl different endpoints by changing HTTP headers. Run the curl command multiple times, as shown: curl -H "color_header: blue" front.howto-k8s-http-headers.svc.cluster.local:8080/; echo; Container Insights Prometheus metrics monitoring 817 Amazon CloudWatch User Guide curl -H "color_header: red" front.howto-k8s-http-headers.svc.cluster.local:8080/; echo; curl -H "color_header: yellow" front.howto-k8s-http- headers.svc.cluster.local:8080/; echo; 4. |
acw-ug-255 | acw-ug.pdf | 255 | you install a sample color application that shows how http routes can use headers for matching incoming requests. To use a sample App Mesh application to test Container Insights 1. Install the application using these instructions: https://github.com/aws/aws-app-mesh- examples/tree/main/walkthroughs/howto-k8s-http-headers. 2. Launch a curler pod to generate traffic: kubectl -n default run -it curler --image=tutum/curl /bin/bash 3. Curl different endpoints by changing HTTP headers. Run the curl command multiple times, as shown: curl -H "color_header: blue" front.howto-k8s-http-headers.svc.cluster.local:8080/; echo; Container Insights Prometheus metrics monitoring 817 Amazon CloudWatch User Guide curl -H "color_header: red" front.howto-k8s-http-headers.svc.cluster.local:8080/; echo; curl -H "color_header: yellow" front.howto-k8s-http- headers.svc.cluster.local:8080/; echo; 4. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 5. In the AWS Region where your cluster is running, choose Metrics in the navigation pane. The metric are in the ContainerInsights/Prometheus namespace. 6. To see the CloudWatch Logs events, choose Log groups in the navigation pane. The events are in the log group /aws/containerinsights/your_cluster_name/prometheus in the log stream kubernetes-pod-appmesh-envoy. Deleting the App Mesh test environment When you have finished using App Mesh and the sample application, use the following commands to delete the unnecessary resources. Delete the sample application by entering the following command: cd aws-app-mesh-examples/walkthroughs/howto-k8s-http-headers/ kubectl delete -f _output/manifest.yaml Delete the App Mesh controller by entering the following command: helm delete appmesh-controller -n appmesh-system Set up AWS App Mesh sample workload on an Amazon EKS cluster with the Fargate launch type Use these instructions if you are setting up App Mesh on a cluster running Amazon EKS with the Fargate launch type. Configure IAM permissions To set up IAM permissions, enter the following command. Replace MyCluster with the name of your cluster. eksctl create iamserviceaccount --cluster MyCluster \ --namespace howto-k8s-fargate \ --name appmesh-pod \ --attach-policy-arn arn:aws:iam::aws:policy/AWSAppMeshEnvoyAccess \ Container Insights Prometheus metrics monitoring 818 Amazon CloudWatch User Guide --attach-policy-arn arn:aws:iam::aws:policy/AWSCloudMapDiscoverInstanceAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess \ --attach-policy-arn arn:aws:iam::aws:policy/CloudWatchLogsFullAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSAppMeshFullAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSCloudMapFullAccess \ --override-existing-serviceaccounts \ --approve Install App Mesh To install the App Mesh Kubernetes controller, follow the instructions in App Mesh Controller. Be sure to follow the instructions for Amazon EKS with the Fargate launch type. Install a sample application aws-app-mesh-examples contains several Kubernetes App Mesh walkthroughs. For this tutorial, you install a sample color application that works for Amazon EKS clusters with the Fargate launch type. To use a sample App Mesh application to test Container Insights 1. Install the application using these instructions: https://github.com/aws/aws-app-mesh- examples/tree/main/walkthroughs/howto-k8s-fargate. Those instructions assume that you are creating a new cluster with the correct Fargate profile. If you want to use an Amazon EKS cluster that you've already set up, you can use the following commands to set up that cluster for this demonstration. Replace MyCluster with the name of your cluster. eksctl create iamserviceaccount --cluster MyCluster \ --namespace howto-k8s-fargate \ --name appmesh-pod \ --attach-policy-arn arn:aws:iam::aws:policy/AWSAppMeshEnvoyAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSCloudMapDiscoverInstanceAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess \ --attach-policy-arn arn:aws:iam::aws:policy/CloudWatchLogsFullAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSAppMeshFullAccess \ --attach-policy-arn arn:aws:iam::aws:policy/AWSCloudMapFullAccess \ --override-existing-serviceaccounts \ --approve eksctl create fargateprofile --cluster MyCluster \ Container Insights Prometheus metrics monitoring 819 Amazon CloudWatch User Guide --namespace howto-k8s-fargate --name howto-k8s-fargate 2. Port forward the front application deployment: kubectl -n howto-k8s-fargate port-forward deployment/front 8080:8080 3. Curl the front app: while true; do curl -s http://localhost:8080/color; sleep 0.1; echo ; done 4. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 5. 6. In the AWS Region where your cluster is running, choose Metrics in the navigation pane. The metric are in the ContainerInsights/Prometheus namespace. To see the CloudWatch Logs events, choose Log groups in the navigation pane. The events are in the log group /aws/containerinsights/your_cluster_name/prometheus in the log stream kubernetes-pod-appmesh-envoy. Deleting the App Mesh test environment When you have finished using App Mesh and the sample application, use the following commands to delete the unnecessary resources. Delete the sample application by entering the following command: cd aws-app-mesh-examples/walkthroughs/howto-k8s-fargate/ kubectl delete -f _output/manifest.yaml Delete the App Mesh controller by entering the following command: helm delete appmesh-controller -n appmesh-system Set up NGINX with sample traffic on Amazon EKS and Kubernetes NGINX is a web server that can also be used as a load balancer and reverse proxy. For more information about how Kubernetes uses NGINX for ingress , see kubernetes/ingress-nginx. To install Ingress-NGINX with a sample traffic service to test Container Insights Prometheus support 1. Enter the following command to add the Helm ingress-nginx repo: Container Insights Prometheus metrics monitoring 820 Amazon CloudWatch User Guide helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx 2. Enter the following commands: kubectl create namespace nginx-ingress-sample helm install my-nginx ingress-nginx/ingress-nginx \ --namespace nginx-ingress-sample \ --set controller.metrics.enabled=true \ --set-string controller.metrics.service.annotations."prometheus\.io/port"="10254" \ --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true" 3. Check whether the services started correctly by entering the following command: kubectl get service -n nginx-ingress-sample The output of this command should display several columns, including an EXTERNAL-IP column. 4. Set an EXTERNAL-IP variable to the value of the EXTERNAL-IP column in the row of the NGINX ingress controller. EXTERNAL_IP=your-nginx-controller-external-ip 5. Start |
acw-ug-256 | acw-ug.pdf | 256 | command to add the Helm ingress-nginx repo: Container Insights Prometheus metrics monitoring 820 Amazon CloudWatch User Guide helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx 2. Enter the following commands: kubectl create namespace nginx-ingress-sample helm install my-nginx ingress-nginx/ingress-nginx \ --namespace nginx-ingress-sample \ --set controller.metrics.enabled=true \ --set-string controller.metrics.service.annotations."prometheus\.io/port"="10254" \ --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true" 3. Check whether the services started correctly by entering the following command: kubectl get service -n nginx-ingress-sample The output of this command should display several columns, including an EXTERNAL-IP column. 4. Set an EXTERNAL-IP variable to the value of the EXTERNAL-IP column in the row of the NGINX ingress controller. EXTERNAL_IP=your-nginx-controller-external-ip 5. Start some sample NGINX traffic by entering the following command. SAMPLE_TRAFFIC_NAMESPACE=nginx-sample-traffic curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/sample_traffic/nginx-traffic/nginx-traffic-sample.yaml | sed "s/{{external_ip}}/$EXTERNAL_IP/g" | sed "s/{{namespace}}/$SAMPLE_TRAFFIC_NAMESPACE/g" | kubectl apply -f - 6. Enter the following command to confirm that all three pods are in the Running status. kubectl get pod -n $SAMPLE_TRAFFIC_NAMESPACE If they are running, you should soon see metrics in the ContainerInsights/Prometheus namespace. Container Insights Prometheus metrics monitoring 821 Amazon CloudWatch User Guide To uninstall NGINX and the sample traffic application 1. Delete the sample traffic service by entering the following command: kubectl delete namespace $SAMPLE_TRAFFIC_NAMESPACE 2. Delete the NGINX egress by the Helm release name. helm uninstall my-nginx --namespace nginx-ingress-sample kubectl delete namespace nginx-ingress-sample Set up memcached with a metric exporter on Amazon EKS and Kubernetes memcached is an open-source memory object caching system. For more information, see What is Memcached?. If you are running memcached on a cluster with the Fargate launch type, you need to set up a Fargate profile before doing the steps in this procedure. To set up the profile, enter the following command. Replace MyCluster with the name of your cluster. eksctl create fargateprofile --cluster MyCluster \ --namespace memcached-sample --name memcached-sample To install memcached with a metric exporter to test Container Insights Prometheus support 1. Enter the following command to add the repo: helm repo add bitnami https://charts.bitnami.com/bitnami 2. Enter the following command to create a new namespace: kubectl create namespace memcached-sample 3. Enter the following command to install Memcached helm install my-memcached bitnami/memcached --namespace memcached-sample \ --set metrics.enabled=true \ --set-string serviceAnnotations.prometheus\\.io/port="9150" \ --set-string serviceAnnotations.prometheus\\.io/scrape="true" Container Insights Prometheus metrics monitoring 822 Amazon CloudWatch User Guide 4. Enter the following command to confirm the annotation of the running service: kubectl describe service my-memcached-metrics -n memcached-sample You should see the following two annotations: Annotations: prometheus.io/port: 9150 prometheus.io/scrape: true To uninstall memcached • Enter the following commands: helm uninstall my-memcached --namespace memcached-sample kubectl delete namespace memcached-sample Set up Java/JMX sample workload on Amazon EKS and Kubernetes JMX Exporter is an official Prometheus exporter that can scrape and expose JMX mBeans as Prometheus metrics. For more information, see prometheus/jmx_exporter. Container Insights can collect predefined Prometheus metrics from Java Virtual Machine (JVM), Java, and Tomcat (Catalina) using the JMX Exporter. Default Prometheus scrape configuration By default, the CloudWatch agent with Prometheus support scrapes the Java/JMX Prometheus metrics from http://CLUSTER_IP:9404/metrics on each pod in an Amazon EKS or Kubernetes cluster. This is done by role: pod discovery of Prometheus kubernetes_sd_config. 9404 is the default port allocated for JMX Exporter by Prometheus. For more information about role: pod discovery, see pod. You can configure the JMX Exporter to expose the metrics on a different port or metrics_path. If you do change the port or path, update the default jmx scrape_config in the CloudWatch agent config map. Run the following command to get the current CloudWatch agent Prometheus configuration: kubectl describe cm prometheus-config -n amazon-cloudwatch Container Insights Prometheus metrics monitoring 823 Amazon CloudWatch User Guide The fields to change are the /metrics and regex: '.*:9404$' fields, as highlighted in the following example. job_name: 'kubernetes-jmx-pod' sample_limit: 10000 metrics_path: /metrics kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__address__] action: keep regex: '.*:9404$' - action: replace regex: (.+) source_labels: Other Prometheus scrape configuration If you expose your application running on a set of pods with Java/JMX Prometheus exporters by a Kubernetes Service, you can also switch to use role: service discovery or role: endpoint discovery of Prometheus kubernetes_sd_config. For more information about these discovery methods, see service, endpoints, and <kubernetes_sd_config>.. More meta labels are provided by these two service discovery modes which could be useful for you to build the CloudWatch metrics dimensions. For example, you can relabel __meta_kubernetes_service_name to Service and include it into your metrics’ dimension. For more informatio about customizing your CloudWatch metrics and their dimensions, see CloudWatch agent configuration for Prometheus. Docker image with JMX Exporter Next, build a Docker image. The following sections provide two example Dockerfiles. When you have built the image, load it into Amazon EKS or Kubernetes, and then run the following command to verify that Prometheus metrics are exposed by JMX_EXPORTER on port 9404. Replace $JAR_SAMPLE_TRAFFIC_POD with the running pod name and replace $JAR_SAMPLE_TRAFFIC_NAMESPACE with your application namespace. If you |
acw-ug-257 | acw-ug.pdf | 257 | the CloudWatch metrics dimensions. For example, you can relabel __meta_kubernetes_service_name to Service and include it into your metrics’ dimension. For more informatio about customizing your CloudWatch metrics and their dimensions, see CloudWatch agent configuration for Prometheus. Docker image with JMX Exporter Next, build a Docker image. The following sections provide two example Dockerfiles. When you have built the image, load it into Amazon EKS or Kubernetes, and then run the following command to verify that Prometheus metrics are exposed by JMX_EXPORTER on port 9404. Replace $JAR_SAMPLE_TRAFFIC_POD with the running pod name and replace $JAR_SAMPLE_TRAFFIC_NAMESPACE with your application namespace. If you are running JMX Exporter on a cluster with the Fargate launch type, you also need to set up a Fargate profile before doing the steps in this procedure. To set up the profile, enter the following command. Replace MyCluster with the name of your cluster. Container Insights Prometheus metrics monitoring 824 Amazon CloudWatch User Guide eksctl create fargateprofile --cluster MyCluster \ --namespace $JAR_SAMPLE_TRAFFIC_NAMESPACE\ --name $JAR_SAMPLE_TRAFFIC_NAMESPACE kubectl exec $JAR_SAMPLE_TRAFFIC_POD -n $JARCAT_SAMPLE_TRAFFIC_NAMESPACE -- curl http://localhost:9404 Example: Apache Tomcat Docker image with Prometheus metrics Apache Tomcat server exposes JMX mBeans by default. You can integrate JMX Exporter with Tomcat to expose JMX mBeans as Prometheus metrics. The following example Dockerfile shows the steps to build a testing image: # From Tomcat 9.0 JDK8 OpenJDK FROM tomcat:9.0-jdk8-openjdk RUN mkdir -p /opt/jmx_exporter COPY ./jmx_prometheus_javaagent-0.12.0.jar /opt/jmx_exporter COPY ./config.yaml /opt/jmx_exporter COPY ./setenv.sh /usr/local/tomcat/bin COPY your web application.war /usr/local/tomcat/webapps/ RUN chmod o+x /usr/local/tomcat/bin/setenv.sh ENTRYPOINT ["catalina.sh", "run"] The following list explains the four COPY lines in this Dockerfile. • Download the latest JMX Exporter jar file from https://github.com/prometheus/jmx_exporter. • config.yaml is the JMX Exporter configuration file. For more information, see https:// github.com/prometheus/jmx_exporter#Configuration. Here is a sample configuration file for Java and Tomcat: lowercaseOutputName: true lowercaseOutputLabelNames: true rules: Container Insights Prometheus metrics monitoring 825 Amazon CloudWatch User Guide - pattern: 'java.lang<type=OperatingSystem><>(FreePhysicalMemorySize| TotalPhysicalMemorySize|FreeSwapSpaceSize|TotalSwapSpaceSize|SystemCpuLoad| ProcessCpuLoad|OpenFileDescriptorCount|AvailableProcessors)' name: java_lang_OperatingSystem_$1 type: GAUGE - pattern: 'java.lang<type=Threading><>(TotalStartedThreadCount|ThreadCount)' name: java_lang_threading_$1 type: GAUGE - pattern: 'Catalina<type=GlobalRequestProcessor, name=\"(\w+-\w+)-(\d+)\"><>(\w+)' name: catalina_globalrequestprocessor_$3_total labels: port: "$2" protocol: "$1" help: Catalina global $3 type: COUNTER - pattern: 'Catalina<j2eeType=Servlet, WebModule=//([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[- a-zA-Z0-9+&@#/%=~_|]), name=([-a-zA-Z0-9+/$%~_-|!.]*), J2EEApplication=none, J2EEServer=none><>(requestCount|maxTime|processingTime|errorCount)' name: catalina_servlet_$3_total labels: module: "$1" servlet: "$2" help: Catalina servlet $3 total type: COUNTER - pattern: 'Catalina<type=ThreadPool, name="(\w+-\w+)-(\d+)"><>(currentThreadCount| currentThreadsBusy|keepAliveCount|pollerThreadCount|connectionCount)' name: catalina_threadpool_$3 labels: port: "$2" protocol: "$1" help: Catalina threadpool $3 type: GAUGE - pattern: 'Catalina<type=Manager, host=([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA- Z0-9+&@#/%=~_|]), context=([-a-zA-Z0-9+/$%~_-|!.]*)><>(processingTime|sessionCounter| rejectedSessions|expiredSessions)' name: catalina_session_$3_total labels: context: "$2" host: "$1" Container Insights Prometheus metrics monitoring 826 Amazon CloudWatch User Guide help: Catalina session $3 total type: COUNTER - pattern: ".*" • setenv.sh is a Tomcat startup script to start the JMX exporter along with Tomcat and expose Prometheus metrics on port 9404 of the localhost. It also provides the JMX Exporter with the config.yaml file path. $ cat setenv.sh export JAVA_OPTS="-javaagent:/opt/jmx_exporter/ jmx_prometheus_javaagent-0.12.0.jar=9404:/opt/jmx_exporter/config.yaml $JAVA_OPTS" • your web application.war is your web application war file to be loaded by Tomcat. Build a Docker image with this configuration and upload it to an image repository. Example: Java Jar Application Docker image with Prometheus metrics The following example Dockerfile shows the steps to build a testing image: # Alpine Linux with OpenJDK JRE FROM openjdk:8-jre-alpine RUN mkdir -p /opt/jmx_exporter COPY ./jmx_prometheus_javaagent-0.12.0.jar /opt/jmx_exporter COPY ./SampleJavaApplication-1.0-SNAPSHOT.jar /opt/jmx_exporter COPY ./start_exporter_example.sh /opt/jmx_exporter COPY ./config.yaml /opt/jmx_exporter RUN chmod -R o+x /opt/jmx_exporter RUN apk add curl ENTRYPOINT exec /opt/jmx_exporter/start_exporter_example.sh The following list explains the four COPY lines in this Dockerfile. • Download the latest JMX Exporter jar file from https://github.com/prometheus/jmx_exporter. • config.yaml is the JMX Exporter configuration file. For more information, see https:// github.com/prometheus/jmx_exporter#Configuration. Container Insights Prometheus metrics monitoring 827 Amazon CloudWatch User Guide Here is a sample configuration file for Java and Tomcat: lowercaseOutputName: true lowercaseOutputLabelNames: true rules: - pattern: 'java.lang<type=OperatingSystem><>(FreePhysicalMemorySize| TotalPhysicalMemorySize|FreeSwapSpaceSize|TotalSwapSpaceSize|SystemCpuLoad| ProcessCpuLoad|OpenFileDescriptorCount|AvailableProcessors)' name: java_lang_OperatingSystem_$1 type: GAUGE - pattern: 'java.lang<type=Threading><>(TotalStartedThreadCount|ThreadCount)' name: java_lang_threading_$1 type: GAUGE - pattern: 'Catalina<type=GlobalRequestProcessor, name=\"(\w+-\w+)-(\d+)\"><>(\w+)' name: catalina_globalrequestprocessor_$3_total labels: port: "$2" protocol: "$1" help: Catalina global $3 type: COUNTER - pattern: 'Catalina<j2eeType=Servlet, WebModule=//([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[- a-zA-Z0-9+&@#/%=~_|]), name=([-a-zA-Z0-9+/$%~_-|!.]*), J2EEApplication=none, J2EEServer=none><>(requestCount|maxTime|processingTime|errorCount)' name: catalina_servlet_$3_total labels: module: "$1" servlet: "$2" help: Catalina servlet $3 total type: COUNTER - pattern: 'Catalina<type=ThreadPool, name="(\w+-\w+)-(\d+)"><>(currentThreadCount| currentThreadsBusy|keepAliveCount|pollerThreadCount|connectionCount)' name: catalina_threadpool_$3 labels: port: "$2" protocol: "$1" help: Catalina threadpool $3 type: GAUGE Container Insights Prometheus metrics monitoring 828 Amazon CloudWatch User Guide - pattern: 'Catalina<type=Manager, host=([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA- Z0-9+&@#/%=~_|]), context=([-a-zA-Z0-9+/$%~_-|!.]*)><>(processingTime|sessionCounter| rejectedSessions|expiredSessions)' name: catalina_session_$3_total labels: context: "$2" host: "$1" help: Catalina session $3 total type: COUNTER - pattern: ".*" • start_exporter_example.sh is the script to start the JAR application with the Prometheus metrics exported. It also provides the JMX Exporter with the config.yaml file path. $ cat start_exporter_example.sh java -javaagent:/opt/jmx_exporter/jmx_prometheus_javaagent-0.12.0.jar=9404:/ opt/jmx_exporter/config.yaml -cp /opt/jmx_exporter/SampleJavaApplication-1.0- SNAPSHOT.jar com.gubupt.sample.app.App • SampleJavaApplication-1.0-SNAPSHOT.jar is the sample Java application jar file. Replace it with the Java application that you want to monitor. Build a Docker image with this configuration and upload it to an image repository. Set up HAProxy with a metric exporter on Amazon EKS and Kubernetes HAProxy is an open-source proxy application. For |
acw-ug-258 | acw-ug.pdf | 258 | "$1" help: Catalina session $3 total type: COUNTER - pattern: ".*" • start_exporter_example.sh is the script to start the JAR application with the Prometheus metrics exported. It also provides the JMX Exporter with the config.yaml file path. $ cat start_exporter_example.sh java -javaagent:/opt/jmx_exporter/jmx_prometheus_javaagent-0.12.0.jar=9404:/ opt/jmx_exporter/config.yaml -cp /opt/jmx_exporter/SampleJavaApplication-1.0- SNAPSHOT.jar com.gubupt.sample.app.App • SampleJavaApplication-1.0-SNAPSHOT.jar is the sample Java application jar file. Replace it with the Java application that you want to monitor. Build a Docker image with this configuration and upload it to an image repository. Set up HAProxy with a metric exporter on Amazon EKS and Kubernetes HAProxy is an open-source proxy application. For more information, see HAProxy. If you are running HAProxy on a cluster with the Fargate launch type, you need to set up a Fargate profile before doing the steps in this procedure. To set up the profile, enter the following command. Replace MyCluster with the name of your cluster. eksctl create fargateprofile --cluster MyCluster \ --namespace haproxy-ingress-sample --name haproxy-ingress-sample To install HAProxy with a metric exporter to test Container Insights Prometheus support 1. Enter the following command to add the Helm incubator repo: helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts Container Insights Prometheus metrics monitoring 829 Amazon CloudWatch User Guide 2. Enter the following command to create a new namespace: kubectl create namespace haproxy-ingress-sample 3. Enter the following commands to install HAProxy: helm install haproxy haproxy-ingress/haproxy-ingress \ --namespace haproxy-ingress-sample \ --set defaultBackend.enabled=true \ --set controller.stats.enabled=true \ --set controller.metrics.enabled=true \ --set-string controller.metrics.service.annotations."prometheus\.io/port"="9101" \ --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true" 4. Enter the following command to confirm the annotation of the service: kubectl describe service haproxy-haproxy-ingress-metrics -n haproxy-ingress-sample You should see the following annotations. Annotations: prometheus.io/port: 9101 prometheus.io/scrape: true To uninstall HAProxy • Enter the following commands: helm uninstall haproxy --namespace haproxy-ingress-sample kubectl delete namespace haproxy-ingress-sample Tutorial for adding a new Prometheus scrape target: Redis OSS on Amazon EKS and Kubernetes clusters This tutorial provides a hands-on introduction to scrape the Prometheus metrics of a sample Redis OSS application on Amazon EKS and Kubernetes. Redis OSS (https://redis.io/) is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. For more information, see redis. Container Insights Prometheus metrics monitoring 830 Amazon CloudWatch User Guide redis_exporter (MIT License licensed) is used to expose the Redis OSS Prometheus metrics on the specified port (default: 0.0.0.0:9121). For more information, see redis_exporter. The Docker images in the following two Docker Hub repositories are used in this tutorial: • redis • redis_exporter To install a sample Redis OSS workload which exposes Prometheus metrics 1. Set the namespace for the sample Redis OSS workload. REDIS_NAMESPACE=redis-sample 2. If you are running Redis OSS on a cluster with the Fargate launch type, you need to set up a Fargate profile. To set up the profile, enter the following command. Replace MyCluster with the name of your cluster. eksctl create fargateprofile --cluster MyCluster \ --namespace $REDIS_NAMESPACE --name $REDIS_NAMESPACE 3. Enter the following command to install the sample Redis OSS workload. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/sample_traffic/redis/redis-traffic-sample.yaml \ | sed "s/{{namespace}}/$REDIS_NAMESPACE/g" \ | kubectl apply -f - 4. The installation includes a service named my-redis-metrics which exposes the Redis OSS Prometheus metric on port 9121 Enter the following command to get the details of the service: kubectl describe service/my-redis-metrics -n $REDIS_NAMESPACE In the Annotations section of the results, you'll see two annotations which match the Prometheus scrape configuration of the CloudWatch agent, so that it can auto-discover the workloads: prometheus.io/port: 9121 Container Insights Prometheus metrics monitoring 831 Amazon CloudWatch User Guide prometheus.io/scrape: true The related Prometheus scrape configuration can be found in the - job_name: kubernetes-service-endpoints section of kubernetes-eks.yaml or kubernetes- k8s.yaml. To start collecting Redis OSS Prometheus metrics in CloudWatch 1. Download the latest version of the of kubernetes-eks.yaml or kubernetes-k8s.yaml file by entering one of the following commands. For an Amazon EKS cluster with the EC2 launch type, enter this command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-eks.yaml For an Amazon EKS cluster with the Fargate launch type, enter this command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-eks-fargate.yaml For a Kubernetes cluster running on an Amazon EC2 instance, enter this command. curl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/prometheus-k8s.yaml 2. Open the file with a text editor, and find the cwagentconfig.json section. Add the following subsection and save the changes. Be sure that the indentation follows the existing pattern. { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName"]], "metric_selectors": [ "^redis_net_(in|out)put_bytes_total$", "^redis_(expired|evicted)_keys_total$", Container Insights Prometheus metrics monitoring 832 Amazon CloudWatch User Guide "^redis_keyspace_(hits|misses)_total$", "^redis_memory_used_bytes$", "^redis_connected_clients$" ] }, { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName","cmd"]], "metric_selectors": [ "^redis_commands_total$" ] }, { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName","db"]], "metric_selectors": [ "^redis_db_keys$" ] }, The section you added puts the Redis OSS metrics onto the CloudWatch agent allow list. For a list of these metrics, see the following section. 3. If you already have the CloudWatch agent with Prometheus support deployed in this cluster, |
acw-ug-259 | acw-ug.pdf | 259 | changes. Be sure that the indentation follows the existing pattern. { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName"]], "metric_selectors": [ "^redis_net_(in|out)put_bytes_total$", "^redis_(expired|evicted)_keys_total$", Container Insights Prometheus metrics monitoring 832 Amazon CloudWatch User Guide "^redis_keyspace_(hits|misses)_total$", "^redis_memory_used_bytes$", "^redis_connected_clients$" ] }, { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName","cmd"]], "metric_selectors": [ "^redis_commands_total$" ] }, { "source_labels": ["pod_name"], "label_matcher": "^redis-instance$", "dimensions": [["Namespace","ClusterName","db"]], "metric_selectors": [ "^redis_db_keys$" ] }, The section you added puts the Redis OSS metrics onto the CloudWatch agent allow list. For a list of these metrics, see the following section. 3. If you already have the CloudWatch agent with Prometheus support deployed in this cluster, you must delete it by entering the following command. kubectl delete deployment cwagent-prometheus -n amazon-cloudwatch 4. Deploy the CloudWatch agent with your updated configuration by entering one of the following commands. Replace MyCluster and region to match your settings. For an Amazon EKS cluster with the EC2 launch type, enter this command. kubectl apply -f prometheus-eks.yaml For an Amazon EKS cluster with the Fargate launch type, enter this command. cat prometheus-eks-fargate.yaml \ | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" \ | kubectl apply -f - Container Insights Prometheus metrics monitoring 833 Amazon CloudWatch User Guide For a Kubernetes cluster, enter this command. cat prometheus-k8s.yaml \ | sed "s/{{cluster_name}}/MyCluster/;s/{{region_name}}/region/" \ | kubectl apply -f - Viewing your Redis OSS Prometheus metrics This tutorial sends the following metrics to the ContainerInsights/Prometheus namespace in CloudWatch. You can use the CloudWatch console to see the metrics in that namespace. Metric name Dimensions redis_net _input_by tes_total redis_net _output_b ytes_total redis_exp ired_keys _total redis_evi cted_keys _total redis_key space_hit s_total redis_key space_mis ses_total ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace Container Insights Prometheus metrics monitoring 834 Amazon CloudWatch User Guide Metric name Dimensions redis_mem ClusterName, Namespace ory_used_bytes redis_con ClusterName, Namespace nected_clients redis_com mands_total ClusterName, Namespace , cmd redis_db_keys ClusterName, Namespace , db Note The value of the cmd dimension can be: append, client, command, config, dbsize, flushall, get, incr, info, latency, or slowlog. The value of the db dimension can be db0 to db15. You can also create a CloudWatch dashboard for your Redis OSS Prometheus metrics. To create a dashboard for Redis OSS Prometheus metrics 1. Create environment variables, replacing the values below to match your deployment. DASHBOARD_NAME=your_cw_dashboard_name REGION_NAME=your_metric_region_such_as_us-east-1 CLUSTER_NAME=your_k8s_cluster_name_here NAMESPACE=your_redis_service_namespace_here 2. Enter the following command to create the dashboard. curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container- insights/latest/k8s-deployment-manifest-templates/deployment-mode/service/cwagent- prometheus/sample_cloudwatch_dashboards/redis/cw_dashboard_redis.json \ | sed "s/{{YOUR_AWS_REGION}}/${REGION_NAME}/g" \ | sed "s/{{YOUR_CLUSTER_NAME}}/${CLUSTER_NAME}/g" \ | sed "s/{{YOUR_NAMESPACE}}/${NAMESPACE}/g" \ Container Insights Prometheus metrics monitoring 835 Amazon CloudWatch User Guide Prometheus metric type conversion by the CloudWatch Agent The Prometheus client libraries offer four core metric types: • Counter • Gauge • Summary • Histogram The CloudWatch agent supports the counter, gauge, and summary metric types. The Prometheus metrics with the unsupported histogram metric type are dropped by the CloudWatch agent. For more information, see Logging dropped Prometheus metrics. Gauge metrics A Prometheus gauge metric is a metric that represents a single numerical value that can arbitrarily go up and down. The CloudWatch agent scrapes gauge metrics and send these values out directly. Counter metrics A Prometheus counter metric is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero. The CloudWatch agent calculates a delta from the previous scrape and sends the delta value as the metric value in the log event. So the CloudWatch agent will start to produce one log event from the second scrape and continue with subsequent scrapes, if any. Summary metrics A Prometheus summary metric is a complex metric type which is represented by multiple data points. It provides a total count of observations and a sum of all observed values. It calculates configurable quantiles over a sliding time window. The sum and count of a summary metric are cumulative, but the quantiles are not. The following example shows the variance of quantiles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 7.123e-06 go_gc_duration_seconds{quantile="0.25"} 9.204e-06 go_gc_duration_seconds{quantile="0.5"} 1.1065e-05 go_gc_duration_seconds{quantile="0.75"} 2.8731e-05 Container Insights Prometheus metrics monitoring 836 Amazon CloudWatch User Guide go_gc_duration_seconds{quantile="1"} 0.003841496 go_gc_duration_seconds_sum 0.37630427 go_gc_duration_seconds_count 9774 The CloudWatch agent handles the sum and count of a summary metric in the same way as it handles counter metrics, as described in the previous section. The CloudWatch agent preserves the quantile values as they are originally reported. Prometheus metrics collected by the CloudWatch agent The CloudWatch agent with Prometheus support automatically collects metrics from several services and workloads. The metrics that are collected by default are listed in the following sections. You can also configure the agent to collect more metrics from these services, and to collect Prometheus metrics from other applications and services. For more information about collecting additional metrics, see CloudWatch agent configuration for Prometheus. Prometheus metrics collected from Amazon EKS and Kubernetes clusters are in the ContainerInsights/Prometheus namespace. Prometheus metrics collected from Amazon ECS clusters are |
acw-ug-260 | acw-ug.pdf | 260 | the quantile values as they are originally reported. Prometheus metrics collected by the CloudWatch agent The CloudWatch agent with Prometheus support automatically collects metrics from several services and workloads. The metrics that are collected by default are listed in the following sections. You can also configure the agent to collect more metrics from these services, and to collect Prometheus metrics from other applications and services. For more information about collecting additional metrics, see CloudWatch agent configuration for Prometheus. Prometheus metrics collected from Amazon EKS and Kubernetes clusters are in the ContainerInsights/Prometheus namespace. Prometheus metrics collected from Amazon ECS clusters are in the ECS/ContainerInsights/Prometheus namespace. Topics • Prometheus metrics for App Mesh • Prometheus metrics for NGINX • Prometheus metrics for Memcached • Prometheus metrics for Java/JMX • Prometheus metrics for HAProxy Prometheus metrics for App Mesh The following metrics are automatically collected from App Mesh . Prometheus metrics for App Mesh on Amazon EKS and Kubernetes clusters Metric name Dimensions envoy_htt p_downstr eam_rq_total ClusterName, Namespace Container Insights Prometheus metrics monitoring 837 Amazon CloudWatch User Guide Metric name Dimensions envoy_htt p_downstr eam_rq_xx ClusterName, Namespace ClusterName, Namespace , envoy_htt p_conn_manager_prefix, envoy_response_cod e_class ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace envoy_clu ster_upst ream_cx_r x_bytes_total envoy_clu ster_upst ream_cx_t x_bytes_total envoy_clu ster_memb ership_healthy envoy_clu ster_memb ership_total envoy_ser ver_memor y_heap_size envoy_ser ver_memor y_allocated envoy_clu ster_upst ream_cx_c onnect_timeout Container Insights Prometheus metrics monitoring 838 Amazon CloudWatch User Guide Metric name Dimensions ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace envoy_clu ster_upst ream_rq_p ending_fa ilure_eject envoy_clu ster_upst ream_rq_p ending_ov erflow envoy_clu ster_upst ream_rq_t imeout envoy_clu ster_upst ream_rq_t ry_per_timeout envoy_clu ster_upst ream_rq_r x_reset envoy_clu ster_upst ream_cx_d estroy_lo cal_with_ active_rq Container Insights Prometheus metrics monitoring 839 Amazon CloudWatch User Guide Metric name Dimensions ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace envoy_clu ster_upst ream_cx_d estroy_re mote_active_rq envoy_clu ster_upst ream_rq_m aintenanc e_mode envoy_clu ster_upst ream_flow _control_ paused_re ading_total envoy_clu ster_upst ream_flow _control_ resumed_r eading_total envoy_clu ster_upst ream_flow _control_ backed_up _total Container Insights Prometheus metrics monitoring 840 Amazon CloudWatch User Guide Metric name Dimensions envoy_clu ster_upst ream_flow _control_ drained_total envoy_clu ster_upst ream_rq_retry envoy_clu ster_upst ream_rq_r etry_success envoy_clu ster_upst ream_rq_r etry_overflow envoy_ser ver_live envoy_ser ver_uptime ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace ClusterName, Namespace Prometheus metrics for App Mesh on Amazon ECS clusters Metric name Dimensions envoy_htt p_downstr eam_rq_total ClusterName, TaskDefinitionFamily Container Insights Prometheus metrics monitoring 841 Amazon CloudWatch User Guide Metric name Dimensions ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily envoy_htt p_downstr eam_rq_xx envoy_clu ster_upst ream_cx_r x_bytes_total envoy_clu ster_upst ream_cx_t x_bytes_total envoy_clu ster_memb ership_healthy envoy_clu ster_memb ership_total envoy_ser ver_memor y_heap_size envoy_ser ver_memor y_allocated envoy_clu ster_upst ream_cx_c onnect_timeout Container Insights Prometheus metrics monitoring 842 Amazon CloudWatch User Guide Metric name Dimensions ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily envoy_clu ster_upst ream_rq_p ending_fa ilure_eject envoy_clu ster_upst ream_rq_p ending_ov erflow envoy_clu ster_upst ream_rq_t imeout envoy_clu ster_upst ream_rq_t ry_per_timeout envoy_clu ster_upst ream_rq_r x_reset envoy_clu ster_upst ream_cx_d estroy_lo cal_with_ active_rq Container Insights Prometheus metrics monitoring 843 Amazon CloudWatch User Guide Metric name Dimensions ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily envoy_clu ster_upst ream_cx_d estroy_re mote_active_rq envoy_clu ster_upst ream_rq_m aintenanc e_mode envoy_clu ster_upst ream_flow _control_ paused_re ading_total envoy_clu ster_upst ream_flow _control_ resumed_r eading_total envoy_clu ster_upst ream_flow _control_ backed_up _total Container Insights Prometheus metrics monitoring 844 Amazon CloudWatch User Guide Metric name Dimensions envoy_clu ster_upst ream_flow _control_ drained_total envoy_clu ster_upst ream_rq_retry envoy_clu ster_upst ream_rq_r etry_success envoy_clu ster_upst ream_rq_r etry_overflow envoy_ser ver_live envoy_ser ver_uptime envoy_htt p_downstr eam_rq_xx ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily ClusterName, TaskDefinitionFamily, envoy_htt p_conn_manager_prefix, envoy_response_cod e_class ClusterName, TaskDefinitionFamily, envoy_res ponse_code_class Note TaskDefinitionFamily is the Kubernetes namespace of the mesh. Container Insights Prometheus metrics monitoring 845 Amazon CloudWatch User Guide The value of envoy_http_conn_manager_prefix can be ingress, egress, or admin. The value of envoy_response_code_class can be 1 (stands for 1xx), 2 stands for 2xx), 3 stands for 3xx), 4 stands for 4xx), or 5 stands for 5xx). Prometheus metrics for NGINX The following metrics are automatically collected from NGINX on Amazon EKS and Kubernetes clusters. Metric name Dimensions ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service nginx_ing ress_cont roller_ng inx_proce ss_cpu_se conds_total nginx_ing ress_cont roller_success nginx_ing ress_cont roller_re quests nginx_ing ress_cont roller_ng inx_proce ss_connections nginx_ing ress_cont roller_ng inx_proce Container Insights Prometheus metrics monitoring 846 Amazon CloudWatch User Guide Metric name Dimensions ss_connec tions_total nginx_ing ress_cont roller_ng inx_proce ss_reside nt_memory _bytes nginx_ing ress_cont roller_co nfig_last _reload_s uccessful nginx_ing ress_cont roller_re quests ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service, status Prometheus metrics for Memcached The following metrics are automatically collected from Memcached on Amazon EKS and Kubernetes clusters. Metric name Dimensions memcached ClusterName, Namespace |
acw-ug-261 | acw-ug.pdf | 261 | Service ClusterName, Namespace , Service ClusterName, Namespace , Service nginx_ing ress_cont roller_ng inx_proce ss_cpu_se conds_total nginx_ing ress_cont roller_success nginx_ing ress_cont roller_re quests nginx_ing ress_cont roller_ng inx_proce ss_connections nginx_ing ress_cont roller_ng inx_proce Container Insights Prometheus metrics monitoring 846 Amazon CloudWatch User Guide Metric name Dimensions ss_connec tions_total nginx_ing ress_cont roller_ng inx_proce ss_reside nt_memory _bytes nginx_ing ress_cont roller_co nfig_last _reload_s uccessful nginx_ing ress_cont roller_re quests ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service, status Prometheus metrics for Memcached The following metrics are automatically collected from Memcached on Amazon EKS and Kubernetes clusters. Metric name Dimensions memcached ClusterName, Namespace , Service _current_items Container Insights Prometheus metrics monitoring 847 Amazon CloudWatch User Guide Metric name Dimensions memcached _current_ connections memcached _limit_bytes ClusterName, Namespace , Service ClusterName, Namespace , Service memcached ClusterName, Namespace , Service _current_bytes memcached _written_ bytes_total memcached _read_byt es_total memcached _items_ev icted_total memcached _items_re claimed_total memcached _commands _total ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service ClusterName, Namespace , Service, command ClusterName, Namespace , Service, status, command Prometheus metrics for Java/JMX Metrics collected on Amazon EKS and Kubernetes clusters Container Insights Prometheus metrics monitoring 848 Amazon CloudWatch User Guide On Amazon EKS and Kubernetes clusters, Container Insights can collect the following predefined Prometheus metrics from the Java Virtual Machine (JVM), Java, and Tomcat (Catalina) using the JMX Exporter. For more information, see prometheus/jmx_exporter on Github. Java/JMX on Amazon EKS and Kubernetes clusters Metric name Dimensions ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace jvm_class es_loaded jvm_threa ds_current jvm_threa ds_daemon java_lang _operatin gsystem_t otalswaps pacesize java_lang _operatin gsystem_s ystemcpuload java_lang _operatin gsystem_p rocesscpuload java_lang _operatin gsystem_f reeswapsp acesize Container Insights Prometheus metrics monitoring 849 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace , area ClusterName , Namespace , pool java_lang _operatin gsystem_t otalphysi calmemorysize java_lang _operatin gsystem_f reephysic almemorysize java_lang _operatin gsystem_o penfilede scriptorcount java_lang _operatin gsystem_a vailablep rocessors jvm_memor y_bytes_used jvm_memor y_pool_by tes_used Note The values of the area dimension can be heap or nonheap. Container Insights Prometheus metrics monitoring 850 Amazon CloudWatch User Guide The values of the pool dimension can be Tenured Gen, Compress Class Space, Survivor Space, Eden Space, Code Cache, or Metaspace. Tomcat/JMX on Amazon EKS and Kubernetes clusters In addition to the Java/JMX metrics in the previous table, the following metrics are also collected for the Tomcat workload. Metric name Dimensions ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace ClusterName , Namespace catalina_ manager_a ctivesessions catalina_ manager_r ejectedse ssions catalina_ globalreq uestproce ssor_byte sreceived catalina_ globalreq uestproce ssor_bytessent catalina_ globalreq uestproce ssor_requ estcount Container Insights Prometheus metrics monitoring 851 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace ClusterName , Namespace catalina_ globalreq uestproce ssor_erro rcount catalina_ globalreq uestproce ssor_proc essingtime Java/JMX on Amazon ECS clusters Metric name Dimensions ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily jvm_class es_loaded jvm_threa ds_current jvm_threa ds_daemon java_lang _operatin gsystem_t otalswaps pacesize java_lang _operatin gsystem_s ystemcpuload Container Insights Prometheus metrics monitoring 852 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily java_lang _operatin gsystem_p rocesscpuload java_lang _operatin gsystem_f reeswapsp acesize java_lang _operatin gsystem_t otalphysi calmemorysize java_lang _operatin gsystem_f reephysic almemorysize java_lang _operatin gsystem_o penfilede scriptorcount java_lang _operatin gsystem_a vailablep rocessors Container Insights Prometheus metrics monitoring 853 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , TaskDefinitionFamily, area ClusterName , TaskDefinitionFamily, pool jvm_memor y_bytes_used jvm_memor y_pool_by tes_used Note The values of the area dimension can be heap or nonheap. The values of the pool dimension can be Tenured Gen, Compress Class Space, Survivor Space, Eden Space, Code Cache, or Metaspace. Tomcat/JMX on Amazon ECS clusters In addition to the Java/JMX metrics in the previous table, the following metrics are also collected for the Tomcat workload on Amazon ECS clusters. Metric name Dimensions ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily catalina_ manager_a ctivesessions catalina_ manager_r ejectedse ssions catalina_ globalreq uestproce ssor_byte sreceived Container Insights Prometheus metrics monitoring 854 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily catalina_ globalreq uestproce ssor_bytessent catalina_ globalreq uestproce ssor_requ estcount catalina_ globalreq uestproce ssor_erro rcount catalina_ globalreq uestproce ssor_proc essingtime Prometheus metrics for HAProxy The following metrics are automatically collected from HAProxy on Amazon EKS and Kubernetes clusters. The metrics collected depend on which version of HAProxy Ingress that you are using. For more information about HAProxy Ingress and its versions, see haproxy-ingress. Container Insights Prometheus metrics monitoring 855 Amazon CloudWatch User Guide Metric |
acw-ug-262 | acw-ug.pdf | 262 | ssor_byte sreceived Container Insights Prometheus metrics monitoring 854 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily ClusterName , TaskDefinitionFamily catalina_ globalreq uestproce ssor_bytessent catalina_ globalreq uestproce ssor_requ estcount catalina_ globalreq uestproce ssor_erro rcount catalina_ globalreq uestproce ssor_proc essingtime Prometheus metrics for HAProxy The following metrics are automatically collected from HAProxy on Amazon EKS and Kubernetes clusters. The metrics collected depend on which version of HAProxy Ingress that you are using. For more information about HAProxy Ingress and its versions, see haproxy-ingress. Container Insights Prometheus metrics monitoring 855 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service Availability All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress ClusterName , Namespace , Service, code, backend All versions of HAProxy Ingress haproxy_b ackend_by tes_in_total haproxy_b ackend_by tes_out_total haproxy_b ackend_co nnection_ errors_total haproxy_b ackend_co nnections _total haproxy_b ackend_cu rrent_sessions haproxy_b ackend_ht tp_respon ses_total haproxy_b ClusterName , Namespace , Service ackend_status haproxy_b ackend_up ClusterName , Namespace , Service Only in versions 0.10 or later of HAProxy Ingress Only in versions of HAProxy Ingress earlier than 0.10 Container Insights Prometheus metrics monitoring 856 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service ClusterName , Namespace , Service Availability All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress All versions of HAProxy Ingress ClusterName , Namespace , Service, code, frontend All versions of HAProxy Ingress ClusterName , Namespace , Service All versions of HAProxy Ingress haproxy_f rontend_b ytes_in_total haproxy_f rontend_b ytes_out_total haproxy_f rontend_c onnection s_total haproxy_f rontend_c urrent_se ssions haproxy_f rontend_h ttp_reque sts_total haproxy_f rontend_h ttp_respo nses_total haproxy_f rontend_r equest_er rors_total Container Insights Prometheus metrics monitoring 857 Amazon CloudWatch User Guide Metric name Dimensions ClusterName , Namespace , Service haproxy_f rontend_r equests_d enied_total Note Availability All versions of HAProxy Ingress The values of the code dimension can be 1xx, 2xx, 3xx, 4xx, 5xx, or other. The values of the backend dimension can be: • http-default-backend, http-shared-backend, or httpsback-shared-backend for HAProxy Ingress version 0.0.27 or earlier. • _default_backend for HAProxy Ingress versions later than 0.0.27. The values of the frontend dimension can be: • httpfront-default-backend, httpfront-shared-frontend, or httpfronts for HAProxy Ingress version 0.0.27 or earlier. • _front_http or _front_https for HAProxy Ingress versions later than 0.0.27. Viewing your Prometheus metrics You can monitor and alarm on all your Prometheus metrics including the curated pre-aggregated metrics from App Mesh, NGINX, Java/JMX, Memcached, and HAProxy, and any other manually configured Prometheus exporter you may have added. For more information about collecting metrics from other Prometheus exporters, see Tutorial for adding a new Prometheus scrape target: Prometheus API Server metrics. In the CloudWatch console, Container Insights provides the following pre-built reports: • For Amazon EKS and Kubernetes clusters, there are pre-built reports for App Mesh, NGINX, HAPROXY, Memcached, and Java/JMX. • For Amazon ECS clusters, there are pre-built reports for App Mesh and Java/JMX. Container Insights Prometheus metrics monitoring 858 Amazon CloudWatch User Guide Container Insights also provides custom dashboards for each of the workloads that Container Insights collects curated metrics from. You can download these dashboards from GitHub To see all your Prometheus metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Metrics. In the list of namespaces, choose ContainerInsights/Prometheus or ECS/ContainerInsights/ Prometheus. 4. Choose one of the sets of dimensions in the following list. Then select the checkbox next to the metrics that you want to see. To see pre-built reports on your Prometheus metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Performance Monitoring. In the drop-down box near the top of the page, choose any of the Prometheus options. In the other drop-down box, choose a cluster to view We have also provided custom dashboards for NGINX, App Mesh, Memcached, HAProxy, and Java/ JMX. To use a custom dashboard that Amazon has provided 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Dashboards. 3. Choose Create Dashboard. Enter a name for the new dashboard, and choose Create dashboard. 4. In Add to this dashboard, choose Cancel. 5. Choose Actions, View/edit source. 6. Download one of the following JSON files: • NGINX custom dashboard source on Github. • App Mesh custom dashboard source on Github. • Memcached custom dashboard source on Github Container Insights Prometheus metrics monitoring 859 Amazon CloudWatch User Guide • HAProxy-Ingress custom dashboard source on Github • Java/JMX custom dashboard source on Github. |
acw-ug-263 | acw-ug.pdf | 263 | that Amazon has provided 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Dashboards. 3. Choose Create Dashboard. Enter a name for the new dashboard, and choose Create dashboard. 4. In Add to this dashboard, choose Cancel. 5. Choose Actions, View/edit source. 6. Download one of the following JSON files: • NGINX custom dashboard source on Github. • App Mesh custom dashboard source on Github. • Memcached custom dashboard source on Github Container Insights Prometheus metrics monitoring 859 Amazon CloudWatch User Guide • HAProxy-Ingress custom dashboard source on Github • Java/JMX custom dashboard source on Github. 7. Open the JSON file that you downloaded with a text editor, and make the following changes: • Replace all the {{YOUR_CLUSTER_NAME}} strings with the exact name of your cluster. Make sure not to add whitespaces before or after the text. • Replace all the {{YOUR_REGION}} strings with the AWS Region where your cluster is running. For example, us-west-1 Make sure not to add whitespaces before or after the text. • Replace all the {{YOUR_NAMESPACE}} strings with the exact namespace of your workload. • Replace all the {{YOUR_SERVICE_NAME}} strings with the exact service name of your workload. For example, haproxy-haproxy-ingress-controller-metrics 8. Copy the entire JSON blob and paste it into the text box in the CloudWatch console, replacing what is already in the box. 9. Choose Update, Save dashboard. Prometheus metrics troubleshooting This section provides help for troubleshooting your Prometheus metrics setup. Topics • Prometheus metrics troubleshooting on Amazon ECS • Prometheus metrics troubleshooting on Amazon EKS and Kubernetes clusters Prometheus metrics troubleshooting on Amazon ECS This section provides help for troubleshooting your Prometheus metrics setup on Amazon ECS clusters. I don't see Prometheus metrics sent to CloudWatch Logs The Prometheus metrics should be ingested as log events in the log group /aws/ecs/ containerinsights/cluster-name/Prometheus. If the log group is not created or the Prometheus metrics are not sent to the log group, you will need to first check whether the Prometheus targets have been successfully discovered by the CloudWatch agent. And next check the security group and permission settings of the CloudWatch agent. The following steps guide you to do the debugging. Container Insights Prometheus metrics monitoring 860 Amazon CloudWatch User Guide Step 1: Enable the CloudWatch agent debugging mode First, change the CloudWatch agent to debug mode by adding the following bold lines to your AWS CloudFormation template file, cwagent-ecs-prometheus-metric-for-bridge-host.yaml or cwagent-ecs-prometheus-metric-for-awsvpc.yaml. Then save the file. cwagentconfig.json: | { "agent": { "debug": true }, "logs": { "metrics_collected": { Create a new AWS CloudFormation changeset against the existing stack. Set other parameters in the changeset to the same values as in your existing AWS CloudFormation stack. The following example is for a CloudWatch agent installed in an Amazon ECS cluster using the EC2 launch type and the bridge network mode. ECS_NETWORK_MODE=bridge CREATE_IAM_ROLES=True ECS_TASK_ROLE_NAME=your_selected_ecs_task_role_name ECS_EXECUTION_ROLE_NAME=your_selected_ecs_execution_role_name NEW_CHANGESET_NAME=your_selected_ecs_execution_role_name aws cloudformation create-change-set --stack-name CWAgent-Prometheus-ECS- ${ECS_CLUSTER_NAME}-EC2-${ECS_NETWORK_MODE} \ --template-body file://cwagent-ecs-prometheus-metric-for-bridge-host.yaml \ --parameters ParameterKey=ECSClusterName,ParameterValue=$ECS_CLUSTER_NAME \ ParameterKey=CreateIAMRoles,ParameterValue=$CREATE_IAM_ROLES \ ParameterKey=ECSNetworkMode,ParameterValue=$ECS_NETWORK_MODE \ ParameterKey=TaskRoleName,ParameterValue=$ECS_TASK_ROLE_NAME \ ParameterKey=ExecutionRoleName,ParameterValue=$ECS_EXECUTION_ROLE_NAME \ --capabilities CAPABILITY_NAMED_IAM \ --region $AWS_REGION \ --change-set-name $NEW_CHANGESET_NAME Go to the AWS CloudFormation console to review the new changeset, $NEW_CHANGESET_NAME. There should be one change applied to the CWAgentConfigSSMParameter resource. Execute the changeset and restart the CloudWatch agent task by entering the following commands. Container Insights Prometheus metrics monitoring 861 Amazon CloudWatch User Guide aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 0 \ --service your_service_name_here \ --region $AWS_REGION Wait about 10 seconds and then enter the following command. aws ecs update-service --cluster $ECS_CLUSTER_NAME \ --desired-count 1 \ --service your_service_name_here \ --region $AWS_REGION Step 2: Check the ECS service discovery logs The ECS task definition of the CloudWatch agent enables the logs by default in the section below. The logs are sent to CloudWatch Logs in the log group /ecs/ecs-cwagent-prometheus. LogConfiguration: LogDriver: awslogs Options: awslogs-create-group: 'True' awslogs-group: "/ecs/ecs-cwagent-prometheus" awslogs-region: !Ref AWS::Region awslogs-stream-prefix: !Sub 'ecs-${ECSLaunchType}-awsvpc' Filter the logs by the string ECS_SD_Stats to get the metrics related to the ECS service discovery, as shown in the following example. 2020-09-1T01:53:14Z D! ECS_SD_Stats: AWSCLI_DescribeContainerInstances: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: AWSCLI_DescribeInstancesRequest: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: AWSCLI_DescribeTaskDefinition: 2 2020-09-1T01:53:14Z D! ECS_SD_Stats: AWSCLI_DescribeTasks: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: AWSCLI_ListTasks: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: Exporter_DiscoveredTargetCount: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Get_EC2MetaData: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Get_TaskDefinition: 2 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Size_ContainerInstance: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Size_TaskDefinition: 2 2020-09-1T01:53:14Z D! ECS_SD_Stats: Latency: 43.399783ms The meaning of each metric for a particular ECS service discovery cycle is as follows: Container Insights Prometheus metrics monitoring 862 Amazon CloudWatch User Guide • AWSCLI_DescribeContainerInstances – the number of ECS::DescribeContainerInstances API calls made. • AWSCLI_DescribeInstancesRequest – the number of ECS::DescribeInstancesRequest API calls made. • AWSCLI_DescribeTaskDefinition – the number of ECS::DescribeTaskDefinition API calls made. • AWSCLI_DescribeTasks – the number of ECS::DescribeTasks API calls made. • AWSCLI_ListTasks – the number of ECS::ListTasks API calls made. • ExporterDiscoveredTargetCount – the number of Prometheus targets |
acw-ug-264 | acw-ug.pdf | 264 | LRUCache_Get_TaskDefinition: 2 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Size_ContainerInstance: 1 2020-09-1T01:53:14Z D! ECS_SD_Stats: LRUCache_Size_TaskDefinition: 2 2020-09-1T01:53:14Z D! ECS_SD_Stats: Latency: 43.399783ms The meaning of each metric for a particular ECS service discovery cycle is as follows: Container Insights Prometheus metrics monitoring 862 Amazon CloudWatch User Guide • AWSCLI_DescribeContainerInstances – the number of ECS::DescribeContainerInstances API calls made. • AWSCLI_DescribeInstancesRequest – the number of ECS::DescribeInstancesRequest API calls made. • AWSCLI_DescribeTaskDefinition – the number of ECS::DescribeTaskDefinition API calls made. • AWSCLI_DescribeTasks – the number of ECS::DescribeTasks API calls made. • AWSCLI_ListTasks – the number of ECS::ListTasks API calls made. • ExporterDiscoveredTargetCount – the number of Prometheus targets that were discovered and successfully exported into the target result file within the container. • LRUCache_Get_EC2MetaData – the number of times that container instances metadata was retrieved from the cache. • LRUCache_Get_TaskDefinition – the number of times that ECS task definition metadata was retrieved from the cache. • LRUCache_Size_ContainerInstance – the number of unique container instance's metadata cached in memory. • LRUCache_Size_TaskDefinition – the number of unique ECS task definitions cached in memory. • Latency – how long the service discovery cycle takes. Check the value of ExporterDiscoveredTargetCount to see whether the discovered Prometheus targets match your expectations. If not, the possible reasons are as follows: • The configuration of ECS service discovery might not match your application's setting. For the docker label-based service discovery, your target containers may not have the necessary docker label configured in the CloudWatch agent to auto discover them. For the ECS task definition ARN regular expression-based service discovery, the regex setting in the CloudWatch agent may not match your application’s task definition. • The CloudWatch agent’s ECS task role might not have permission to retrieve the metadata of ECS tasks. Check that the CloudWatch agent has been granted the following read-only permissions: • ec2:DescribeInstances • ecs:ListTasks • ecs:DescribeContainerInstances • ecs:DescribeTasks Container Insights Prometheus metrics monitoring 863 Amazon CloudWatch User Guide • ecs:DescribeTaskDefinition Step 3: Check the network connection and the ECS task role policy If there are still no log events sent to the target CloudWatch Logs log group even though the value of Exporter_DiscoveredTargetCount indicates that there are discovered Prometheus targets, this could be caused by one of the following: • The CloudWatch agent might not be able to connect to the Prometheus target ports. Check the security group setting behind the CloudWatch agent. The private IP should alow the CloudWatch agent to connect to the Prometheus exporter ports. • The CloudWatch agent’s ECS task role might not have the CloudWatchAgentServerPolicy managed policy. The CloudWatch agent’s ECS task role needs to have this policy to be able to send the Prometheus metrics as log events. If you used the sample AWS CloudFormation template to create the IAM roles automatically, both the ECS task role and the ECS execution role are granted with the least privilege to perform the Prometheus monitoring. Prometheus metrics troubleshooting on Amazon EKS and Kubernetes clusters This section provides help for troubleshooting your Prometheus metrics setup on Amazon EKS and Kubernetes clusters. General troubleshooting steps on Amazon EKS To confirm that the CloudWatch agent is running, enter the following command. kubectl get pod -n amazon-cloudwatch The output should include a row with cwagent-prometheus-id in the NAME column and Running in the STATUS column. To display details about the running pod, enter the following command. Replace pod-name with the complete name of your pod that has a name that starts with cw-agent-prometheus. kubectl describe pod pod-name -n amazon-cloudwatch If you have CloudWatch Container Insights installed, you can use CloudWatch Logs Insights to query the logs from the CloudWatch agent collecting the Prometheus metrics. Container Insights Prometheus metrics monitoring 864 Amazon CloudWatch To query the application logs User Guide 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose CloudWatch Logs Insights. Select the log group for the application logs, /aws/containerinsights/cluster-name/ application 4. Replace the search query expression with the following query, and choose Run query fields ispresent(kubernetes.pod_name) as haskubernetes_pod_name, stream, kubernetes.pod_name, log | filter haskubernetes_pod_name and kubernetes.pod_name like /cwagent-prometheus You can also confirm that Prometheus metrics and metadata are being ingested as CloudWatch Logs events. To confirm that Prometheus data is being ingested 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose CloudWatch Logs Insights. Select the /aws/containerinsights/cluster-name/prometheus 4. Replace the search query expression with the following query, and choose Run query fields @timestamp, @message | sort @timestamp desc | limit 20 Logging dropped Prometheus metrics This release does not collect Prometheus metrics of the histogram type. You can use the CloudWatch agent to check whether any Prometheus metrics are being dropped because they are histogram metrics. You can also log a list of the first 500 Prometheus metrics that are dropped and not sent to CloudWatch because they are histogram metrics. |
acw-ug-265 | acw-ug.pdf | 265 | console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose CloudWatch Logs Insights. Select the /aws/containerinsights/cluster-name/prometheus 4. Replace the search query expression with the following query, and choose Run query fields @timestamp, @message | sort @timestamp desc | limit 20 Logging dropped Prometheus metrics This release does not collect Prometheus metrics of the histogram type. You can use the CloudWatch agent to check whether any Prometheus metrics are being dropped because they are histogram metrics. You can also log a list of the first 500 Prometheus metrics that are dropped and not sent to CloudWatch because they are histogram metrics. To see whether any metrics are being dropped, enter the following command: kubectl logs -l "app=cwagent-prometheus" -n amazon-cloudwatch --tail=-1 Container Insights Prometheus metrics monitoring 865 Amazon CloudWatch User Guide If any metrics are being dropped, you will see the following lines in the /opt/aws/amazon- cloudwatch-agent/logs/amazon-cloudwatch-agent.log file. I! Drop Prometheus metrics with unsupported types. Only Gauge, Counter and Summary are supported. I! Please enable CWAgent debug mode to view the first 500 dropped metrics If you see those lines and want to know what metrics are being dropped, use the following steps. To log a list of dropped Prometheus metrics 1. Change the CloudWatch agent to debug mode by adding the following bold lines to your prometheus-eks.yaml or prometheus-k8s.yamlfile, and save the file. { "agent": { "debug": true }, This section of the file should then look like this: cwagentconfig.json: | { "agent": { "debug": true }, "logs": { "metrics_collected": { 2. Reinstall the CloudWatch agent to enable debug mode by entering the following commands: kubectl delete deployment cwagent-prometheus -n amazon-cloudwatch kubectl apply -f prometheus.yaml The dropped metrics are logged in the CloudWatch agent pod. 3. To retrieve the logs from the CloudWatch agent pod, enter the following command: kubectl logs -l "app=cwagent-prometheus" -n amazon-cloudwatch --tail=-1 Container Insights Prometheus metrics monitoring 866 Amazon CloudWatch User Guide Or, if you have Container Insights Fluentd logging installed, the logs are also saved in the CloudWatch Logs log group /aws/containerinsights/cluster_name/application. To query these logs, you can follow the steps for querying the application logs in General troubleshooting steps on Amazon EKS. Where are the Prometheus metrics ingested as CloudWatch Logs log events? The CloudWatch agent creates a log stream for each Prometheus scrape job configuration. For example, in the prometheus-eks.yaml and prometheus-k8s.yaml files, the line job_name: 'kubernetes-pod-appmesh-envoy' scrapes App Mesh metrics. The Prometheus target is defined as kubernetes-pod-appmesh-envoy. So all App Mesh Prometheus metrics are ingested as CloudWatch Logs events in the log stream kubernetes-pod-appmesh-envoy under the log group named /aws/containerinsights/cluster-name/Prometheus. I don't see Amazon EKS or Kubernetes Prometheus metrics in CloudWatch metrics First, make sure that the Prometheus metrics are ingested as log events in the log group /aws/ containerinsights/cluster-name/Prometheus. Use the information in Where are the Prometheus metrics ingested as CloudWatch Logs log events? to help you check the target log stream. If the log stream is not created or there are no new log events in the log stream, check the following: • Check that the Prometheus metrics exporter endpoints are set up correctly • Check that the Prometheus scraping configurations in the config map: cwagent- prometheus section of the CloudWatch agent YAML file is correct. The configuration should be the same as it would be in a Prometheus configuration file. For more information, see <scrape_config> in the Prometheus documentation. If the Prometheus metrics are ingested as log events correctly, check that the embedded metric format settings are added into the log events to generate the CloudWatch metrics. "CloudWatchMetrics":[ { "Metrics":[ { "Name":"envoy_http_downstream_cx_destroy_remote_active_rq" } ], Container Insights Prometheus metrics monitoring 867 Amazon CloudWatch User Guide "Dimensions":[ [ "ClusterName", "Namespace" ] ], "Namespace":"ContainerInsights/Prometheus" } ], For more information about embedded metric format, see Specification: Embedded metric format. If there is no embedded metric format in the log events, check that the metric_declaration section is configured correctly in the config map: prometheus-cwagentconfig section of the CloudWatch agent installation YAML file. For more information, see Tutorial for adding a new Prometheus scrape target: Prometheus API Server metrics. Integration with Application Insights Amazon CloudWatch Application Insights helps you monitor your applications and identifies and sets up key metrics, logs, and alarms across your application resources and technology stack. For more information, see Detect common application problems with CloudWatch Application Insights. You can enable Application Insights to gather additional data from your containerized applications and microservices. If you haven't done this already, you can enable it by choosing Auto-configure Application Insights below the performance view in the Container Insights dashboard. If you have already set up CloudWatch Application Insights to monitor your containerized applications, the Application Insights dashboard appears below the Container Insights dashboard. For more information about Application Insights and containerized applications, see Enable Application Insights for Amazon ECS and Amazon EKS resource monitoring. Viewing |
acw-ug-266 | acw-ug.pdf | 266 | and technology stack. For more information, see Detect common application problems with CloudWatch Application Insights. You can enable Application Insights to gather additional data from your containerized applications and microservices. If you haven't done this already, you can enable it by choosing Auto-configure Application Insights below the performance view in the Container Insights dashboard. If you have already set up CloudWatch Application Insights to monitor your containerized applications, the Application Insights dashboard appears below the Container Insights dashboard. For more information about Application Insights and containerized applications, see Enable Application Insights for Amazon ECS and Amazon EKS resource monitoring. Viewing Amazon ECS lifecycle events within Container Insights You can view Amazon ECS lifecycle events within the Container Insights console. This helps you correlate your container metrics, logs, and events in a single view to give you a more complete operational visibility. The events include container instance state change events, task state change events, and service action events. They are automatically sent by Amazon ECS to Amazon EventBridge and are also Integration with Application Insights 868 Amazon CloudWatch User Guide collected in CloudWatch in event log format. For more information about these events, see Amazon ECS events. Standard Container Insights pricing applies for Amazon ECS Lifecycle events. For more information, see Amazon CloudWatch Pricing. To configure the table of lifecycle events and create rules for a cluster, you must have the events:PutRule, events:PutTargets, and logs:CreateLogGroup permissions. You must also make sure that there is a resource policy that enables EventBridge to create the log stream and send logs to CloudWatch Logs. If this resource policy doesn't exist, you can enter the following command to create it: aws --region region logs put-resource-policy --policy-name 'EventBridgeCloudWatchLogs' --policy-document '{ "Statement": [ { "Action": [ "logs:CreateLogStream", "logs:PutLogEvents" ], "Effect": "Allow", "Principal": { "Service": ["events.amazonaws.com", "delivery.logs.amazonaws.com"] }, "Resource": "arn:aws:logs:region:account-id:log-group:/aws/events/ecs/ containerinsights/*:*", "Sid": "TrustEventBridgeToStoreECSLifecycleLogEvents" } ], "Version": "2012-10-17" }' You can use the following command to check whether you already have this policy, and to confirm that attaching it worked correctly. aws logs describe-resource-policies --region region --output json To view the table of lifecycle events, you must have the events:DescribeRule, events:ListTargetsByRule, and logs:DescribeLogGroups permissions. Viewing Amazon ECS lifecycle events within Container Insights 869 Amazon CloudWatch User Guide To view Amazon ECS lifecycle events in the CloudWatch Container Insights console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose Insights, Container Insights. 3. Choose View performance dashboards. 4. 5. In the next drop-down, choose either ECS Clusters, ECS Services, or ECS Tasks. If you chose ECS Services or ECS Tasks in the previous step, choose the Lifecycle events tab. 6. At the bottom of the page, if you see Configure lifecycle events, choose it to create EventBridge rules for your cluster. The events are displayed below the container insights panes and above the Application Insights section. To run extra analytics and create additional visualizations on these events, choose View in Logs Insights in the Lifecycle Events table. Troubleshooting Container Insights The following sections can help if you're having trouble issues with Container Insights. Failed deployment on Amazon EKS or Kubernetes If the agent doesn't deploy correctly on a Kubernetes cluster, try the following: • Run the following command to get the list of pods. kubectl get pods -n amazon-cloudwatch • Run the following command and check the events at the bottom of the output. kubectl describe pod pod-name -n amazon-cloudwatch • Run the following command to check the logs. kubectl logs pod-name -n amazon-cloudwatch Unauthorized panic: Cannot retrieve cadvisor data from kubelet If your deployment fails with the error Unauthorized panic: Cannot retrieve cadvisor data from kubelet, your kubelet might not have Webhook authorization mode enabled. This Troubleshooting Container Insights 870 Amazon CloudWatch User Guide mode is required for Container Insights. For more information, see Verifying prerequisites for Container Insights in CloudWatch. Deploying Container Insights on a deleted and re-created cluster on Amazon ECS If you delete an existing Amazon ECS cluster that does not have Container Insights enabled, and you re-create it with the same name, you can't enable Container Insights on this new cluster at the time you re-create it. You can enable it by re-creating it, and then entering the following command: aws ecs update-cluster-settings --cluster myCICluster --settings name=container Insights,value=enabled Invalid endpoint error If you see an error message similar to the following, check to make sure that you replaced all the placeholders such as cluster-name and region-name in the commands that you are using with the correct information for your deployment. "log": "2020-04-02T08:36:16Z E! cloudwatchlogs: code: InvalidEndpointURL, message: invalid endpoint uri, original error: &url.Error{Op:\"parse\", URL:\"https:// logs.{{region_name}}.amazonaws.com/\", Err:\"{\"}, &awserr.baseError{code: \"InvalidEndpointURL\", message:\"invalid endpoint uri\", errs:[]error{(*url.Error) (0xc0008723c0)}}\n", Metrics don't appear in the console If you don't see any Container Insights metrics in the AWS Management Console, be sure that you have completed the setup of Container Insights. Metrics don't |
acw-ug-267 | acw-ug.pdf | 267 | --settings name=container Insights,value=enabled Invalid endpoint error If you see an error message similar to the following, check to make sure that you replaced all the placeholders such as cluster-name and region-name in the commands that you are using with the correct information for your deployment. "log": "2020-04-02T08:36:16Z E! cloudwatchlogs: code: InvalidEndpointURL, message: invalid endpoint uri, original error: &url.Error{Op:\"parse\", URL:\"https:// logs.{{region_name}}.amazonaws.com/\", Err:\"{\"}, &awserr.baseError{code: \"InvalidEndpointURL\", message:\"invalid endpoint uri\", errs:[]error{(*url.Error) (0xc0008723c0)}}\n", Metrics don't appear in the console If you don't see any Container Insights metrics in the AWS Management Console, be sure that you have completed the setup of Container Insights. Metrics don't appear before Container Insights has been set up completely. For more information, see Setting up Container Insights. Pod metrics missing on Amazon EKS or Kubernetes after upgrading cluster This section might be useful if all or some pod metrics are missing after you deploy the CloudWatch agent as a daemonset on a new or upgraded cluster, or you see an error log with the message W! No pod metric collected. These errors can be caused by changes in the container runtime, such as containerd or the docker systemd cgroup driver. You can usually solve this by updating your deployment manifest so that the containerd socket from the host is mounted into the container. See the following example: Troubleshooting Container Insights 871 Amazon CloudWatch User Guide # For full example see https://github.com/aws-samples/amazon-cloudwatch-container- insights/blob/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/ container-insights-monitoring/cwagent/cwagent-daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: cloudwatch-agent namespace: amazon-cloudwatch spec: template: spec: containers: - name: cloudwatch-agent # ... # Don't change the mountPath volumeMounts: # ... - name: dockersock mountPath: /var/run/docker.sock readOnly: true - name: varlibdocker mountPath: /var/lib/docker readOnly: true - name: containerdsock # NEW mount mountPath: /run/containerd/containerd.sock readOnly: true # ... volumes: # ... - name: dockersock hostPath: path: /var/run/docker.sock - name: varlibdocker hostPath: path: /var/lib/docker - name: containerdsock # NEW volume hostPath: path: /run/containerd/containerd.sock No pod metrics when using Bottlerocket for Amazon EKS Bottlerocket is a Linux-based open source operating system that is purpose-built by AWS for running containers. Troubleshooting Container Insights 872 Amazon CloudWatch User Guide Bottlerocket uses a different containerd path on the host, so you need to change the volumes to its location. If you don't, you see an error in the logs that includes W! No pod metric collected. See the following example. volumes: # ... - name: containerdsock hostPath: # path: /run/containerd/containerd.sock # bottlerocket does not mount containerd sock at normal place # https://github.com/bottlerocket-os/bottlerocket/ commit/91810c85b83ff4c3660b496e243ef8b55df0973b path: /run/dockershim.sock No container filesystem metrics when using the containerd runtime for Amazon EKS or Kubernetes This is a known issue and is being worked on by community contributors. For more information, see Disk usage metric for containerd and container file system metrics is not supported by cadvisor for containerd on GitHub. Unexpected log volume increase from CloudWatch agent when collecting Prometheus metrics This was a regression introduced in version 1.247347.6b250880 of the CloudWatch agent. This regression has already been fixed in more recent versions of the agent. It's impact was limited to scenarios where customers collected the logs of the CloudWatch agent itself and were also using Prometheus. For more information, see [prometheus] agent is printing all the scraped metrics in log on GitHub. Latest docker image mentioned in release notes not found from Dockerhub We update the release note and tag on Github before we start the actual release internally. It usually takes 1-2 weeks to see the latest docker image on registries after we bump the version number on Github. There is no nightly release for the CloudWatch agent container image. You can build the image directly from source at the following location: https://github.com/aws/ amazon-cloudwatch-agent/tree/main/amazon-cloudwatch-container-insights/cloudwatch-agent- dockerfile Troubleshooting Container Insights 873 Amazon CloudWatch User Guide CrashLoopBackoff error on the CloudWatch agent If you see a CrashLoopBackOff error for the CloudWatch agent, make sure that your IAM permissions are set correctly. For more information, see Verifying prerequisites for Container Insights in CloudWatch. CloudWatch agent or Fluentd pod stuck in pending If you have a CloudWatch agent or Fluentd pod stuck in Pending or with a FailedScheduling error, determine if your nodes have enough compute resources based on the number of cores and amount of RAM required by the agents. Enter the following command to describe the pod: kubectl describe pod cloudwatch-agent-85ppg -n amazon-cloudwatch Building your own CloudWatch agent Docker image You can build your own CloudWatch agent Docker image by referring to the Dockerfile located at https://github.com/aws-samples/amazon-cloudwatch-container-insights/blob/latest/cloudwatch- agent-dockerfile/Dockerfile. The Dockerfile supports building multi-architecture images directly using docker buildx. Deploying other CloudWatch agent features in your containers You can deploy additional monitoring features in your containers using the CloudWatch agent. These features include the following: • Embedded Metric Format— For more information, see Embedding metrics within logs. • StatsD— For more information, see Retrieve custom metrics with StatsD. Instructions and necessary files are located on |
acw-ug-268 | acw-ug.pdf | 268 | describe the pod: kubectl describe pod cloudwatch-agent-85ppg -n amazon-cloudwatch Building your own CloudWatch agent Docker image You can build your own CloudWatch agent Docker image by referring to the Dockerfile located at https://github.com/aws-samples/amazon-cloudwatch-container-insights/blob/latest/cloudwatch- agent-dockerfile/Dockerfile. The Dockerfile supports building multi-architecture images directly using docker buildx. Deploying other CloudWatch agent features in your containers You can deploy additional monitoring features in your containers using the CloudWatch agent. These features include the following: • Embedded Metric Format— For more information, see Embedding metrics within logs. • StatsD— For more information, see Retrieve custom metrics with StatsD. Instructions and necessary files are located on GitHub at the following locations: • For Amazon ECS containers, see Example Amazon ECS task definitions based on deployment modes. • For Amazon EKS and Kubernetes containers, see Example Kubernetes YAML files based on deployment modes. Building your own CloudWatch agent Docker image 874 Amazon CloudWatch Lambda Insights User Guide CloudWatch Lambda Insights is a monitoring and troubleshooting solution for serverless applications running on AWS Lambda. The solution collects, aggregates, and summarizes system- level metrics including CPU time, memory, disk, and network. It also collects, aggregates, and summarizes diagnostic information such as cold starts and Lambda worker shutdowns to help you isolate issues with your Lambda functions and resolve them quickly. Lambda Insights uses a new CloudWatch Lambda extension, which is provided as a Lambda layer. When you install this extension on a Lambda function, it collects system-level metrics and emits a single performance log event for every invocation of that Lambda function. CloudWatch uses embedded metric formatting to extract metrics from the log events. For more information about Lambda extensions, see Using AWS Lambda extensions. For more information about embedded metric format, see Embedding metrics within logs. You can use Lambda Insights with any Lambda function that uses a Lambda runtime that supports Lambda extensions. For a list of these runtimes, see Lambda Extensions API. Pricing For each Lambda function enabled for Lambda Insights, you only pay for what you use for metrics and logs. For a pricing example, see Amazon CloudWatch Pricing. You are charged for the execution time consumed by the Lambda extension, in 1ms increments. For more information about Lambda pricing, see AWS Lambda Pricing. Get started with Lambda Insights To enable Lambda Insights on a Lambda function, you can use a one-click toggle in the Lambda console. Alternatively, you can use the AWS CLI, AWS CloudFormation, the AWS Serverless Application Model CLI, or the AWS Cloud Development Kit (AWS CDK). The following sections provide detailed instructions for completing these steps. Topics • Available versions of the Lambda Insights extension • Using the console to enable Lambda Insights on an existing Lambda function • Use the AWS CLI to enable Lambda Insights on an existing Lambda function Lambda Insights 875 Amazon CloudWatch User Guide • Use the AWS SAM CLI to enable Lambda Insights on an existing Lambda function • Use AWS CloudFormation to enable Lambda Insights on an existing Lambda function • Use the AWS CDK to enable Lambda Insights on an existing Lambda function • Use Serverless Framework to enable Lambda Insights on an existing Lambda function • Enable Lambda Insights on a Lambda container image deployment • Update the Lambda Insights extension version on a function Available versions of the Lambda Insights extension This section lists the versions of the Lambda Insights extension, and the ARNs to use for these extensions in each AWS Region. Topics • x86-64 platforms • ARM64 platforms x86-64 platforms This section lists the versions of the Lambda Insights extension for x86-64 platforms, and the ARNs to use for these extensions in each AWS Region. Important Lambda Insights extensions 1.0.317.0 and later don't support Amazon Linux 1. 1.0.404.0 Version 1.0.404.0 reduces the binary size of the Lambda Insights extension from ~10MB to ~6MB, and subsequently reduces the zip size of the Lambda Insights extension layer from ~4MB to ~2.7MB. It also reduces the overall memory consumption of the agent from ~10MB to ~7MB. ARNs for version 1.0.404.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Get started with Lambda Insights 876 Amazon CloudWatch User Guide Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:56 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:56 US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:56 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:56 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:47 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:761018874580:la yer:LambdaInsightsExtension:3 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:47 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:29 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:33 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:590183865173:la yer:LambdaInsightsExtension:4 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:24 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:54 Get started with Lambda Insights 877 Amazon CloudWatch User Guide Region ARN Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:37 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:55 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:56 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:56 Asia |
acw-ug-269 | acw-ug.pdf | 269 | Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:56 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:56 US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:56 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:56 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:47 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:761018874580:la yer:LambdaInsightsExtension:3 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:47 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:29 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:33 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:590183865173:la yer:LambdaInsightsExtension:4 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:24 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:54 Get started with Lambda Insights 877 Amazon CloudWatch User Guide Region ARN Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:37 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:55 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:56 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:56 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:83 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:55 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:16 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:46 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:46 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:56 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:56 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:56 Get started with Lambda Insights 878 Amazon CloudWatch User Guide Region ARN Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:47 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:55 Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:31 Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:53 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:30 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:23 Mexico (Central) arn:aws:lambda:mx-central-1:879381266642:laye r:LambdaInsightsExtension:3 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:47 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:30 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:55 arn:aws-us-gov:lambda:us-gov-east-1:122132214 140:layer:LambdaInsightsExtension:24 arn:aws-us-gov:lambda:us-gov-west-1:751350123 760:layer:LambdaInsightsExtension:24 Get started with Lambda Insights 879 Amazon CloudWatch 1.0.391.0 Important User Guide Version 1.0.391.0 changes how Lambda Insights collects and reports thread usage. In previous versions of the extension, the threads_max metric reported the maximum number of threads running in the process that has the process ID of 1. Starting with version 1.0.391.0, this metric reports the maximum number of threads that were running at any point of time during the function’s execution, across all processes in the execution environment. This includes the Lambda function's processes, extensions' processes, system/runtime specific processes, and so on. This makes the threads_max metric more comprehensive while assessing the remaining threads left for your use. For more information about thread and process quotas, see Lambda quotas. Version 1.0.391.0 also adds support for the Asia Pacific (Thailand) and Mexico (Central) Regions. ARNs for version 1.0.391.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:55 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:55 US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:55 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:55 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:46 Get started with Lambda Insights 880 Amazon CloudWatch User Guide Region ARN Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:761018874580:la yer:LambdaInsightsExtension:2 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:46 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:28 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:32 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:590183865173:la yer:LambdaInsightsExtension:3 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:23 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:53 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:36 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:54 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:55 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:55 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:82 Get started with Lambda Insights 881 Amazon CloudWatch User Guide Region ARN Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:54 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:15 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:45 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:45 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:55 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:55 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:55 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:46 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:54 Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:30 Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:52 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:29 Get started with Lambda Insights 882 Amazon CloudWatch User Guide Region ARN Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:23 Mexico (Central) arn:aws:lambda:mx-central-1:879381266642:laye r:LambdaInsightsExtension:2 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:46 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:29 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:54 arn:aws-us-gov:lambda:us-gov-east-1:122132214 140:layer:LambdaInsightsExtension:23 arn:aws-us-gov:lambda:us-gov-west-1:751350123 760:layer:LambdaInsightsExtension:23 1.0.333.0 Version 1.0.333.0 includes bug fixes. ARNs for version 1.0.333.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:53 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:53 Get started with Lambda Insights 883 Amazon CloudWatch User Guide Region ARN US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:53 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:53 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:44 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:44 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:26 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:30 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:590183865173:la yer:LambdaInsightsExtension:1 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:21 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:51 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:34 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:52 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:53 Get started with Lambda Insights 884 Amazon CloudWatch User Guide Region ARN Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:53 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:80 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:52 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:13 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:43 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:43 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:53 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:53 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:53 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:44 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:52 Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:28 Get started with Lambda Insights 885 Amazon CloudWatch User Guide Region ARN Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:50 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:27 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:21 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:44 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:27 arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:52 arn:aws-us-gov:lambda:us-gov-east-1:122132214 140:layer:LambdaInsightsExtension:21 |
acw-ug-270 | acw-ug.pdf | 270 | with Lambda Insights 884 Amazon CloudWatch User Guide Region ARN Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:53 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:80 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:52 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:13 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:43 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:43 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:53 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:53 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:53 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:44 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:52 Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:28 Get started with Lambda Insights 885 Amazon CloudWatch User Guide Region ARN Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:50 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:27 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:21 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:44 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:27 arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:52 arn:aws-us-gov:lambda:us-gov-east-1:122132214 140:layer:LambdaInsightsExtension:21 arn:aws-us-gov:lambda:us-gov-west-1:751350123 760:layer:LambdaInsightsExtension:21 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) 1.0.317.0 Version 1.0.317.0 includes the removal of support for the Amazon Linux 1 platform, and bug fixes. It also includes support for AWS GovCloud (US) Regions. ARNs for version 1.0.317.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Get started with Lambda Insights 886 Amazon CloudWatch User Guide Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:52 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:52 US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:52 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:52 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:43 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:43 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:25 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:29 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:20 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:50 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:33 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:51 Get started with Lambda Insights 887 Amazon CloudWatch User Guide Region ARN Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:52 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:52 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:79 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:51 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:12 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:42 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:42 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:52 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:52 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:52 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:43 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:51 Get started with Lambda Insights 888 Amazon CloudWatch User Guide Region ARN Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:27 Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:49 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:26 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:20 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:43 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:26 arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:51 arn:aws-us-gov:lambda:us-gov-east-1:122132214 140:layer:LambdaInsightsExtension:19 arn:aws-us-gov:lambda:us-gov-west-1:751350123 760:layer:LambdaInsightsExtension:19 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) 1.0.295.0 Version 1.0.295.0 includes dependency updates for all the compatible runtimes. ARNs for version 1.0.295.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Get started with Lambda Insights 889 Amazon CloudWatch User Guide Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:51 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:51 US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:51 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:51 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:42 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:42 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:24 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:28 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:19 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:49 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:32 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:50 Get started with Lambda Insights 890 Amazon CloudWatch User Guide Region ARN Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:51 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:51 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:78 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:50 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:11 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:41 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:41 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:51 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:51 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:51 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:42 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:50 Get started with Lambda Insights 891 Amazon CloudWatch User Guide Region ARN Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:26 Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:48 Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:25 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:19 Middle East (Bahrain) arn:aws:lambda:me-south-1:285320876703:layer: LambdaInsightsExtension:42 Middle East (UAE) arn:aws:lambda:me-central-1:732604637566:laye r:LambdaInsightsExtension:25 South America (São Paulo) arn:aws:lambda:sa-east-1:580247275435:layer:L ambdaInsightsExtension:50 1.0.275.0 Version 1.0.275.0 includes important dependency updates for all the compatible runtimes. ARNs for version 1.0.275.0 The following table lists the ARNs to use for this version of the extension in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:580247275435:layer:L ambdaInsightsExtension:49 US East (Ohio) arn:aws:lambda:us-east-2:580247275435:layer:L ambdaInsightsExtension:49 Get started with Lambda Insights 892 Amazon CloudWatch User Guide Region ARN US West (N. Californi a) arn:aws:lambda:us-west-1:580247275435:layer:L ambdaInsightsExtension:49 US West (Oregon) arn:aws:lambda:us-west-2:580247275435:layer:L ambdaInsightsExtension:49 Africa (Cape Town) arn:aws:lambda:af-south-1:012438385374:layer: LambdaInsightsExtension:40 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:519774774795:layer:L ambdaInsightsExtension:40 arn:aws:lambda:ap-south-2:891564319516:layer: LambdaInsightsExtension:22 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:439286490199:la yer:LambdaInsightsExtension:26 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:158895979263:la yer:LambdaInsightsExtension:17 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:580247275435:layer: LambdaInsightsExtension:47 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:194566237122:la yer:LambdaInsightsExtension:30 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:580247275435:la yer:LambdaInsightsExtension:48 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:580247275435:la yer:LambdaInsightsExtension:49 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:580247275435:la yer:LambdaInsightsExtension:49 Get started with Lambda Insights 893 Amazon CloudWatch User Guide Region ARN Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:580247275435:la yer:LambdaInsightsExtension:76 Canada (Central) arn:aws:lambda:ca-central-1:580247275435:laye r:LambdaInsightsExtension:48 Canada West (Calgary) arn:aws:lambda:ca-west-1:946466191631:layer:L ambdaInsightsExtension:9 China (Beijing) arn:aws-cn:lambda:cn-north-1:488211338238:lay er:LambdaInsightsExtension:39 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:488211338238 :layer:LambdaInsightsExtension:39 Europe (Frankfurt) arn:aws:lambda:eu-central-1:580247275435:laye r:LambdaInsightsExtension:49 Europe (Ireland) arn:aws:lambda:eu-west-1:580247275435:layer:L ambdaInsightsExtension:49 Europe (London) arn:aws:lambda:eu-west-2:580247275435:layer:L ambdaInsightsExtension:49 Europe (Milan) arn:aws:lambda:eu-south-1:339249233099:layer: LambdaInsightsExtension:40 Europe (Paris) arn:aws:lambda:eu-west-3:580247275435:layer:L ambdaInsightsExtension:48 Europe (Spain) arn:aws:lambda:eu-south-2:352183217350:layer: LambdaInsightsExtension:24 Europe (Stockholm) arn:aws:lambda:eu-north-1:580247275435:layer: LambdaInsightsExtension:46 Get started with Lambda Insights 894 Amazon CloudWatch User Guide Region ARN Europe (Zurich) arn:aws:lambda:eu-central-2:033019950311:laye r:LambdaInsightsExtension:23 Israel (Tel Aviv) arn:aws:lambda:il-central-1:459530977127:laye r:LambdaInsightsExtension:17 Middle East (Bahrain) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.