grafana-backup-tool icon indicating copy to clipboard operation
grafana-backup-tool copied to clipboard

Cannot Upload to S3

Open alfredopalhares opened this issue 1 year ago • 1 comments

Hello,

I am trying to uplodad the backups to an S3 bucket with the following command:

docker run --user $(id -u):$(id -g) --rm --name grafana-backup-tool \
   -v /home/ubuntu/backup/grafana/:/opt/grafana-backup-tool/_OUTPUT_ \
   -e GRAFANA_TOKEN="${GRAFANA_TOKEN}" \
   -e GRAFANA_URL="${GRAFANA_URL}" \
   -e GRAFANA_ADMIN_ACCOUNT="${GRAFANA_ADMIN_ACCOUNT}" \
   -e GRAFANA_ADMIN_PASSWORD="${GRAFANA_ADMIN_PASSWORD}" \
   -e VERIFY_SSL=False \
   -e AWS_S3_BUCKET_NAME=""my-bucket" \
   -e AWS_S3_BUCKET_KEY="my-grafana-backup" \
   -e AWS_DEFAULT_REGION="us-east-1" \
   -e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
   -e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
   ysde/docker-grafana-backup-tool

But I get this error:

########################################

backup folders at: _OUTPUT_/folders/202208012254
backup datasources at: _OUTPUT_/datasources/202208012254
backup dashboards at: _OUTPUT_/dashboards/202208012254
backup alert_channels at: _OUTPUT_/alert_channels/202208012254
backup organizations at: _OUTPUT_/organizations/202208012254
backup users at: _OUTPUT_/users/202208012254
backup snapshots at: _OUTPUT_/snapshots/202208012254
backup annotations at: _OUTPUT_/annotations/202208012254

created archive at: _OUTPUT_/202208012254.tar.gz
Upload archives to S3:
    sys.exit(load_entry_point('grafana-backup==1.2.3', 'console_scripts', 'grafana-backup')())
  File "/usr/lib/python3.9/site-packages/grafana_backup/cli.py", line 52, in main
    save(args, settings)
  File "/usr/lib/python3.9/site-packages/grafana_backup/save.py", line 63, in main
    s3_upload(args, settings)
  File "/usr/lib/python3.9/site-packages/grafana_backup/s3_upload.py", line 33, in main
    s3_object.put(Body=open(archive_file, 'rb'))
  File "/usr/lib/python3.9/site-packages/boto3/resources/factory.py", line 520, in do_action
    response = action(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/boto3/resources/action.py", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(*args, **params)
  File "/usr/lib/python3.9/site-packages/botocore/client.py", line 391, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python3.9/site-packages/botocore/client.py", line 719, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.

Any sugestions?

alfredopalhares avatar Aug 01 '22 23:08 alfredopalhares

So I circumvented the issue by regenerating more access keys without having any special characters, as more people report in https://github.com/aws/aws-cli/issues/2665

alfredopalhares avatar Aug 02 '22 00:08 alfredopalhares