Snapshot to S3 fails with parse exception

Cluster 1bfe9344

After setting up S3 credentials and a bucket, I run a snapshot command as follows through the dev tools console:

PUT _snapshot/snapshots
{
  "type": "s3",
  "settings": {
    "bucket": "<redacted>/backups/elasticsearch/demo/snapshots",
    "access_key": "<redacted>",
    "secret_key": "<redacted>"
  }
}

However, this generates the following error:
{
"error": {
"root_cause": [
{
"type": "amazon_client_exception",
"reason": "Failed to parse XML document with handler class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler"
}
],
"type": "amazon_client_exception",
"reason": "Failed to parse XML document with handler class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler",
"caused_by": {
"type": "s_a_x_parse_exception",
"reason": "Premature end of file."
}
},
"status": 500
}

Note that I do see the tests-xxxx S3 buckets and some associated content created, so access doesn't appear to be an issue. I have not configured any other s3 or repository specific options other than what is specified here. Any ideas what might be happening?

Normally the bucket name is something like foo.bar.com.

If you want to use a specific path use base_path option to set /backups/elasticsearch/demo/snapshots.

I'd probably use:

PUT _snapshot/snapshots
{
  "type": "s3",
  "settings": {
    "bucket": "<redacted>",
    "base_path": "/backups/elasticsearch/demo/snapshots",
    "access_key": "<redacted>",
    "secret_key": "<redacted>"
  }
}

HTH

1 Like

That did the trick. Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.