Skip to content

A prometheus exporter providing metrics for AWS EC2 compute resource specifications and capacity profiling

License

Notifications You must be signed in to change notification settings

O1ahmad/aws_ec2_exporter

Repository files navigation

Prometheus logo

aws logo

AWS EC2 ☁️ Exporter

A prometheus exporter providing metrics for AWS EC2 compute resource specifications and capacity profiling.

GitHub release (latest by date) Docker Pulls Go Report Card License: MIT

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:

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>

Docker compose

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

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.

About

A prometheus exporter providing metrics for AWS EC2 compute resource specifications and capacity profiling

Resources

License

Stars

Watchers

Forks

Packages

No packages published