Skip to content

AWS Dev Running Demo Runbook

This runbook executes the agreed running demo from D:\TradAI\demo-architecture.md. The scope is dry-run trading, not live exchange trading.

The scripts are POSIX-style Bash scripts intended for Linux/macOS. On Windows, verify them through Git Bash.

Environment

export AWS_PROFILE=tradai
export AWS_REGION=eu-central-1
export ENVIRONMENT=dev
export API_BASE=https://api-dev.tradai-system.com

export DEMO_STRATEGY=E2ETestStrategy
export DEMO_MODEL_NAME=E2ETestStrategy
export DEMO_LEADERBOARD_MODEL=PascalStrategy
export DEMO_SYMBOL='BTC/USDT:USDT'
export DEMO_TIMEFRAME=1h
export DEMO_EXCHANGE=binance_futures
export DEMO_START_DATE=2025-01-01
export DEMO_END_DATE=2025-02-01
export DEMO_FREQAI_MODEL=LightGBMRegressor

Required tools:

bash
curl
jq
aws

The scripts store runtime state in .demo-state/. This includes the Cognito token, backtest job_id, model versions, and dry-run ECS instance_id.

Full Flow

Run the complete running demo:

bash scripts/demo/run-all.sh

This executes every running-demo case in order:

00-pre-demo-setup.sh
01-login-auth.sh
02-catalog.sh
03-data-sync.sh
04-submit-backtest.sh
05-track-progress.sh
06-results-kpis.sh
07-leaderboard.sh
08-stage-model.sh
09-dry-run-start.sh
10-status-pnl-logs.sh
11-promote-production.sh
12-observability.sh
13-rollback.sh
14-cleanup.sh

Individual Cases

Each architecture step can be reproduced separately.

0. Pre-Demo Setup

bash scripts/demo/00-pre-demo-setup.sh

Checks AWS identity, required S3 buckets, ALB HTTPS/redirect, WAF association, Cognito user pool and M2M client, confirmed SNS subscription, ECS circuit breakers, demo model registration, and backend health.

1. Login/Auth

bash scripts/demo/01-login-auth.sh

Checks anonymous 401, Cognito M2M token acquisition, and authenticated access to a protected backend route.

2. Strategy Catalog

bash scripts/demo/02-catalog.sh

Checks catalog listing, demo strategy detail, and registered MLflow model versions.

3. Data Sync And Coverage

bash scripts/demo/03-data-sync.sh

Checks data freshness, syncs the demo date range, and verifies the architecture coverage endpoint:

GET /api/v1/data/coverage

4. Submit Backtest

bash scripts/demo/04-submit-backtest.sh

Submits a fresh backtest and stores job_id in .demo-state/job_id.

5. Track Progress

bash scripts/demo/05-track-progress.sh

Polls the backtest job until it reaches completed.

6. Results And KPIs

bash scripts/demo/06-results-kpis.sh

Checks job result payload, equity endpoint, report-data endpoint, non-empty trace_id, and real 40-character git_commit.

7. Leaderboard

bash scripts/demo/07-leaderboard.sh

Checks that the default Production leaderboard is non-empty and that the configured demo leaderboard stage also has scored entries.

8. Stage Model

bash scripts/demo/08-stage-model.sh

Stages the selected demo model version through:

POST /api/v1/strategies/{name}/stage

Set DEMO_MODEL_VERSION to force a specific version.

9. Start Dry-Run Trading

bash scripts/demo/09-dry-run-start.sh

Launches the demo strategy in dry-run mode and waits until ECS reports the strategy task as RUNNING.

10. Status, PnL, Logs

bash scripts/demo/10-status-pnl-logs.sh

Checks CloudWatch logs through the backend endpoint, trading status, and PnL snapshot visibility for the running dry-run strategy.

11. Promote Production Alias Without Live Trading

bash scripts/demo/11-promote-production.sh

Promotes the selected model version to Production. This changes model registry state but does not start live trading.

12. Observability

bash scripts/demo/12-observability.sh

Checks confirmed SNS subscription, ECS deployment circuit breakers, CloudWatch dashboard, and CloudWatch log group readability.

13. Rollback

bash scripts/demo/13-rollback.sh

Performs an actual model rollback to DEMO_ROLLBACK_TARGET_VERSION or the Production version captured before Step 11.

14. Cleanup

bash scripts/demo/14-cleanup.sh

Stops the dry-run task if one was started, scales the strategy service to zero, and waits for desired=0, running=0, pending=0, rollout COMPLETED.

Architecture Coverage Matrix

Architecture item Script
Pre-demo setup 00-pre-demo-setup.sh
Step 1: Login 01-login-auth.sh
Step 2: Browse strategy catalog 02-catalog.sh
Step 3: Sync market data 03-data-sync.sh
Step 4: Submit backtest 04-submit-backtest.sh
Step 5: Track progress 05-track-progress.sh
Step 6: View results and KPIs 06-results-kpis.sh
Step 7: Compare leaderboard 07-leaderboard.sh
Step 8: Promote to Staging 08-stage-model.sh
Step 9: Paper-trade staged version 09-dry-run-start.sh
Step 10: Watch PnL/status/logs 10-status-pnl-logs.sh
Step 11: Promote champion 11-promote-production.sh
Step 12: Observability 12-observability.sh
Step 13: Rollback 13-rollback.sh
Step 14: Cleanup 14-cleanup.sh

Current Implementation Note

The shell scripts intentionally fail when an agreed architecture endpoint or runtime behavior is missing. For example, Step 3 requires /api/v1/data/coverage, so this branch adds that backend route instead of substituting a different endpoint.