amazon-web-services - 使用 key 凭证连接到 AWS 中的 elasticsearch

标签 amazon-web-services elasticsearch curl aws-elasticsearch

我正在尝试使用我的 accessKey 和 secretKey 将使用 curl 的请求发布到我在 AWS 中的 es 集群。我已经通过 postman ( details here ) 成功完成了这项工作,您可以在其中指定 AWS 凭证,但我想使用 curl 来完成这项工作。 postman 可以为您自动生成您的 curl 请求,但我得到的只是错误。

这是生成的 curl 请求和响应

curl -X GET \
  https://search-00000000000001.eu-west-1.es.amazonaws.com/_cat/indices \
  -H 'Authorization: AWS4-HMAC-SHA256 Credential=11111111111111111111/20181119/eu-west-1/es/aws4_request, SignedHeaders=cache-control;content-type;host;postman-token;x-amz-date, Signature=11111111116401882398f46011f14fdb9d55e012a4fb912706d67c1111111111' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Host: search-00000000000001.eu-west-1.es.amazonaws.com' \
  -H 'Postman-Token: 00000000-0000-4001-8006-9291e208a000' \
  -H 'X-Amz-Date: 20181119T220000Z' \
  -H 'cache-control: no-cache'

{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."}%

ID已更改以保护无辜者。

我已经检查了我所有的 key 和区域,就像我说的,这通过 postman 工作。是否可以通过 curl 使用我的 key 访问此 AWS 服务?

最佳答案

这是一个相当长的兔子洞。感谢 Adam 的评论,让我朝着正确的方向前进。链接 https://docs.aws.amazon.com/apigateway/api-reference/signing-requests/真的可以帮助您了解您需要做什么。

从那以后,我找到了一个遵循上述签名请求方法的脚本。它在 bash 中运行,虽然它不是为与 elasticsearch 请求一起使用而编写的,但它可以用于它们。

https://github.com/riboseinc/aws-authenticating-secgroup-scripts非常感谢 https://www.ribose.com把它放在github上。

关于amazon-web-services - 使用 key 凭证连接到 AWS 中的 elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53383877/

相关文章:

php - PHP 中的 elasticsearch 查询和 cURL

curl - 发布文件位置

amazon-web-services - NAT 实例和 NACL 配置

dns - Amazon EC2 - 什么是私有(private) DNS 和私有(private) IP?

python - ElasticSearch 的 Celery 结果类型

python - Fargate 任务的资源 ARN 以允许连接到 Elasticsearch

c# - 如何将此 HipChat curl 帖子转换为 C#?

amazon-web-services - AWS S3 - 从链接访问文件时出现隐私错误

amazon-web-services - ValidationException : Before you can proceed, 您必须启用服务相关角色才能授予 Amazon ES 访问您的 VPC 的权限

elasticsearch - AWS 托管 elasticsearch 不允许 `_render/template` 请求?