Skip to content

Instantly share code, notes, and snippets.

@surendra-wal
Created February 20, 2024 07:21
Show Gist options
  • Save surendra-wal/46aab7b546a73b615421aad9b8ed838f to your computer and use it in GitHub Desktop.
Save surendra-wal/46aab7b546a73b615421aad9b8ed838f to your computer and use it in GitHub Desktop.
create opensearch domain in localstack
#!/bin/bash
export AWS_ACCESS_KEY_ID="test"
export AWS_SECRET_ACCESS_KEY="test"
export AWS_DEFAULT_REGION="us-east-2"
ENDPOINT_URL="http://localhost:4566"
echo "Creating OpenSearch Domain"
echo "$(aws opensearch create-domain --endpoint-url=$ENDPOINT_URL --domain-name local-messenger-search --advanced-security-options Enabled=false) created"
check_processing_status() {
domainStatus=$(aws opensearch describe-domain --endpoint-url=$ENDPOINT_URL --domain-name local-messenger-search)
echo $domainStatus
processing=$(echo "$domainStatus" | awk -F'"Processing": ' '{print $2}' | awk -F ',' '{print $1}')
if [ $processing == true ]; then
echo "Processing status is still true. Waiting..."
return 1
else
echo "Processing status is now false. Exiting from loop."
return 0
fi
}
while :; do
check_processing_status
if [ $? -eq 0 ]; then
break
fi
sleep 20
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment