![prometheus Prometheus logo](https://cdn.worldvectorlogo.com/logos/prometheus.svg)
![aws aws logo](https://adamtheautomator.com/content/images/2019/07/prod-art-aws-600-width-1200.png)
AWS EC2 ☁ Exporter
A prometheus exporter providing metrics for AWS EC2 compute resource specifications and capacity profiling.
![](https://img.shields.io/badge/License-MIT-blueviolet.svg)
Exposes compute resource statistics of AWS EC2 machine instance-types, images and regions from the AWS EC2 API to a Prometheus compatible endpoint.
Description
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 account
AWS_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 to 9686
REGION
- EC2 region to scrape. Defaults to us-east-1
LOG_LEVEL
- Set the logging level. Defaults to info
Install and deploy
Run manually from Docker Hub:
podman 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:
podman 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 a container image:
podman build --file build/Containerfile --tag <image-name> .
podman run -d -e AWS_ACCESS_KEY_ID="XXXXXXXX" -e AWS_SECRET_ACCESS_KEY="XXXXXXX" -p 9686:9686 <image-name>
Docker compose
aws-ec2-exporter:
tty: true
stdin_open: true
environment:
- AWS_ACCESS_KEY_ID="XXXXXXXX"
- AWS_SECRET_ACCESS_KEY="XXXXXXX"
expose:
- 9686:9686
image: 0labs/0x01.aws-ec2-exporter:<tag>
Metrics
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.