Skip to content

joyent/telegraf-output-sqs

Repository files navigation

Telegraf Output Plugin for Amazon SQS


⚠️ Attention: first, and foremost, this plugin is developed for personal use. In fact, it is not - and will not be - fully production ready!


This plugin makes use of the Telegraf Output Execd plugin. It will batch up input and push it to Amazon SQS.

The plugin also provides optional common configuration for writing to queues: - TODO: list these


About Amazon SQS

It may be useful for users to review Amazons official documentation which is available here.

Usage

mkdir /var/lib/telegraf/sqs
chown telegraf:telegraf /var/lib/telegraf/sqs
tar xf telegraf-output-sqs-<LATEST_VERSION>-<OS>-<ARCH>.tar.gz -C /var/lib/telegraf/sqs
# e.g. tar xf telegraf-output-sqs-v1.0.0-linux-amd64.tar.gz -C /var/lib/telegraf/sqs
  • Edit the plugin configuration as needed:
vi /var/lib/telegraf/sqs/plugin.conf
  • Add the plugin to /etc/telegraf/telegraf.conf or into a new file in /etc/telegraf/telegraf.d:
[[outputs.execd]]
  command = [ "/var/lib/telegraf/sqs/telegraf-output-sqs", "-config", "/var/lib/telegraf/sqs/plugin.conf" ]
  data_format = "influx"
  • Restart or reload Telegraf.

AWS Authentication

This plugin uses a credential chain for Authentication with the Amazon Kinesis Data SQS API endpoint. The plugin will attempt to authenticate in the following order:

  1. web identity provider credentials via STS if role_arn and web_identity_token_file are specified,
  2. assumed credentials via STS if the role_arn attribute is specified (source credentials are evaluated from subsequent rules),
  3. explicit credentials from the access_key, and secret_key attributes,
  4. shared profile from the profile attribute,
  5. environment variables,
  6. shared credentials, and/or
  7. the EC2 instance profile.

If you are using credentials from a web identity provider, you can specify the session name using role_session_name. If left empty, the current timestamp will be used.

AWS IAM Policy

The required AWS IAM Policy is:

TODO: provide refined alternative for "sqs:*"

{
    "Statement": [
        {
            "Action": [
                "sqs:*",
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:sqs:us-east-1:123456789012:queue/my-queue",
            "Sid": ""
        },
    ],
    "Version": "2012-10-17"
}

Configuration

See the file plugin.conf as an example configuration file.


Notes

The plugin was forked from the Amazon Kinesis Data Firehose Output Plugin.

About

Telegraf Output Plugin for Amazon SQS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5