Created
February 26, 2020 06:24
-
-
Save prasvats/34d6dea516f13fe27427928dce098b5a to your computer and use it in GitHub Desktop.
Python Script to test ElasticSearch
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 | |
import json | |
import requests | |
from requests_aws4auth import AWS4Auth | |
#Get Temporary Credentials | |
credentials = boto3.Session().get_credentials() | |
service = 'es' | |
region = 'ap-southeast-2' | |
url="https://vpc-xx-xxxxxxxxx.ap-southeast-2.es.amazonaws.com/_cluster/health" | |
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token) | |
r=requests.get(url, auth=awsauth) | |
print(r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment