# Snapshot to S3 fails with parse exception

**URL:** <https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790>\
**Category:** Elasticsearch\
**Created:** [April 18, 2017, 10:26pm UTC](https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790 "2017-04-18T22:26:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChronosWS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chronosws/32/15852_2.png) [@ChronosWS](https://discuss.elastic.co/u/ChronosWS)\
**Post date:** [April 18, 2017, 10:26pm UTC](https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790/1 "2017-04-18T22:26:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 19, 2017, 6:43am UTC](https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790/2 "2017-04-19T06:43:32Z")

</div>

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:

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

```

HTH

---

<div class="post-metadata">

**Author:** ![ChronosWS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chronosws/32/15852_2.png) [@ChronosWS](https://discuss.elastic.co/u/ChronosWS)\
**Post date:** [April 20, 2017, 2:07am UTC](https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790/3 "2017-04-20T02:07:52Z")

</div>

That did the trick. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 18, 2017, 2:08am UTC](https://discuss.elastic.co/t/snapshot-to-s3-fails-with-parse-exception/82790/4 "2017-05-18T02:08:41Z")

</div>

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