https://github.com/lob/nomad-autoscaler-cloudwatch-apm
Nomad Autoscaler APM Plugin for AWS Cloudwatch
https://github.com/lob/nomad-autoscaler-cloudwatch-apm
autoscaler nomad team-platform
Last synced: 7 days ago
JSON representation
Nomad Autoscaler APM Plugin for AWS Cloudwatch
- Host: GitHub
- URL: https://github.com/lob/nomad-autoscaler-cloudwatch-apm
- Owner: lob
- License: mit
- Created: 2022-05-19T02:50:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T22:07:16.000Z (2 months ago)
- Last Synced: 2025-04-01T03:41:32.976Z (about 2 months ago)
- Topics: autoscaler, nomad, team-platform
- Language: Go
- Homepage:
- Size: 58.6 KB
- Stars: 7
- Watchers: 16
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Nomad Autoscaler CloudWatch APM
A Nomad Autoscaler APM plugin to scale Nomad jobs using CloudWatch Metrics.
**This software is in early development and should be used with caution.**
*Feedback and contributions are welcome :-)*
## Plugin Configuration
To use the plugin you will need to download the binary to the client nodes and add the following block into the Nomad Autoscaler configuration.
If the `aws_access_key_id` and `aws_secret_access_key` settings are omitted the plugin will use the instance role to authenticate with the CloudWatch API.
The IAM user or role requires the `cloudwatch:GetMetricData` permission.
```hcl
apm "cloudwatch" {
driver = "nomad-autoscaler-cloudwatch-apm"config = {
aws_region = "us-east-1"
aws_access_key_id = ""
aws_secret_access_key = ""
}
}```
## Policy Configuration
To scale a job with CloudWatch Metrics add the following block to your scaling policy. The query string is passed directly to the CloudWatch metrics API. Further details on the query syntax can be found in the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html).
```hcl
check "cloudwatch" {
source = "cloudwatch"
query = <<-QUERY
SELECT MAX(ApproximateNumberOfMessagesVisible) FROM SCHEMA("AWS/SQS", QueueName) WHERE QueueName = ''
QUERYstrategy "target-value" {
target = 50
}
}
```## Example
A Vagrant box with a working demo of the CloudWatch APM plugin has been provided in the [example](./example) folder.