AWS Mumbai (ap-south-1) Cloud Deployment Guide

Cost-optimized, scheduled automated production runbook for QuadraTrades

AWS ap-south-1 ~$9.23/MO (~₹775) GRAVITON2 t4g.small ZERO OPEN PORTS (SSM)

1. Architecture & Cost Optimization Framework

The architecture uses an automated scheduled control plane to run strictly during NSE market hours (08:45 to 16:00 IST, Monday through Friday):

Total Monthly Cost
$9.23 / mo
~₹775 / month @ ₹84/$
Compute Hours
160 hrs / mo
7.25 hrs/day, 22 trading days
Inbound Network Attack Surface
0 Ports Open
100% AWS SSM Session Manager
AWS Service Configuration Monthly Cost (USD) Monthly Cost (INR @ ₹84/$)
EC2 Compute t4g.small ARM64 Graviton2 (159.5 hrs @ $0.0168/hr) $2.68 ₹225
Retained Elastic IP Static EIP (idle ~570.5 hrs @ $0.005/hr) for FYERS whitelist $2.85 ₹239
Encrypted EBS 30 GiB gp3 root volume @ $0.096/GiB-mo $2.88 ₹242
S3 Storage Encrypted daily trading journals & audit archives $0.25 ₹21
EventBridge + Lambda Free tier eligible (< 1M requests/mo) $0.00 ₹0
AWS Systems Manager Standard Session Manager (SSM) $0.00 ₹0
CloudWatch Logs Ingestion & 30-day retention $0.57 ₹48
TOTAL SCHEDULED PRODUCTION Full Automated Live Deployment $9.23 / mo ~₹775 / mo

2. Infrastructure Provisioning Runbook

STEP 1 Deploy AWS CloudFormation Stack (1 Command)

Deploy the complete VPC, EC2 instance, Elastic IP, IAM roles, and EventBridge schedulers:

aws cloudformation deploy \ --template-file deploy/aws/template.yaml \ --stack-name nifty-expansion-runner-prod \ --capabilities CAPABILITY_NAMED_IAM \ --parameter-overrides \ ProjectName=nifty-expansion-runner \ Environment=prod \ InstanceType=t4g.small \ EbsVolumeSize=30
STEP 2 Whitelist Elastic IP on FYERS Developer Portal

Query the allocated static IP and paste it into the FYERS order origin IP whitelist:

aws cloudformation describe-stacks \ --stack-name nifty-expansion-runner-prod \ --query "Stacks[0].Outputs[?OutputKey=='ElasticIPAddress'].OutputValue" \ --output text
STEP 3 Connect Securely via AWS Systems Manager (SSM)

Start a secure interactive shell without exposing SSH port 22:

# Interactive Terminal Session INSTANCE_ID=$(aws cloudformation describe-stacks --stack-name nifty-expansion-runner-prod --query "Stacks[0].Outputs[?OutputKey=='InstanceId'].OutputValue" --output text) aws ssm start-session --target $INSTANCE_ID

Secure private port forwarding for the Live Operational HUD (connect to localhost:8080 on your local machine):

aws ssm start-session \ --target $INSTANCE_ID \ --document-name AWS-StartPortForwardingSession \ --parameters '{"portNumber":["8080"],"localPortNumber":["8080"]}'

3. Automated Daily Lifecycle (IST Schedule)

Time (IST) Action Automation Trigger
08:45:00 Instance Boots EventBridge Rule StartSchedule invokes Control Lambda
08:47:00 Engine Launches Host systemd service nifty-runner.service starts engine
09:00:00 Pre-Market Routine PreMarketAnalyzer ingests GIFT NIFTY, open interest, and gap levels
09:15:00 Trading Session Opens Strategies monitor 5m/3m structure and sub-candle tick liquidity
15:15:00 Entry Gate Locks No new trade entries permitted; positions managed dynamically
15:20:00 Auto-Square-Off All intraday positions flattened automatically
15:30:00 EOD Audit & Analysis Engine generates detailed forensic trade analysis HTML and pushes to Telegram
15:55:00 Safe-Stop Handshake SSM command verifies 0 open positions and archives journals to S3
16:00:00 Safe Shutdown EventBridge triggers instance stop. Billing pauses until 08:45 next day.