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
| #!/bin/bash | |
| # fintechner — gate #7: print all critical secrets to terminal so you can | |
| # write them on paper / save to password manager. NEVER paste output to chat. | |
| # | |
| # If AWS Secrets Manager has a regional outage you cannot re-sign or | |
| # decrypt the credential store. These are your only fallbacks. | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 |
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
| #!/bin/bash | |
| # fintechner — live inventory of the deployed system. | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| echo "============================================================" | |
| echo " AWS-side" | |
| echo "============================================================" |
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
| #!/bin/bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| echo "=== 1. Enable termination protection (idempotent) ===" | |
| aws --region "$REGION" ec2 modify-instance-attribute \ | |
| --instance-id "$INSTANCE_ID" \ | |
| --disable-api-termination "{\"Value\":true}" |
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
| #!/bin/bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| SQL_B64=$(base64 -w0 <<'SQL' | |
| SELECT 'closed_trades:'||COUNT(*) FROM closed_trades; | |
| SELECT 'fills by origin:' AS x; | |
| SELECT origin, COUNT(*) FROM fills GROUP BY origin; |
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
| #!/bin/bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| CMD_ID=$(aws --region "$REGION" ssm send-command \ | |
| --instance-ids "$INSTANCE_ID" \ | |
| --document-name AWS-RunShellScript \ | |
| --parameters '{"commands":["echo === restart connector ===","sudo systemctl restart fintechner-connector","sleep 10","echo === backfill log lines ===","sudo journalctl -u fintechner-connector --since \"30 sec ago\" --no-pager | grep -iE \"closedtrades|backfill|closed trade|fatal|ERROR\" | head -30","echo === closed_trades count after restart ===","sudo docker exec timescale psql -U fintechner -d fintechner -tA -c \"SELECT COUNT(*) FROM closed_trades;\""]}' \ |
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
| #!/bin/bash | |
| # 1) restore connector.env now, 2) tell user the deploy gist is patched. | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| ADMIN_EMAIL="koliadych@gmail.com" | |
| echo "=== Restoring connector.env from Secrets Manager ===" | |
| DB_PWD=$(aws --region "$REGION" secretsmanager get-secret-value --secret-id fintechner/db-password --query SecretString --output text) |
OlderNewer