# Certificate error when creation S3 repository for snapshot

**URL:** <https://discuss.elastic.co/t/certificate-error-when-creation-s3-repository-for-snapshot/263947>\
**Category:** Elasticsearch\
**Tags:** snapshot-and-restore\
**Created:** [February 11, 2021, 3:56am UTC](https://discuss.elastic.co/t/certificate-error-when-creation-s3-repository-for-snapshot/263947 "2021-02-11T03:56:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deependra](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@deependra](https://discuss.elastic.co/u/deependra)\
**Post date:** [February 11, 2021, 3:56am UTC](https://discuss.elastic.co/t/certificate-error-when-creation-s3-repository-for-snapshot/263947/1 "2021-02-11T03:56:49Z")

</div>

Hi team,

I am trying to create a S3 repository so that I can send snapshot to it and then restore on destination cluster.

I am using elasticsearch 5.2.2 version and have installed equivalent s3 repo plugin.

OS - centos

When I try creating s3 repo using below command:

```auto
curl -XPUT 'http://10.173.39.167:9200/_snapshot/repository-s3?verify=false&pretty' -d'
{
  "type": "s3",
  "settings": {
    "bucket": "elasticsearch-snap-bucket",
    "region": "ap-south-1",
    "access_key": "accesskey",
    "secret_key": "secretkey",
    "server_side_encryption": true,
    "protocol": "https"
  }
}'

```

I end up with below error:-

```auto
  "error" : {
    "root_cause" : [
      {
        "type" : "amazon_client_exception",
        "reason" : "amazon_client_exception: Unable to execute HTTP request: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"
      }
    ],
    "type" : "repository_exception",
    "reason" : "[repository-s3] failed to create repository",
    "caused_by" : {
      "type" : "amazon_client_exception",
      "reason" : "amazon_client_exception: Unable to execute HTTP request: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
      "caused_by" : {
        "type" : "i_o_exception",
        "reason" : "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
        "caused_by" : {
          "type" : "validator_exception",
          "reason" : "validator_exception: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
          "caused_by" : {
            "type" : "sun_cert_path_builder_exception",
            "reason" : "sun_cert_path_builder_exception: unable to find valid certification path to requested target"
          }
        }
      }
    }
  },
  "status" : 500
}

```

Please help

---

<div class="post-metadata">

**Author:** ![deependra](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@deependra](https://discuss.elastic.co/u/deependra)\
**Post date:** [February 11, 2021, 3:59am UTC](https://discuss.elastic.co/t/certificate-error-when-creation-s3-repository-for-snapshot/263947/2 "2021-02-11T03:59:00Z")

</div>

Steps that I have tried. But without any success. It still throws the same error.

```auto
echo -n | openssl s_client -connect s3.ap-south-1.amazonaws.com | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ./cert.crt

```

```auto
keytool -import -alias sthrecerts -file ca_logstash.cer -keystore /usr/java/jdk1.8.0_91/jre/lib/security/cacerts

```

i m using java 1.8.0\_91

---

<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:** [March 11, 2021, 3:59am UTC](https://discuss.elastic.co/t/certificate-error-when-creation-s3-repository-for-snapshot/263947/3 "2021-03-11T03:59:30Z")

</div>

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