[英]Elasticsearch Service with Cognito — how to access via Python HTTP request
I recently setup an Elasticsearch service and configured it to use Cognito for identify management.我最近设置了一个 Elasticsearch 服务并将其配置为使用 Cognito 进行身份管理。 I followed this guide and so far everything is working exactly as expected.我遵循了本指南,到目前为止一切都按预期工作。 I'm able to add new users as expected, and they can access Kibana as expected.我能够按预期添加新用户,他们可以按预期访问 Kibana。
However, I would also like to use Python to interact with the Elasticsearch service.但是,我还想使用 Python 与 Elasticsearch 服务进行交互。 I've following this guide , but I get permission errors about not having the right access.我已遵循本指南,但我收到有关没有正确访问权限的权限错误。
from elasticsearch import Elasticsearch, RequestsHttpConnection
from requests_aws4auth import AWS4Auth
import boto3
host = 'hostname.us-east-2.es.amazonaws.com/'
region = 'us-east-2'
service = 'es'
credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)
es = Elasticsearch(
hosts = [{'host': host, 'port': 443}],
http_auth = awsauth,
use_ssl = True,
verify_certs = True,
connection_class = RequestsHttpConnection
)
print(es.info())
AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for [indices:admin/get] and User [name=arn:aws:iam::12345678:user/username, backend_roles=[], requestedTenant=null]')
I'm not sure if the issue is related to the way that I have Conginto configured, or if it's related to the way that I'm submitting this request.我不确定问题是否与我配置 Conginto 的方式有关,或者是否与我提交此请求的方式有关。 Any help on figuring out where my issue might be would be greatly appreciated.任何有关找出我的问题可能出在哪里的帮助将不胜感激。
It happened to me too.它也发生在我身上。 There are two ways I found, you have to create an IAM user for both of them.我找到了两种方法,您必须为它们创建一个 IAM 用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.