Automated deployment and lifecycle management of AppDynamics Smart Agent across multiple EC2 hosts using GitHub Actions with a self-hosted runner.
This lab demonstrates how to use GitHub Actions to manage AppDynamics Smart Agent and various AppDynamics agents (Node, Machine, DB, Java) across multiple Ubuntu EC2 instances within a single AWS VPC. The project includes 11 automated workflows covering the complete agent lifecycle.
Key Features:
- 🚀 Parallel Deployment - Deploy to multiple hosts simultaneously
- 🔄 Complete Lifecycle Management - Install, uninstall, stop, and clean agents
- 🏗️ Infrastructure as Code - All workflows version-controlled
- 🔐 Secure - SSH key-based authentication, private VPC networking
- 📈 Massively Scalable - Deploy to thousands of hosts with automatic batching
- 🎛️ Self-hosted Runner - Executes within your AWS VPC
All infrastructure runs in a single AWS VPC with a shared security group. The self-hosted runner communicates with target hosts via private IPs.
View detailed architecture diagrams →
- AWS VPC with EC2 instances (Ubuntu)
- Self-hosted GitHub Actions runner in the same VPC
- SSH key pair for authentication
- AppDynamics Smart Agent package and config
git clone https://github.com/chambear2809/github-actions-lab.git
cd github-actions-labNavigate to: Settings → Secrets and variables → Actions
Required Secret:
SSH_PRIVATE_KEY- Your SSH private key (PEM format)
Navigate to: Settings → Secrets and variables → Actions → Variables
Required Variable:
DEPLOYMENT_HOSTS- Target host IPs (one per line)172.31.1.243 172.31.1.48 172.31.1.5
Optional Variables:
SMARTAGENT_USER- User for Smart Agent service (e.g.,appdynamics)SMARTAGENT_GROUP- Group for Smart Agent service (e.g.,appdynamics)
Via GitHub UI:
- Go to Actions tab
- Select "Deploy Smart Agent"
- Click "Run workflow"
- Optionally adjust batch size (default: 256)
- Click "Run workflow"
Via GitHub CLI:
gh workflow run "Deploy Smart Agent" --repo chambear2809/github-actions-lab
# With custom batch size
gh workflow run "Deploy Smart Agent" --repo chambear2809/github-actions-lab -f batch_size=128| Workflow | Description | Scale | Trigger |
|---|---|---|---|
| Deploy Smart Agent (Batched) | Installs Smart Agent and starts service | Any | Manual only |
| Workflow | Command | Scale | Trigger |
|---|---|---|---|
| Install Node Agent (Batched) | smartagentctl install node |
Any | Manual only |
| Install Machine Agent (Batched) | smartagentctl install machine |
Any | Manual only |
| Install DB Agent (Batched) | smartagentctl install db |
Any | Manual only |
| Install Java Agent (Batched) | smartagentctl install java |
Any | Manual only |
| Workflow | Command | Scale | Trigger |
|---|---|---|---|
| Uninstall Node Agent (Batched) | smartagentctl uninstall node |
Any | Manual only |
| Uninstall Machine Agent (Batched) | smartagentctl uninstall machine |
Any | Manual only |
| Uninstall DB Agent (Batched) | smartagentctl uninstall db |
Any | Manual only |
| Uninstall Java Agent (Batched) | smartagentctl uninstall java |
Any | Manual only |
| Workflow | Description | Scale | Trigger |
|---|---|---|---|
| Stop and Clean Smart Agent (Batched) | Stops service and purges data | Any | Manual only |
| Cleanup All Agents (Batched) | Deletes /opt/appdynamics directory | Any | Manual only |
Total: 11 workflows - All batched workflows support configurable batch sizes (default: 256)
- Deployment Guide - Complete setup and configuration instructions
- Architecture Diagrams - Visual infrastructure and workflow diagrams
- Developer pushes code or manually triggers a workflow
- GitHub Actions receives the event and assigns job to self-hosted runner
- Runner loads target hosts from GitHub variables
- Parallel Execution - Runner SSHs into each target host simultaneously
- Commands Execute - Install/uninstall/stop/clean operations run on each host
- Results Reported - Success/failure status sent back to GitHub
- Private Network - All communication via VPC private IPs
- SSH Keys - Stored securely as GitHub secrets
- No Public Access - Target hosts don't need public IPs
- Security Group - Restricts SSH access to runner only
All workflows use automatic batching to support any number of hosts:
- Automatic batching - Splits hosts into groups of 256 (configurable)
- Sequential batch processing - Avoids overwhelming runner resources
- Parallel within batch - Each batch processes all hosts simultaneously
- Works at any scale - 1 host to thousands
- Splits your host list into manageable batches
- Processes each batch as a separate job sequentially
- Deploys to all hosts within each batch in parallel using background processes
Examples:
- 10 hosts = 1 batch, all deploy in parallel
- 500 hosts = 2 batches × 256 hosts
- 1,000 hosts = 4 batches × 256 hosts
- 5,000 hosts = 20 batches × 256 hosts
This is a lab/demo project. Feel free to fork and adapt for your own use cases!
Built with ❤️ for AppDynamics automation