Amazon CloudWatch metrics in Prometheus with cloudwatch_exporter

Connect AWS CloudWatch metrics to a self-hosted Prometheus with the official cloudwatch_exporter, scoped IAM, controlled API cost and validated configuration. Learn when YACE fits better.

On this page

How cloudwatch_exporter brings CloudWatch metrics into Prometheus

A team running AWS workloads on a self-hosted Prometheus can get CloudWatch metrics into the same query and alerting path by running the official cloudwatch_exporter next to Prometheus. Prometheus does not call AWS directly. It scrapes the exporter over HTTP like any other target, and the exporter makes the CloudWatch API requests on its own schedule. That split decides where the cost and the permissions sit: the AWS credentials, the IAM policy and the number of CloudWatch API calls all belong to the exporter host, not to the Prometheus server.

The exporter is a Java application, so the host needs a supported Java runtime, and the project requires at least Java 11. Its configuration file lists which CloudWatch namespaces, metrics, dimensions and statistics to pull. Before deploying, run the exporter's --check-config option against the file, since it validates syntax without contacting CloudWatch. Confirm the current Java requirements and the exporter release you plan to use in the repository before you pin a version.

Prometheus itself is licensed under Apache-2.0, so the license cost of this pipeline is zero. The recurring costs are the infrastructure that runs Prometheus and the exporter, the storage for the extra series, and the people who keep the configuration and credentials current. CloudWatch API charges are billed by AWS and depend on how many metrics and requests the exporter makes, so ask your team or partner to estimate those calls from the metric list before the first scrape runs in production.

What you need before configuring cloudwatch_exporter

Five things need settling before the first configuration file is written: the runtime, the Prometheus server, the AWS scope, the network paths and the credential model. Each one shapes the next, and a gap in any of them usually shows up later as failed scrapes or a permissions error that is hard to trace.

Java runtime for the exporter

The cloudwatch_exporter is a Java application and requires at least Java 11. Decide where it runs (a VM, a container or alongside Prometheus) and confirm the Java version on that host before anything else. Check the runtime against the exporter's current release notes, because minimum versions can change between releases. Plan how the JVM will be patched and restarted, since the exporter is an extra moving part on your monitoring path.

Exporter repository

Prometheus server and version line

The exporter feeds a Prometheus server you run, so confirm which version line you are deploying before writing scrape configs. Prometheus publishes a new minor release every 6 weeks, and a minor release generally stops receiving bug fixes after that window. Long-term support lines receive fixes for one year, so check the current LTS line against the release cycle page on the day you deploy, not against this page.

Release cycle page

AWS accounts and regions in scope

Write down which AWS accounts, regions and namespaces the exporter must read before building configuration. CloudWatch metrics are read per region, so a multi-region estate multiplies the API calls the exporter makes. Ask your cloud team which accounts are the source of truth, whether cross-account roles are already used, and which services (for example EC2, RDS or load balancers) are actually needed. A short, agreed list keeps the scrape scope and the API bill predictable.

Network paths to CloudWatch and Prometheus

Two paths must work. The exporter needs outbound HTTPS access to the CloudWatch API endpoints in each region, which may need an egress proxy or VPC endpoint in restricted networks. Prometheus needs network access to the exporter's HTTP port to scrape it. Confirm both paths with your network team and firewall rules before deployment, and confirm whether the exporter sits in the same network zone as Prometheus or crosses a boundary that needs a rule.

Instance roles or long-lived keys

Prefer an instance role or workload identity over static access keys wherever the exporter runs on AWS infrastructure, because temporary credentials rotate without manual work. If the exporter runs outside AWS, decide how it obtains credentials and who owns their rotation. Either way, grant read-only CloudWatch permissions scoped to the namespaces you need. Do not reuse an administrator identity, and do not store keys in the configuration file in plain text.

Read-only permissions and API cost

Map each scrape to the CloudWatch API calls it causes before the exporter is live. Metric reads are billed per request, and broad discovery settings or short scrape intervals can raise both the call count and the bill. Confirm the current CloudWatch API pricing with AWS or your account team rather than relying on estimates, and agree a metric list with your cloud owner before enabling the exporter in production.

Configuring cloudwatch_exporter step by step

This sequence takes you from an installed exporter to a Prometheus scrape job that returns CloudWatch series, with a validation check at each stage so problems surface before any live API calls are made.

  1. Confirm the Java runtime and get the exporter

    The engineer running the exporter confirms a Java runtime of at least Java 11 is installed on the host, then obtains the cloudwatch_exporter build from the official repository, following the install instructions in its README. Check the runtime first with the java version command. The step is done when the runtime reports version 11 or later and the exporter artifact is present on the host.

  2. Create the AWS identity with read-only metric permissions

    The cloud or security engineer creates an IAM role or user that can only read CloudWatch metrics, typically the list and get metric permissions for the namespaces you intend to scrape, and attaches it to the host or to the credentials the exporter will use. Avoid broad administrator access. The step is done when a test call made with those credentials to list metrics in the target region succeeds and an out-of-scope action is denied.

  3. Write the config with region, role and metric selection

    The engineer writes the exporter configuration file with the AWS region, the optional role to assume, and an explicit list of namespaces, metric names, dimensions and statistics. Keep the list narrow at first, because each metric and dimension combination adds CloudWatch API requests and therefore cost. The step is done when the file contains only the namespaces and metrics the team has agreed to monitor, with each entry reviewed against the CloudWatch metric list for that service.

  4. Validate the config with check-config before any live call

    Before starting the exporter against AWS, the engineer runs it with the check-config option pointed at the configuration file. This validates the file's structure without contacting CloudWatch, so syntax and schema mistakes surface at no API cost. The step is done when the check completes without errors; any reported error is fixed in the file and the check is rerun until it passes.

  5. Start the exporter and confirm its endpoint

    The engineer starts the exporter with the validated configuration file and a listening port, under a service manager or in a supervised session so it restarts after a host reboot. Then they request the metrics endpoint locally. The step is done when the endpoint responds over HTTP and returns the exporter's own status metrics, which shows the process is running and reading its configuration.

  6. Add a scrape job for the exporter in Prometheus

    The Prometheus administrator adds a scrape job to the Prometheus configuration file that points at the exporter host and port, with a job name that identifies the AWS account and region. Then they reload Prometheus through its configured reload method and open the Targets page. The step is done when the new target shows as up and its last scrape succeeded, with no errors shown on the page.

  7. Confirm expected CloudWatch series in PromQL

    The engineer runs a PromQL query in the Prometheus expression browser for one metric from the configured list, using the series name the exporter generates from the CloudWatch namespace and metric. They check that the series exists, that its labels match the dimensions in the config, and that new samples arrive on successive scrapes. The step is done when the query returns series for each agreed metric, and any missing metric is traced back to the config entry for it.

Scoping IAM permissions for CloudWatch reads

The exporter needs an IAM identity that can read CloudWatch metrics and, when you use discovery, read the tags of the resources it discovers. Give it read-only actions and nothing else. The exact action list depends on which namespaces you enable, such as EC2, RDS or Lambda, and on whether the exporter uses static metric definitions or discovery. Confirm the action names for each namespace against current AWS documentation before you write the policy, because service-specific permissions change over time. Grant the metric read actions and the tag read actions separately in your reasoning, so a reviewer can see why each one exists. Do not attach broad managed policies such as full CloudWatch or full read-only access to every service unless your security team has accepted that scope in writing.

Restrict the identity as far as each service allows. Scope the policy to the accounts and regions you monitor by using a dedicated role in each account and by configuring the exporter's region setting to match the policy. Where the service supports resource-level conditions, limit tag and describe reads to resources with a known tag or in a known set of ARNs. Many CloudWatch metric read actions do not accept resource-level restrictions, so expect some actions to remain account-wide. Record which parts of the policy are restricted and which are not, since that gap is what an auditor will ask about first. A cross-account role, if you use one, should use a trust policy that names your monitoring account and an external ID or equivalent condition.

Have the security team review the final policy before deployment, and repeat the review whenever you add a namespace or change discovery settings. Ask them to check that the role cannot write, delete or change resources, cannot read secrets, and cannot reach other workloads in the account. Keep the policy as code alongside the exporter configuration so changes go through the same review. Confirm with AWS documentation how the exporter authenticates in your environment, whether through an instance role, a task role or static keys, and avoid long-lived static keys where a role can be used instead. Test the permissions with the least-privileged identity before go-live, and treat any access-denied error during testing as a sign the policy needs a decision, not a reason to widen it.

Controlling CloudWatch API cost through metric selection

Most of the cost of pulling CloudWatch metrics into Prometheus comes from what the exporter asks CloudWatch for, not from Prometheus itself. The cards below cover the request-side drivers and the configuration choices that keep them under control, along with the checks to run before the exporter goes live.

Count the metrics each scrape requests

Every metric and dimension combination in the exporter configuration becomes a CloudWatch request on each scrape. Multiply the number of metric definitions by the number of dimension values they match, then by the scrape frequency, to see the request volume you are committing to. Ask whether a new definition covers a real alerting or dashboard need, because a broad rule can quietly match hundreds of resources. Count requests per scrape before enabling the job.

CloudWatch Exporter repository

Set the scrape interval deliberately

The scrape interval controls how often the exporter calls CloudWatch, so a shorter interval increases request volume in direct proportion. CloudWatch metrics are not delivered at sub-minute resolution for most services, so a very short scrape interval often repeats the same data points. Match the interval to the alert and dashboard needs of each service and keep slower-changing metrics on a longer cycle where your configuration allows it.

Choose period and statistic with intent

The period sets the time window each CloudWatch datapoint covers, and the statistic sets how that window is aggregated. Longer periods return fewer datapoints for the same window, which is useful for capacity trends but can hide short spikes that matter for alerting. Each statistic you request is a separate value to fetch and store, so keep only the statistics your rules and dashboards read, such as Average or Maximum, and drop the rest.

Narrow namespaces and dimensions

Limiting the job to the namespaces your team operates prevents the exporter from sweeping services you do not monitor. Within a namespace, restrict dimensions with explicit selectors such as a known load balancer or database identifier instead of matching every resource. Broad dimension matching also multiplies the number of time series in Prometheus, so the same narrowing reduces storage and query load on your side of the system.

Confirm charges in your own account

AWS charges for CloudWatch API requests and for metrics, and rates depend on the region, the API used and the account's pricing terms. Use the AWS pricing pages and your own billing data to estimate the monthly charge for the exact configuration you plan, and ask your AWS account team or DeployOpen for a quote based on that configuration. Track request volume after go-live so a configuration change that increases calls does not show up first on the invoice.

When cloudwatch_exporter fits and when YACE fits better

cloudwatch_exporter fits when your team can name the namespaces, metrics, dimensions and statistics it needs before deployment, and that list changes rarely. The exporter reads a YAML configuration file that you write and maintain, so every metric it requests is one you chose. That explicit list is the main advantage: you know what is requested, you can keep the request volume low, and the configuration reviews like any other code change. The cost is upkeep. When a new load balancer, queue or database is added, someone must update the configuration and redeploy it.

  • Explicit scope: Only the namespaces and metrics you list are requested from CloudWatch.
  • Predictable request volume: Fewer requested metrics generally means fewer CloudWatch API calls, which is where most of the recurring cost comes from.
  • Config as code: Changes go through review and can be validated before rollout.
  • Manual upkeep: New resources are not picked up automatically and must be added to the file.
  • Java runtime: The exporter needs at least Java 11 on the host or container that runs it.

Before committing, ask your team to list the namespaces and dimensions for the next twelve months of planned services. If that list is short and stable, this option is usually the simpler one to operate.

How CloudWatch metrics reach Prometheus through a pull

The flow starts in the AWS account, where CloudWatch holds the metrics and an IAM role grants read access to them. The cloudwatch_exporter process runs inside your network, holds its configuration file and the credentials used to call the CloudWatch API, and translates results into Prometheus metrics. Prometheus then scrapes the exporter on its normal schedule, stores the samples, and evaluates PromQL queries and alert rules against them. Check that the exporter is the only component holding AWS credentials, and that the dashed trust boundary separates the AWS account from your self-hosted network.

Credentials and API calls cross the AWS boundary only through the exporter.

How CloudWatch namespaces, dimensions and labels map to Prometheus

This table shows how each CloudWatch concept (namespace, metric, dimension, statistic, region) typically appears in a scraped Prometheus series, and where cardinality can grow. Read it before writing the exporter configuration, then confirm the exact output with a test scrape because naming behavior can change between releases.

CloudWatch conceptTypical Prometheus formPlanning note
NamespacePart of the metric name prefix, derived from the configured namespaceConfirm the prefix format in the repository's current README and a test scrape before writing alert rules.
Metric nameConverted to a lowercase, underscore-separated name with a unit suffix where the exporter adds oneNames are changed from CloudWatch's CamelCase. Check each name you plan to alert on.
Statistic (Average, Sum, Maximum, and so on)Usually exposed as a separate series or label value per statistic requestedEach extra statistic multiplies series count, so request only what dashboards and alerts use.
Dimensions (for example, instance or load balancer identifiers)Become labels on the seriesEach unique dimension value creates a new series. Keep to stable identifiers and drop per-request or per-user values.
Region and accountTypically added as labels from the scrape configurationAsk whether a region label is emitted per job, and avoid mixing regions under one ambiguous job name.
Period and time windowAffects the value and timestamp, not the label setShort periods raise API calls and cost. Match the period to the alert evaluation window.

Securing the exporter, its credentials and the scrape path

The cloudwatch_exporter holds AWS credentials and exposes CloudWatch data over HTTP, so its security depends on three layers: the AWS identity it uses, the network path Prometheus scrapes across, and the Prometheus side of that connection. The cards below cover each layer and the settings to check before the exporter goes into production.

Scope the IAM permissions

Give the exporter an IAM identity that can only read the CloudWatch metrics and the resource tags named in its configuration. Grant read actions and nothing else, and limit them to the namespaces you scrape. Review the policy whenever you add a metric block, because a broad policy turns a monitoring host into a read path into every metric in the account. Ask your AWS team to confirm the exact actions the exporter version you run requires before you write the policy.

CloudWatch Exporter repository

Prefer role-based credentials over static keys

Where the exporter runs on EC2, in ECS or in another AWS compute service, attach an IAM role and let the SDK obtain temporary credentials, instead of placing long-lived access keys in a file or environment variable. If the exporter runs outside AWS, decide how it assumes a role and who owns that trust relationship. Any static keys that remain need a rotation owner, a secrets store outside the config repository and a check that they are not reused by other jobs.

Restrict the exporter endpoint at the network

The exporter serves its metrics over plain HTTP by default, so anyone who can reach its port can read the account's metric data. Allow connections to its port only from the Prometheus servers that scrape it, using security groups, host firewall rules or network policies. Confirm the exporter does not listen on a public interface, and document the allowed source addresses so the rule is reviewed when scrapers move.

Exporters and integrations

Put a reverse proxy in front when needed

If the scrape must cross a network boundary you do not control, place an authenticating reverse proxy in front of the exporter and terminate TLS there. Prometheus has no built-in single sign-on and its security model notes no built-in CSRF protection on mutating endpoints, so authentication for the web UI and API is normally handled by the proxy. Confirm the proxy forwards only the metrics path and blocks every other route on the exporter.

Secure the Prometheus scrape with TLS and auth

Prometheus supports TLS and client certificate authentication with TLS 1.2 as the minimum, plus HTTP basic authentication with bcrypt-hashed passwords. Basic authentication without TLS sends credentials in cleartext, so use it only over an encrypted connection. Store the scrape credentials and certificate keys in files with restricted permissions, and plan certificate renewal before expiry.

