Retrieves a count of resources from AWS accounts using AWS resource explorer and expose as metrics R
10K+
Retrieves a count of resources from AWS accounts using AWS resource explorer and expose as metrics
Requires AWS resource explorer configured with a view
Run the following commands from the root directory to build the project:
mkdir bin
cd bin
go build ../cmd/aws-resource-exporter
Run the following commands from the root directory to build the Docker image:
docker build -f build/package/Dockerfile -t aws-resource-exporter:test .
We suggest running the application using the Docker image. The application requires the following environment variables to be set:
AWS_RESOURCE_EXPORTER_ORGUNITID: The AWS organisational unit to retrieve the list of AWS accounts from.AWS_RESOURCE_EXPORTER_ASSUMEROLENAME: The AWS IAM role name to assume in each AWS account.The following environment variables are optional:
AWS_RESOURCE_EXPORTER_PORT: The port to run the metrics endpoint on. Defaults to `8090``AWS_RESOURCE_EXPORTER_ENDPOINT: The path to expose the metrics endpoint on. Defaults to metricsAWS_RESOURCE_EXPORTER_SCHEDULE: How frequently to retrieve the resource count from each AWS account in minutes. Defaults to 1440 (24 hours)AWS_RESOURCE_EXPORTER_VIEWNAME: The name of the AWS Resource Explorer view to retrieve the resource count from. Defaults to all-resourcesAWS_RESOURCE_EXPORTER_METRICPREFIX: The prefix to use for the AWS metrics. Defaults to `` (empty string):AWS_RESOURCE_EXPORTER_QUERYSTRING: The additional query string to use when retrieving the resource count from AWS Resource Explorer. Defaults to `` (empty string)AWS_RESOURCE_EXPORTER_INCLUDEZEROVALUES: Whether to include metrics with a value of zero. Defaults to trueAWS_RESOURCE_EXPORTER_INCLUDEINDIVIDUALRESOURCES: Defaults to falseAWS_RESOURCE_EXPORTER_INDIVIDUALRESOURCESTAGFILTER: Defaults to `` (empty string) to include all tags as metric labelsSet the required environment variables as per the above. We recommend using dotenv to set these.
Ensure that you assume a role that allows you to assume the role set in AWS_RESOURCE_EXPORTER_ASSUMEROLENAME in each AWS account. You can do this with a command such as the following:
$(aws sts assume-role \
--role-arn "arn:aws:iam::111111111111:role/role-name" \
--role-session-name aws-resource-exporter \
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \
--output text))
Content type
Image
Digest
sha256:875e908d6…
Size
40.3 MB
Last updated
4 months ago
docker pull dfdsdk/aws-resource-exporter