Skip to content

Instantly share code, notes, and snippets.

@sloev
Created March 8, 2017 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sloev/f1eedda4ef97a7ab2ed45f22c7de030c to your computer and use it in GitHub Desktop.
Save sloev/f1eedda4ef97a7ab2ed45f22c7de030c to your computer and use it in GitHub Desktop.
error
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