Created
April 16, 2020 22:17
-
-
Save perryism/e54f81994b27b92f304bbd3b39c82bc2 to your computer and use it in GitHub Desktop.
ElasticSearch Proxy
This file contains hidden or 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
function es_proxy () { | |
if [ ! -z $1 ] | |
then | |
profile="-e AWS_PROFILE=$1" | |
echo $1 profile will be used | |
fi | |
if [ -z $REGION ] | |
then | |
REGION="us-west-2" | |
echo $REGION region is used | |
fi | |
ES_DOMAIN_NAME=$(aws es list-domain-names --region $REGION --query "DomainNames[].DomainName" --output text | tr -s '\t' '\n' | pick) | |
ELASTICSEARCH_ENDPOINT=https://$(aws es describe-elasticsearch-domain --domain-name=$ES_DOMAIN_NAME --region=$REGION | jq -r .DomainStatus.Endpoint) | |
$(docker run --rm -it -p 9200:9200 -v ~/.aws:/root/.aws $profile abutaha/aws-es-proxy:0.9 -listen=0.0.0.0:9200 -verbose -endpoint $ELASTICSEARCH_ENDPOINT) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment