Vector: aws_cloudwatch_logs cann't connect

Created on 3 Dec 2019  路  5Comments  路  Source: timberio/vector

I config vector follow this guide. Add 2 env variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

aws configure list
Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ****************NM6P              env    
secret_key     ****************duX/              env    
    region           ap-southeast-1      config-file    ~/.aws/config

But, log vector:

ERROR sink{name=aws_cloudwatch_logs type=aws_cloudwatch_logs}: vector::sinks::util::retries: encountered non-retriable error. error=CloudwatchError::Describe: Couldn't find AWS credentials in environment, credentials file, or IAM role.

How I configuration. Thanks

aws_cloudwatch_logs help

Most helpful comment

@romvarac looks like you're setting the env vars within your shell but those are not passed into the container that is running vector. I would suggest adding

services:
  vector:
    image: timberio/vector:nightly-debian
    container_name: vector
    ports: 
      - 9598:9598
      - 9000:9000
    volumes:
      - ./vector.toml:/etc/vector/vector.toml
    command: 
      - --config=/etc/vector/vector.toml
    environment:
        AWS_ACCESS_KEY_ID: "..."
        AWS_SECRET_ACCESS_KEY: "..."
    restart: always

Another option is to volume mount the aws config into the container so that vector can find it.

All 5 comments

Hi @romvarac, thanks for reporting. I've assigned @LucioFranco who should be able to help you debug this.

@romvarac hi! could you provide a bit more information on how you are running vector? So cloudwatch will attempt to search all the default paths so most likely this issue is because the env vars are not present when starting vector. If you could also create a way I can reproduce this locally that would be very helpful :)

My config

  1. vector.toml
[sources.in]
    type = "tcp"
    address = "0.0.0.0:9000"
    max_length = 102400
    shutdown_timeout_secs = 30
    host_key = "host"

[transforms.json_parser_message]
    type = "json_parser"
    inputs = ["in"]
    drop_invalid = true
    field = "message"

[sinks.aws_cloudwatch_logs]
    # REQUIRED - General
    type = "aws_cloudwatch_logs" # example, must be: "aws_cloudwatch_logs"
    inputs = ["json_parser_message"] # example
    group_name = "kong" # example
    region = "ap-southeast-1" # example
    stream_name = "{{ message }}" # example

    # REQUIRED - requests
    encoding = "json" # example, enum

    # OPTIONAL - General
    create_missing_group = true # default
    create_missing_stream = true # default
    # healthcheck = true # default

    # OPTIONAL - Batching
    batch_size = 1049000 # default, bytes
    batch_timeout = 1 # default, seconds

    # OPTIONAL - Requests
    request_in_flight_limit = 5 # default
    request_rate_limit_duration_secs = 1 # default, seconds
    request_rate_limit_num = 5 # default
    request_retry_attempts = 5 # default
    request_retry_backoff_secs = 1 # default, seconds
    request_timeout_secs = 30 # default, seconds
    # OPTIONAL - Buffer
    [sinks.aws_cloudwatch_logs.buffer]
        type = "memory" # default, enum
        max_size = 104900000 # example, no default, bytes, relevant when type = "disk"
        num_items = 500 # default, events, relevant when type = "memory"
        when_full = "block" # default, enum
  1. set env vars AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in .bashrc
#Environment variables
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
  1. mkdir .aws
  2. config file
[default]
region=ap-southeast-1
output=json
  • credentials file
[default]
aws_access_key_id = ...
aws_secret_access_key = ...
  1. docker-compose.yml
version: "3.7"

services:
  vector:
    image: timberio/vector:nightly-debian
    container_name: vector
    ports: 
      - 9598:9598
      - 9000:9000
    volumes:
      - ./vector.toml:/etc/vector/vector.toml
    command: 
      - --config=/etc/vector/vector.toml
    restart: always

This is my config. Thanks

@romvarac looks like you're setting the env vars within your shell but those are not passed into the container that is running vector. I would suggest adding

services:
  vector:
    image: timberio/vector:nightly-debian
    container_name: vector
    ports: 
      - 9598:9598
      - 9000:9000
    volumes:
      - ./vector.toml:/etc/vector/vector.toml
    command: 
      - --config=/etc/vector/vector.toml
    environment:
        AWS_ACCESS_KEY_ID: "..."
        AWS_SECRET_ACCESS_KEY: "..."
    restart: always

Another option is to volume mount the aws config into the container so that vector can find it.

Thanks for your support @LucioFranco. So, I can do it, vector connect aws_cloudwatch

Was this page helpful?
0 / 5 - 0 ratings