Created
March 8, 2017 11:12
-
-
Save sloev/f1eedda4ef97a7ab2ed45f22c7de030c to your computer and use it in GitHub Desktop.
error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3, os | |
from requests_aws4auth import AWS4Auth | |
from elasticsearch import Elasticsearch, RequestsHttpConnection | |
creds = boto3.Session().get_credentials() | |
awsauth = AWS4Auth( | |
creds.access_key, | |
creds.secret_key, | |
"eu-west-1", | |
'es', | |
session_token=creds.token | |
) | |
es = Elasticsearch( | |
hosts=[{'host': os.environ["ES_ENDPOINT"], 'port': 443}], | |
use_ssl=True, | |
verify_certs=True, | |
http_auth=awsauth, | |
connection_class=RequestsHttpConnection, | |
) | |
print(es.info()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment