Created
February 18, 2022 21:53
-
-
Save tthyer/9925b96797ce3a39d9b9b1ab018d74d8 to your computer and use it in GitHub Desktop.
query-aurora.sh
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
#! /bin/bash | |
# Script to execute a SQL query through awscli | |
set -ex | |
CLUSTER_ARN='arn:aws:rds:us-east-1:035458030717:cluster:tower' | |
SECRET_ARN=$(aws secretsmanager describe-secret \ | |
--secret-id nextflow-aurora-mysql-MasterSecret | jq -r .ARN) | |
QUERY="${1}" | |
# execute SQL query | |
aws rds-data execute-statement \ | |
--resource-arn "${CLUSTER_ARN}" \ | |
--schema "mysql" \ | |
--secret-arn "${SECRET_ARN}" \ | |
--sql "${QUERY}" | |
set +ex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment