Skip to content

Amazon S3 Image Hosting

RobertJBarron edited this page May 18, 2019 · 6 revisions

Recommended if you use a service such as IRC or HipChat. You can omit all of these settings if you do not plan to use S3. In addition to AWS S3, you can use any other service that is compatible with the S3 API.

Graphs are downloaded to the box running hubot-grafana and then uploaded to S3 with world-readable rights, so you do not have to do anything special to your S3 bucket in order to serve the graph images suitable for Slack or HipChat. E.g., you do not have to set up web hosting for your S3 bucket.

Configuration Variable Required Description
HUBOT_GRAFANA_S3_BUCKET Yes Name of the S3 bucket to copy the graph into
HUBOT_GRAFANA_S3_ACCESS_KEY_ID Yes Access key ID for S3
HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY Yes Secret access key for S3
HUBOT_GRAFANA_S3_PREFIX No Bucket prefix (useful for shared buckets)
HUBOT_GRAFANA_S3_REGION No Bucket region (defaults to us-standard)
HUBOT_GRAFANA_S3_ENDPOINT No Endpoint of the S3 API (useful for S3 compatible API, defaults to s3.amazonaws.com)
HUBOT_GRAFANA_S3_PORT No Port of the S3 endpoint
HUBOT_GRAFANA_S3_STYLE No Bucket style of the S3 endpoint 'virtualHosted' or 'path' defaults to 'virtualHosted'

You most likely want to add an S3 Life Cycle Configuration that will "Permanently Delete" the graphs after 1 hour or 1 day, as appropriate for your organization.

Hosting hubot-grafana within AWS.

EC2 IAM Roles will not be used. In order for your hubot-grafana to be allowed to store graphs in S3 that can be referenced via Slack or HipChat, the IAM user with the credentials you run hubot-grafana as should have an IAM user policy such as:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR-BUCKET-NAME"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR-BUCKET-NAME/*"
            ]
        }
    ]
}
Clone this wiki locally