Skip to content

feat(runners): Add CloudWatch agent for log shipping on all self-hosted runners#1105

Merged
ayush-panta merged 1 commit into
mainfrom
add-cloudwatch-agent-to-runners
Jun 16, 2026
Merged

feat(runners): Add CloudWatch agent for log shipping on all self-hosted runners#1105
ayush-panta merged 1 commit into
mainfrom
add-cloudwatch-agent-to-runners

Conversation

@ayush-panta

@ayush-panta ayush-panta commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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, as CloudWatchAgentServerPolicy not yet attached to live role until this deploys). CDK build and unit tests also pass.

  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…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>
@ayush-panta ayush-panta requested a review from a team as a code owner June 15, 2026 18:42
Comment thread scripts/setup-linux-runner.sh

@Swapnanil-Gupta Swapnanil-Gupta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ayush-panta ayush-panta merged commit a42d0f8 into main Jun 16, 2026
6 checks passed
@ayush-panta ayush-panta deleted the add-cloudwatch-agent-to-runners branch June 16, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants