Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: analytics to call aws secrets manager #1700

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions dataeng/resources/secrets-manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
secret_to_call="$1"
secret_name="$2"
set +x

SECRET_JSON=$(aws secretsmanager get-secret-value --secret-id $secret_to_call --region "us-east-1" --output json)
# Check the exit status of the AWS CLI command

echo "$SECRET_JSON"
extract_and_store_secret_value() {

value=$(echo "$SECRET_JSON" | jq -r ".SecretString | fromjson.$secret_name" 2>/dev/null)
eval "$secret_name"='$value'
}

if [ $? -eq 0 ]; then
# Use jq to extract the values from the JSON response
extract_and_store_secret_value $SECRET_JSON $secret_name
else
echo "AWS CLI command failed"
fi
5 changes: 5 additions & 0 deletions dataeng/resources/stitch-snowflake-lag-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ source "${PYTHON_VENV}/bin/activate"
cd $WORKSPACE/analytics-tools/snowflake
make requirements

source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS KEY_PATH
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS PASSPHRASE_PATH
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS USER
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS ACCOUNT

python stitch-snowflake-monitoring.py \
--key_path $WORKSPACE/analytics-secure/$KEY_PATH \
--passphrase_path $WORKSPACE/analytics-secure/$PASSPHRASE_PATH \
Expand Down
Loading