IRCTC PNR Status Notifier is a serverless AWS Lambda (Python 3.11) project that automatically checks your Indian Railway PNR status via the ConfirmTkt API and sends real-time SMS/Email alerts through AWS SNS.
It is designed to run on a schedule using Amazon EventBridge Scheduler, so you never have to manually refresh IRCTC or ConfirmTkt pages again.
- ✅ Real-time PNR Tracking – fetches live Indian Railway PNR status using ConfirmTkt API
- ✅ Instant Alerts – sends notifications via AWS SNS (SMS & Email supported)
- ✅ Serverless & Cost-Effective – built with AWS Lambda (Python 3.11)
- ✅ Customizable Scheduling – integrate with EventBridge Scheduler for periodic checks
- ✅ Minimal Setup – repo includes Lambda function code & IAM policy only
- ✅ User-Managed Infra – you create the SNS Topic & EventBridge rules as per your needs
Built as a 1-hour mini hack, this notifier saves you from the repetitive hassle of checking your railway booking status. Simply deploy, schedule, and receive automated updates — no apps, no ads, just pure serverless automation.
Perfect for travelers, developers, and hobbyists who want hands-free IRCTC PNR monitoring.
The following diagram shows how the IRCTC PNR Status Notifier works:
Flow explanation:
- EventBridge Scheduler runs on a cron/rate expression (e.g., hourly).
- Scheduler invokes Lambda with an optional JSON input (e.g.,
{"PNR":"4224374267"}). - Lambda calls the ConfirmTkt API, parses the passenger statuses, and compares against the previous run stored in SSM Parameter Store.
- If there is a change (e.g., WL → CNF), Lambda formats a message and publishes it to SNS Topic.
- SNS delivers the alert to your phone (SMS) or email inbox.
index.py— Lambda function (urllib-only, Python 3.11)infra/iam-lambda-policy.json— IAM permissions for the Lambda role
Note: This repo does not create EventBridge Scheduler or SNS for you. You create them in your own AWS account.
- In AWS Console → IAM → Roles → Create role.
- Trusted entity: Lambda.
- Attach CloudWatchLogsFullAccess (or equivalent minimal logging).
- Attach an inline policy using
infra/iam-lambda-policy.json.- Replace
ACCOUNT_IDandregionin ARNs with your values.
- Replace
- Console → SNS → Topics → Create topic.
- Example name:
pnr-updates. - Add subscriptions:
- Email (free) → confirm via email.
- SMS (India ~₹1–1.5/msg).
- Copy the Topic ARN (e.g.,
arn:aws:sns:REGION:123456789012:pnr-updates).
- Zip and deploy:
zip lambda.zip index.py
aws lambda create-function --function-name pnr-watch --runtime python3.11 --role arn:aws:iam::ACCOUNT_ID:role/pnr-watch-role --handler index.handler --timeout 30 --zip-file fileb://lambda.zip --region REGION- Update environment variables:
aws lambda update-function-configuration --function-name pnr-watch --environment "Variables={
PNR=4224374267,
SNS_TOPIC_ARN=arn:aws:sns:REGION:ACCOUNT_ID:pnr-updates,
SSM_PARAM_NAME=/pnr/4224374267/last_statuses,
HTTP_TIMEOUT=10,
TEST_SMS=1
}"- Invoke manually once:
aws lambda invoke --function-name pnr-watch --payload '{}' out.jsonYou should receive a test snapshot SMS/Email. After verification, set TEST_SMS=0.
- Console → EventBridge Scheduler → Create schedule.
a- Expression:
cron(0 * * * ? *)→ every hour, at minute 0. (Timezone: Asia/Kolkata recommended.) - Target: Lambda function (
pnr-watch). - Input (optional if
PNRis set via env):
{"PNR": "4224374267"}(Optional) Add a second schedule near the Date of Journey (DOJ) with higher frequency (
rate(10 minutes)) using start/end dates.
| Variable | Required | Default | Description |
|---|---|---|---|
SNS_TOPIC_ARN |
✅ Yes | — | SNS Topic ARN for alerts |
PNR |
✅ Yes | — | Default PNR (if not provided by Scheduler input) |
SSM_PARAM_NAME |
❌ No | /pnr/<PNR>/last_statuses |
Where last statuses are persisted |
HTTP_TIMEOUT |
❌ No | 10 |
HTTP timeout in seconds |
TEST_SMS |
❌ No | 0 |
If 1, always send snapshot on every run |
LOG_PAYLOAD_PREVIEW |
❌ No | 0 or 400 |
Log body snippet bytes (0 to disable) |
🚆 PNR 4224374267
Train: DURONTO EXPRESS (12246)
DOJ: 26-10-2025 | Class: 1A
P1 ➜ CNF
P2 ➜ GNWL 1 (91% Chance)
Chart: Not Prepared
- Lambda: ~4,300 invocations/month → Free tier (1M free).
- EventBridge Scheduler: ~4,300 schedules/month → Free tier (100k free).
- SNS Email: Free.
- SNS SMS (India): ~₹1–1.5 per alert.
Since you only care about status flips, total cost ≈ ₹2–3 per journey.
- This project is intended for personal use.
- ConfirmTkt API is used for fetching PNR info.
- Always respect site ToS.
- You can monitor multiple PNRs by creating multiple schedules with different
Inputpayloads.
