ECS Azure Lifecycle Monitor test
2.5K
AWS ECS Instance Protection | Azure DevOps Agent Monitor | Docker Container Activity Tracker | CI/CD Build Protection
Monitor Azure DevOps agents running in Docker containers and communicate with AWS ECS to prevent premature instance termination during active builds.
Docker Hub: https://hub.docker.com/r/hypolas/ecsazrlc
This tool watches Docker socket for Azure DevOps Agent container activity and informs AWS ECS about server activity, preventing termination of instances with running builds.
Keywords: AWS ECS, Azure DevOps, Azure Pipelines, Docker monitoring, instance lifecycle, CI/CD, container monitoring, build agent protection, AWS auto-scaling, spot instance protection
# Pull the latest image
docker pull hypolas/ecsazrlc:latest
# Run in monitoring-only mode
docker run -v /var/run/docker.sock:/var/run/docker.sock:ro hypolas/ecsazrlc:latest --monitor-only
# Run with ECS integration
docker run -v /var/run/docker.sock:/var/run/docker.sock:ro \
-e AWS_REGION=us-east-1 \
hypolas/ecsazrlc:latest --enable-ecs --cluster my-cluster
Create a docker-compose.yml:
services:
ecsazrlc:
image: hypolas/ecsazrlc:latest
container_name: ecsazrlc
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- AWS_REGION=us-east-1
# Optional: for local dev/testing
# - AWS_ACCESS_KEY_ID=your-key
# - AWS_SECRET_ACCESS_KEY=your-secret
command:
- "--monitor-only"
# For ECS integration, use:
# - "--enable-ecs"
# - "--cluster"
# - "your-cluster-name"
# - "--heartbeat"
# - "30s"
Then run:
# Start
docker-compose up -d
# View logs
docker-compose logs -f ecsazrlc
# Stop
docker-compose down
# Build and start
podman compose up -d
# View logs
podman compose logs -f ecsazrlc
go build -o ecsazrlc ./cmd
./ecsazrlc --monitor-only
./ecsazrlc --monitor-only --verbose
./ecsazrlc --enable-ecs --cluster my-cluster --heartbeat 30s
BUILD.md - Complete build and deployment guide
CREDENTIALS.md - AWS credentials configuration
TESTING.md - Testing guide
┌─────────────────────┐ ┌──────────────────┐
│ Docker Socket │────────▶│ ecsazrlc │
│ (container events) │ │ (monitor) │
└─────────────────────┘ └────────┬─────────┘
│
┌────────▼─────────┐
│ AWS ECS API │
│ (heartbeat) │
└──────────────────┘
The EC2/ECS instance needs:
ecs:DescribeClustersecs:ListContainerInstancesecs:DescribeContainerInstancesecs:PutAttributesecs:UpdateContainerInstancesStateSee CREDENTIALS.md for details.
AWS_REGION - AWS region (default: us-east-1)AWS_DEFAULT_REGION - Alternative AWS regionAWS_PROFILE - AWS profile to use (default: default)DOCKER_HOST - Docker socket (default: unix:///var/run/docker.sock)--cluster - ECS cluster name (required in ECS mode)--heartbeat - Heartbeat interval (default: 30s)--enable-ecs - Enable ECS notifications--monitor-only - Monitoring-only mode without ECS--verbose - Verbose mode with detailed logsRun Azure Pipelines agents on AWS ECS infrastructure with automatic lifecycle management.
Use AWS spot instances for cost savings while ensuring running builds are never interrupted.
Scale Azure DevOps agent pools on AWS with ECS auto-scaling while protecting active build agents.
Contributions welcome! Please open an issue or pull request.
MIT
aws-ecs azure-devops azure-pipelines docker-monitoring ci-cd golang container-lifecycle instance-protection devops-automation hybrid-cloud spot-instances auto-scaling build-agents docker-events ecs-heartbeat
Content type
Image
Digest
sha256:b4788fcbd…
Size
10.8 MB
Last updated
12 months ago
docker pull hypolas/ecsazrlc