feat(runners): Add CloudWatch agent for log shipping on all self-hosted runners#1105
Merged
Merged
Conversation
…ed runners
Install and configure the CloudWatch agent on macOS, Windows, and Linux
self-hosted runners to ship system logs and runner diagnostics to
CloudWatch Logs. This enables diagnosis of runner failures (e.g.
ConnectionLost) without requiring SSH access to the instance.
Logs shipped:
- macOS: /var/log/system.log, runner diag, setup-runner.log
- Windows: Runner diag, UserData.log, StartupScript.log
- Linux: /var/log/messages, runner diag, setup-runner.log
Log groups: /ec2/runners/{repo}/{arch}-{version}
Retention: 30 days
Also adds CloudWatchAgentServerPolicy to the runner IAM role.
Signed-off-by: ayush-panta <ayushkp@amazon.com>
KlwntSingh
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes: Add CloudWatch agent to all self-hosted runners (macOS, Windows, Linux) to ship system logs and runner diagnostics to CloudWatch Logs. This enables diagnosis of runner failures (e.g.,
ConnectionLost) without requiring SSH/SSM access to the instance.Logs are available in the account associated with the runner, following a
/ec2/runners/{repo}/{arch}-{version}format for log group and{instance-id}/{log-name}for individual log stream. Logs are retained for 30 days.Testing done: Validated on live instances in prod (
090529234398, us-west-2) via SSM. All agents started successfully. Log delivery fails only on IAM permissions (this is expected, asCloudWatchAgentServerPolicynot yet attached to live role until this deploys). CDK build and unit tests also pass.License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.