Upload your PDF resume → Lambda extracts text (Textract if scanned) → embeds with Amazon Bedrock → compares against jobs in S3 → Bedrock LLM explains the match → results appear in the browser.
Browser (upload.html)
├─ uses Cognito Identity Pool (unauth) → temporary AWS creds
├─ PUT s3://<bucket>/resumes/<timestamp>_<name>.pdf
└─ polls s3://<bucket>/results/<same>.json
S3 (bucket)
└─ ObjectCreated (prefix: resumes/) → triggers Lambda
Lambda (AnalyzeFn)
├─ s3:GetObject resume
├─ Textract OCR (if needed)
├─ Bedrock embeddings (Titan) for resume + jobs
├─ cosine similarity → top-K
├─ Bedrock LLM (Claude) for reasons/strengths/gaps/fit score
└─ s3:PutObject results/<same>.json
AWS Services
- Amazon S3 – static site, input
resumes/, datasetjobs/jobs.json, outputresults/ - AWS Lambda – analysis pipeline (extraction → embedding → ranking → LLM summary)
- Amazon Textract – OCR for scanned PDFs
- Amazon Bedrock – Titan (embeddings) + Claude Sonnet (LLM)
- Amazon Cognito Identity Pools – unauth role for browser PUT/GET to S3 (scoped prefixes)
resume-match/
├─ template.yaml # SAM/CFN: S3 bucket, S3→Lambda notification, Lambda config & IAM
├─ samconfig.toml # stack=resume-match, region=ap-south-1, BucketName override
├─ analyze_fn/
│ ├─ app.py # Lambda function (hardcoded BUCKET/models; writes results/*)
│ ├─ __init__.py # empty/marker
│ └─ requirements.txt # empty on purpose (boto3 provided by Lambda runtime)
├─ site/
│ └─ upload.html # Static UI (hardcoded region & bucket; Cognito ID placeholder)
├─ data/
│ └─ jobs.json # Demo job dataset
├─ policies/
│ ├─ cognito-unauth-s3-policy.json # attach to unauth role; allows PUT resumes/*, GET results/* (+ multipart perms)
│ └─ s3-cors.xml # CORS: GET/PUT/HEAD, ETag exposed
└─ scripts/
├─ deploy.sh # SAM deploy + inject Cognito ID + upload site/data + apply CORS + enable website
├─ package.sh # sam validate + sanity checks
└─ terminate.sh # empty bucket + delete stack
-
AWS account with permissions for S3, Lambda, CloudFormation/SAM, Textract, Bedrock, and Cognito
-
AWS CLI v2 and AWS SAM CLI installed and configured
-
Region:
ap-south-1(Mumbai) for all services in this demo -
Bedrock model access enabled in
ap-south-1for:amazon.titan-embed-text-v1anthropic.claude-3-sonnet-20240229-v1:0
-
Cognito Identity Pool created (enable unauthenticated identities)
- Attach the policy from
policies/cognito-unauth-s3-policy.json(update bucket name if you changed it) - Copy the Identity pool ID (
ap-south-1:xxxxxxxx-xxxx-...)
- Attach the policy from
# 0) Create Cognito Identity Pool (unauth) and attach the policy
# 1) Enable Bedrock model access (Titan embeddings + Claude Sonnet) in ap-south-1
# 2) Deploy infrastructure + site
sam build && sam deploy
bash scripts/deploy.shThe script will:
- Deploy the SAM stack with bucket (
resume-match-jmanoj0905-ap-south-1) - Inject IDENTITY_POOL_ID into a temp HTML
- Upload
upload.htmlanddata/jobs.json - Apply CORS to the bucket from
policies/s3-cors.xml - Enable Static website hosting (index =
upload.html)
Open:
http://resume-match-jmanoj0905-ap-south-1.s3-website-ap-south-1.amazonaws.com
- Deploy infra
sam build
sam deploy --stack-name resume-match \
--region ap-south-1 \
--capabilities CAPABILITY_IAM \
--parameter-overrides BucketName=resume-match-jmanoj0905-ap-south-1- Upload the site & dataset
# inject your Cognito Identity Pool ID into a temp html (keeps secrets out of Git)
sed "s|ap-south-1:REPLACE-WITH-YOUR-IDENTITY-POOL-ID|ap-south-1:YOUR-REAL-ID|" site/upload.html > /tmp/upload.html
aws s3 cp /tmp/upload.html s3://resume-match-jmanoj0905-ap-south-1/upload.html \
--content-type text/html
aws s3 cp data/jobs.json s3://resume-match-jmanoj0905-ap-south-1/jobs/jobs.json- Apply CORS
aws s3api put-bucket-cors \
--bucket resume-match-jmanoj0905-ap-south-1 \
--cors-configuration file://policies/s3-cors.xml- Enable website hosting
aws s3 website s3://resume-match-jmanoj0905-ap-south-1/ --index-document upload.htmlFront-end (site/upload.html)
-
Hardcoded
region+bucket -
identityPoolIdplaceholder is replaced by the deploy script (from.env) -
Uses AWS JS SDK v2:
AWS.CognitoIdentityCredentials→ temporary AWS credss3.upload→ uploads toresumes/<timestamp>_<filename>.pdf- Polls
s3.getObjectforresults/<same>.json; in the browser,data.Bodyis a Blob → parse viaawait data.Body.text()thenJSON.parse
Lambda (analyze_fn/app.py)
-
Triggered by S3 ObjectCreated on keys prefixed with
resumes/ -
Steps:
- Read resume; if not a PDF, decode UTF‑8; else Textract OCR (async → poll until
SUCCEEDED) - Embed resume text with Titan Embeddings (Bedrock)
- Load jobs from
jobs/jobs.json(S3) - For each job: embed, cosine similarity to resume vector
- Take Top‑K (default 5). For each, call Claude Sonnet (Bedrock) to produce:
reasons,strengths,gaps,fit_score(JSON) - Write
results/<same-name>.jsonback to S3
- Read resume; if not a PDF, decode UTF‑8; else Textract OCR (async → poll until
IAM (principle of least privilege)
- Cognito unauth role:
s3:PutObject(+ multipart actions) toresumes/*,s3:GetObject/HeadObjecttoresults/* - Lambda execution role: bucket‑scoped
s3:GetObject/PutObject,textract:*DocumentTextDetection, andbedrock:InvokeModel - S3 → Lambda:
AWS::Lambda::Permission(Principal: s3.amazonaws.com,SourceArn= bucket ARN)
- Open the S3 website endpoint (or a presigned URL)
- Choose a small PDF résumé (text PDFs return faster than scanned)
- Click Upload & Analyze
- Wait ~30–120s (Textract + embeddings + LLM). The page polls S3 and renders results
Logs: CloudWatch Logs → /aws/lambda/<AnalyzeFnName>
- S3 + Lambda: small (storage + requests + short Lambda durations)
- Textract: billed per page (dominant for scanned PDFs)
- Bedrock: pay‑per‑request (embeddings + LLM)
- Cognito: free for Identity Pools
Tip: keep PDFs short for dev. Reduce Bedrock calls by lowering Top‑K.
- 403 on website: add a bucket policy to allow public GET of
upload.html, or use a presigned URL. - CORS errors: re‑apply
policies/s3-cors.xml; ensure region/bucket in HTML match reality. - Lambda not triggered: key must start with
resumes/; verify S3 Notification + Lambda Permission. - AccessDenied on Bedrock/Textract: enable model access; check Lambda IAM.
- Result never appears: increase polling timeout; check CloudWatch Logs for Textract/Bedrock errors.
bash scripts/terminate.shThis empties the bucket and deletes the stack. (If bucket versioning is enabled, delete object versions first.)
analyze_fn/requirements.txtis intentionally empty (Lambda includesboto3).- Switch models by editing
EMBED_MODEL/LLM_MODELinapp.py(or wire to env vars). - To scale matching, pre‑embed jobs once and store vectors in OpenSearch (k‑NN) instead of re‑embedding per run.