Prometheus security model

Keep admin and lifecycle endpoints off

The Prometheus admin HTTP APIs are disabled by default, and the --web.enable-admin-api flag enables destructive operations while --web.enable-lifecycle enables reload and shutdown endpoints. Leave both flags unset on production servers unless an automation process needs them, and then limit access to that process. Check the running command line or service unit after each deployment, since a copied startup script can turn them on without notice.

Prometheus security model

Common cloudwatch_exporter failures and how to fix them

This table pairs each common cloudwatch_exporter failure with its likely cause and the fix to try first. Read it by matching the symptom you see to a row, then checking the cause column before changing configuration. The main takeaway is that most failures sit in the Java runtime, the IAM policy, the region and dimension settings, or the metric selection, and each can be checked before the exporter is put into production.

SymptomLikely causeFix
Exporter fails to startJava runtime older than Java 11, which the exporter requiresInstall Java 11 or later on the host or container image, then confirm the runtime version before starting the exporter again
Config file rejected at startupYAML syntax error, unknown key or wrong indentation in the config fileRun the exporter with --check-config against the file. This validates the configuration without contacting CloudWatch, so it can run in a build pipeline
AccessDenied errors in logsThe IAM identity lacks a CloudWatch read action or a permission needed to list metricsAdd the missing read actions to the policy attached to the exporter's role or user, then confirm the identity used at runtime is the one you edited
Metrics exist in the console but the exporter returns nothingWrong region in the config, or the namespace or dimension names do not match the CloudWatch names exactlySet the region to where the resources run, and copy namespace and dimension names from the CloudWatch console. Names are case-sensitive
Series appear, but with unexpected labels or gapsDimension list does not match the resource dimensions CloudWatch publishes for that metricCompare the configured dimensions with the metric's dimensions in CloudWatch, and adjust the config to select the matching set
Monthly AWS bill rises after enabling the exporterBroad metric selection, many dimension combinations, or a short scrape interval triggering many paid API requestsRestrict the config to the namespaces and metrics you alert on, widen the scrape interval where the data allows, and ask your AWS account team or use the AWS billing console to review CloudWatch API usage
Recent data points are missing or lag behindCloudWatch publishes some metrics with delay, so the most recent window may not yet contain valuesSet the exporter's delay and period settings to look further back, and avoid alert rules that expect data for the last few minutes

Questions buyers ask about CloudWatch metrics in Prometheus

What does it cost to pull CloudWatch metrics into Prometheus?

The cost has three parts: the work to set up and run the exporter, the AWS charges for CloudWatch API calls, and the infrastructure that runs Prometheus and stores the data. Prometheus itself is Apache-2.0 licensed with no paid edition, so there is no license fee for the software. CloudWatch API charges are set by AWS and are not part of a DeployOpen quote, so confirm current pricing in the AWS pricing pages before you size the poll. The biggest lever you control is metric count: each metric, dimension combination and polling interval adds API requests and time series. Ask any partner for a quote that lists the metric inventory it assumes, the polling interval, the number of AWS accounts and regions, and whether the cost is one-time build work or an ongoing retainer.

Can our own team set up cloudwatch_exporter without a partner?

Yes, if your team already runs Prometheus and can work with AWS IAM, Java services and YAML configuration. The exporter is an official Prometheus project that requires at least Java 11, and its configuration is a single file that you can validate with --check-config before it contacts CloudWatch. The skills that most often slow a first build are IAM policy design for least privilege, the mapping from CloudWatch namespaces and dimensions to Prometheus labels, and tuning polling so API costs stay predictable. A partner is most useful when several AWS accounts, private networking or regulated evidence requirements are involved, or when the internal team has no time to own the setup after go-live.

What do we need to provide before the work starts?

