METRIC

aws_cloudwatch_metrics sink

The aws_cloudwatch_metrics sink streams metric events to AWS CloudWatch Metrics via the PutMetricData API endpoint.

Configuration

  • Common
  • Advanced
vector.toml
[sinks.my_sink_id]
type = "aws_cloudwatch_metrics" # example, must be: "aws_cloudwatch_metrics"
inputs = ["my-source-id"] # example
endpoint = "127.0.0.0:5000" # example
namespace = "service" # example
region = "us-east-1" # example

Options

4 items
commonstringrequired

endpoint

Custom endpoint for use with AWS-compatible services.

No default
View examples
booloptional

healthcheck

Enables/disables the sink healthcheck upon start. See Health Checks for more info.

Default: true
View examples
commonstringrequired

namespace

A namespace that will isolate different metrics from each other.

No default
View examples
commonstringrequired

region

The AWS region of the target CloudWatch stream resides.

No default
View examples

Env Vars

2 items
commonstringrequired

AWS_ACCESS_KEY_ID

Used for AWS authentication when communicating with AWS services. See relevant AWS components for more info. See Authentication for more info.

No default
View examples
commonstringrequired

AWS_SECRET_ACCESS_KEY

Used for AWS authentication when communicating with AWS services. See relevant AWS components for more info. See Authentication for more info.

No default
View examples

Output

The aws_cloudwatch_metrics sink streams metric events to AWS CloudWatch Metrics via the PutMetricData API endpoint.

How It Works

Authentication

Vector checks for AWS credentials in the following order:

  1. Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  2. The credential_process command in the AWS config file. (usually located at ~/.aws/config)
  3. The AWS credentials file. (usually located at ~/.aws/credentials)
  4. The IAM instance profile. (will only work if running on an EC2 instance with an instance profile/role)

If credentials are not found the healtcheck will fail and an error will be logged.

Obtaining an access key

In general, we recommend using instance profiles/roles whenever possible. In cases where this is not possible you can generate an AWS access key for any user within your AWS account. AWS provides a detailed guide on how to do this.

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.

Health Checks

Health checks ensure that the downstream service is accessible and ready to accept data. This check is performed upon sink initialization. If the health check fails an error will be logged and Vector will proceed to start.

Require Health Checks

If you'd like to exit immediately upon a health check failure, you can pass the --require-healthy flag:

vector --config /etc/vector/vector.toml --require-healthy

Disable Health Checks

If you'd like to disable health checks for this sink you can set thehealthcheck option to false.

Metric Types

CloudWatch Metrics types are organized not by their semantics, but by storage properties:

  • Statistic Sets
  • Data Points

In Vector only the latter is used to allow lossless statistics calculations on CloudWatch side.

The following matrix outlines how Vector metric types are mapped into CloudWatch metrics types.

Vector MetricsCloudWatch Metrics
CounterData Point
GaugeData Point
Gauge Delta [1]Data Point
HistogramData Point
SetN/A
  1. Gauge values are persisted between flushes. On Vector start up each gauge is assumed to have zero (0.0) value, that can be updated explicitly by the consequent absolute (not delta) gauge observation, or by delta increments/decrements. Delta gauges are considered an advanced feature useful in distributed setting, however it should be used with care.

Streaming

The aws_cloudwatch_metrics sink streams data on a real-time event-by-event basis. It does not batch data.