【问题标题】:Postman AWS S3 snapshot request ElasticsearchPostman AWS S3 快照请求 Elasticsearch
【发布时间】:2018-06-08 03:26:26
【问题描述】:

您好,在使用 POSTMAN 向 AWS to create a snapshot in a S3 bucket 上的 ElasticSearch 发送 PUT 请求时,我需要一些帮助。

我创建了一个名为 cb-search-es-backup 的 S3 存储桶。 我为 S3 (see:this post of mine for the steps I've taken) 创建了一个角色和一个策略。

请求网址 https://myelasticsearchendpoint.eu-west-1.es.amazonaws.com/

请求方法:PUT

正文:RAW / json

{
 "type": "s3",
    "settings": {
        "bucket": "cb-search-es-backup",  // my bucketname
        "region": "eu-west-1", // region
        "role_arn": "arn:aws:iam::12345676890:role/Role_ES_TO_S3" // my role arn
   }
 }

我也尝试过授权类型:“AWS 签名”,并填写了访问权限和密钥。

【问题讨论】:

  • 添加了一个答案,看起来你的other question 中的问题是一样的 - 没有通过凭据。

标签: elasticsearch amazon-s3 postman


【解决方案1】:

您似乎没有通过此请求传递 AWS 凭证。

这里有关于如何使用 AWS 身份验证发出 Postman 请求的详细指南:Use Postman to Call an API

您的 Postman 窗口可能如下所示:

要在 python 中做同样的事情,请查看this documentation pageSample python client 部分,注意AWS4Auth 对象已创建,它作为auth 参数传递给requests.put()

credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)

# Register repository

path = '_snapshot/my-snapshot-repo' # the Elasticsearch API endpoint
url = host + path

payload = {
  ...
}

headers = {"Content-Type": "application/json"}

r = requests.put(url, auth=awsauth, json=payload, headers=headers)

希望有帮助!

【讨论】:

    猜你喜欢
    • 2017-08-23
    • 1970-01-01
    • 2017-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-19
    相关资源
    最近更新 更多