From a7a56b1abdf535df9e538306bf716855a840250a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Sun, 27 Dec 2015 16:11:15 -0500 Subject: [PATCH] Added docs about AWS using IAM --- docs/index.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index f74fb095..0e1d77ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -222,6 +222,29 @@ bodies via post:: from elasticsearch import Elasticsearch es = Elasticsearch(send_get_body_as='POST') +Running with AWS Elasticsearc service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want to use this client with IAM based authentication on AWS you can use +the `requests-aws4auth`_ package:: + + from elasticsearch import Elasticsearch, RequestsHttpConnection + from requests_aws4auth import AWS4Auth + + host = 'YOURHOST.us-east-1.es.amazonaws.com' + awsauth = AWS4Auth(YOUR_ACCESS_KEY, YOUR_SECRET_KEY, REGION, 'es') + + es = Elasticsearch( + hosts=[{'host': host, 'port': 443}], + http_auth=awsauth, + use_ssl=True, + verify_certs=True, + connection_class=RequestsHttpConnection + ) + print(es.info()) + +.. _requests-aws4auth: https://pypi.python.org/pypi/requests-aws4auth + Contents --------