A prometheus exporter providing metrics for AWS EC2 compute resource specifications and capacity profiling.
Exposes compute resource statistics of AWS EC2 machine instance-types, images and regions from the AWS EC2 API to a Prometheus compatible endpoint.
The application can be run in a number of ways, the main consumption is the Docker hub image 0x0I.aws-ec2-exporter
.
Required
AWS_ACCESS_KEY_ID
- API access key id of your AWS cloud accountAWS_SECRET_ACCESS_KEY
- API access key secret of your AWS cloud account
Optional
METRICS_PATH
- Path under which to expose metrics. Defaults to/metrics
LISTEN_PORT
- Port on which to expose metrics. Defaults to9686
REGION
- EC2 region to scrape. Defaults tous-east-1
LOG_LEVEL
- Set the logging level. Defaults toinfo
Run manually from Docker Hub:
docker run -d -e AWS_ACCESS_KEY_ID="XXXXXXXX" -e AWS_SECRET_ACCESS_KEY="XXXXXXX" -p 9686:9686 0labs/0x01.aws-ec2-exporter:<tag>
Scrape non-default AWS EC2 region and increase logging level:
docker run --detach --env AWS_ACCESS_KEY_ID="XXXXXXXX" \
--env AWS_SECRET_ACCESS_KEY="XXXXXXX" \
--env REGION=us-west-2 \
--env LOG_LEVEL=debug \
--publish 9686:9686 \
0labs/0x01.aws-ec2-exporter:<tag>
Build and run a local container image:
docker build --file build/Containerfile --tag <image-name> .
docker run -d -e AWS_ACCESS_KEY_ID="XXXXXXXX" -e AWS_SECRET_ACCESS_KEY="XXXXXXX" -p 9686:9686 <image-name>
version: "3"
services:
aws-exporter:
image: 0labs/0x01.aws-ec2-exporter:latest
container_name: aws-exporter
environment:
AWS_ACCESS_KEY_ID: "XXXXXXXXXXXX"
AWS_SECRET_ACCESS_KEY: "XXXXXXXXXXXXXX"
REGION: "us-west-2"
ports:
- 9686:9686
Metrics will be made available on port 9686
by default, or you can pass environment variable LISTEN_ADDRESS
to override this. An example printout of the metrics you should expect to see can be found in METRICS.md.