You need to provide four things. First, AWS access: a read-only role or credentials scoped to the CloudWatch read actions for the namespaces in scope, plus the account and region list. Second, network paths: the host that runs the exporter needs outbound access to the CloudWatch endpoints in each region, and Prometheus needs to reach the exporter on its scrape port, through any proxy or firewall rules you already have. Third, a metric inventory: the namespaces, metric names, dimensions and the questions each metric answers, so unused metrics can be left out. Fourth, a named owner for alert rules and on-call routing. Confirm proxy and egress rules with your network team early, since they often decide where the exporter can run.

How long does a cloudwatch_exporter implementation take?

Duration depends on scope: how many AWS accounts and regions are involved, how many namespaces and metrics you select, whether the exporter runs on existing hosts or new infrastructure, and how many alert rules and dashboards must be written. A single account with a short, agreed metric list is a much smaller job than a multi-account estate with private networking and audit evidence requirements. Because most engagements are fixed-scope, the written scope should state the phases, deliverables and any dependencies on your AWS or network teams, and a timeline should follow from that scope rather than a generic estimate. Ask for the timeline as a list of milestones tied to your access being granted.

When should we pick YACE instead of cloudwatch_exporter?

Choose the official cloudwatch_exporter when you know which metrics you need and want a static, explicitly listed configuration that is easy to review. Its README points to Yet Another CloudWatch Exporter (YACE) for automatic discovery, which fits estates where resources are created and removed often and maintaining a manual list would become a burden. Discovery can widen the set of API calls and series, so it needs the same cost controls as any other pull. Compare the two on how resources change in your accounts, how much review your change process requires, and whether your team prefers a hand-written inventory. The choice is reversible, so a small pilot on one account is a practical way to test it.

Does Prometheus licensing add cost to this setup?

Prometheus is licensed under Apache-2.0 and has no paid enterprise edition of the project itself, so you do not pay a license fee to run it or the exporter. Your costs come from the servers and storage that run Prometheus, the people who build and operate it, and any AWS charges for the data you pull. Check the licenses of other components you add, such as Grafana or Alertmanager receivers, because they are separate projects with their own terms. If you want vendor support for the software, that is a separate purchase from whoever sells it, and it does not change the license.

What breaks most often after the exporter goes live?

The most common problems are IAM permissions that were scoped too narrowly after a new namespace was added, polling intervals that create more API calls than planned, and dimension changes that create new time series and raise Prometheus memory use. Scrapes can also time out when the exporter waits on CloudWatch, which shows up as gaps in graphs and targets marked down. Prometheus stores data on a single node by default, so plan disk size and retention with the expected series count in mind. Run --check-config in your change pipeline, watch the exporter's own logs after each change, and review the active series count regularly. Ask any partner how these checks are built into the handover.

How DeployOpen works on this

DeployOpen plans and delivers Amazon CloudWatch metrics in Prometheus with cloudwatch_exporter inside your own AWS accounts and monitoring network. The work starts with a written scope that fixes which AWS services, metrics and IAM permissions are included before any configuration reaches production.

How we scope

  • Inventory the AWS services and metric namespaces your teams need, and agree which ones are in scope.
  • Define the IAM role, account structure and least-privilege read permissions the exporter will use.
  • Estimate CloudWatch API request volume from the chosen metric list so cost drivers are visible before build.

How we build

  • Write the cloudwatch_exporter configuration with explicit metric selection, periods and dimensions in version-controlled files.
  • Validate every configuration change with the exporter's check-config option before it reaches a running instance.
  • Connect the exporter to your Prometheus scrape jobs, recording rules and alert rules, and test them against real metrics.

How we hand over

  • Deliver the configuration, IAM policy, scrape settings and runbook in your repository, written for your own engineers.
  • Document how to add or remove metrics, what each API call costs in volume terms and how to review that change.
  • Walk your platform and cloud teams through operation, troubleshooting and the decision points for moving to YACE.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades of the exporter and Prometheus, and continuous checks are available as a retainer.
  • Retainer scope, response expectations and any service levels are confirmed in the written agreement, not assumed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.