
Building Sustainify AI: How 6 AWS Services Power a Zero-Cost Sustainability Scanner in Under 3 Seconds.
What if your phone camera could tell you whether to buy, recycle, donate, or repurpose any product instantly? Sustainify AI is a Flutter mobile app that uses Amazon Rekognition, Lambda, S3, DynamoDB, API Gateway, and Cognito to deliver instant eco-scores and AI-powered disposal guidance. No external APIs, no monthly bills just scan, score, and sustain, all running serverlessly on AWS Free Tier.
🌍 The Problem That Made Me Build This
Here's a number that changed how I think about consumption: over 2 billion tonnes of waste ends up in landfills every single year. That's not a distant, abstract statistic — it's the plastic container I threw away last Tuesday because I didn't know it was recyclable.
The truth is, most of us want to make sustainable choices. But the information is buried in fine print, scattered across obscure websites, or simply doesn't exist for the product sitting in our hands.
I kept asking myself one question:
What if your phone camera could instantly tell you — before you buy — whether a product is eco-friendly? And after you're done with it — exactly how to dispose of it responsibly?
That question became Sustainify AI.
🔧 What is Sustainify AI?
Sustainify AI is a mobile application built with Flutter that helps users make sustainable decisions at two critical moments in a product's lifecycle:
🛒 Shop Smart — Before You Buy
Point your camera at any product or its packaging. In under 3 seconds, you get:
- An instant eco-score (0–100) across 5 weighted dimensions
- Recyclability analysis — can it be recycled in standard programs?
- Material breakdown — what's it actually made of?
- Better alternatives — suggestions for more sustainable options
♻️ Dispose Smart — After You're Done
Scan an item you want to get rid of. The app tells you:
- The best action: Recycle, Donate, Compost, Repair, Reuse, or Safe Disposal
- Step-by-step instructions specific to the detected material
- Hazard flags for batteries, electronics, or chemicals
- DIY upcycling ideas — because the most sustainable product is the one you don't throw away
🏗️ Architecture: 100% AWS, Zero External Dependencies
Every byte of compute, storage, and intelligence runs on AWS Free Tier. No external AI APIs. No third-party services. No surprise invoices.
AWS Service | Role | Free Tier Allowance |
|---|---|---|
Amazon API Gateway | HTTP entry point — routes all client requests | 1M requests/month |
AWS Lambda | Serverless compute — runs the analysis engine | 1M invocations/month |
Amazon S3 | Secure image storage with presigned upload URLs | 5 GB storage |
Amazon DynamoDB | NoSQL database — stores every scan per user | 25 GB + 25 RCU/WCU |
Amazon Rekognition | Computer vision — detects materials, objects, packaging | 5,000 images/month |
Amazon Cognito | User authentication with email verification | 50,000 MAU |
Architecture Flow
┌─────────────┐ ┌──────────────┐ ┌──────────┐│ Flutter App │────▶│ API Gateway │────▶│ Lambda ││ (Mobile) │ │ (REST API) │ │ (Engine) │└─────────────┘ └──────────────┘ └──────┬───┘ │ │ │ JWT Token ┌─────────┼─────────┐ │ │ │ │ ┌────▼─────┐ ┌─────▼──┐ ┌────▼───┐ ┌───▼────────┐ │ Cognito │ │ S3 │ │Rekogn. │ │ DynamoDB │ │ (Auth) │ │(Images)│ │ (AI) │ │ (History) │ └──────────┘ └────────┘ └────────┘ └────────────┘
⚙️ How It Works — Step by Step
Step 1: Secure Authentication (Amazon Cognito)
Users sign up with email and password. Cognito handles everything — secure password hashing via SRP protocol, automated verification emails, configurable password policies, and JWT token issuance. The Flutter app stores these tokens locally and attaches them as Authorization headers to every API call.
Why Cognito? Building custom auth would have taken half the hackathon. Cognito gives production-grade security — email verification, token refresh, and password recovery — with zero backend code.
Step 2: Intelligent Image Upload (S3 + Lambda + API Gateway)
When a user captures or selects an image, the app doesn't upload it through API Gateway (which has a 10 MB payload limit and charges for data transfer). Instead:
- The app calls Lambda via API Gateway
- Lambda generates a presigned S3 URL — a temporary, cryptographically signed link
- The Flutter app uploads the image directly to S3 using this URL
- Upload happens client-to-S3, bypassing API Gateway entirely
Why this matters: Direct-to-S3 uploads eliminate the Lambda payload size limit, reduce API Gateway data transfer costs to zero, and cut upload latency by removing an unnecessary network hop.
Step 3: AI-Powered Analysis (Amazon Rekognition + Lambda)
Once the image lands in S3, a second API call triggers the intelligence layer:
- Lambda calls Amazon Rekognition's
DetectLabelsAPI on the uploaded image
- Rekognition returns up to 20 labeled objects with confidence scores — e.g., "Plastic" (97.2%), "Bottle" (94.8%), "Cardboard" (91.3%), "Glass" (88.6%)
- Lambda feeds these labels into our Sustainability Knowledge Base — a curated mapping of 20+ material categories to eco-scores, recyclability ratings, disposal protocols, hazard flags, and upcycling ideas
- The result is a structured JSON response tailored to either Shop Smart or Dispose Smart mode
Step 4: Persistent Scan History (DynamoDB)
Every analysis is stored in DynamoDB with a composite key of
userId + timestamp , along with the scan mode, detected labels, scores, and full recommendations. Users can revisit their complete scan history at any time — building a personal sustainability journal that tracks their eco-conscious choices over time.
🧠 The Sustainability Scoring Engine
Our Lambda function doesn't just pass through raw Rekognition labels. It runs a multi-factor weighted scoring algorithm across 5 dimensions:
Shop Smart Scoring (100 points total)
Dimension | Weight | What It Measures |
|---|---|---|
Packaging Score | 25 pts | Environmental impact of detected packaging materials |
Material Score | 25 pts | Eco-friendliness of identified product materials |
Recyclability Score | 20 pts | How easily the product enters standard recycling streams |
Reusability Score | 15 pts | Potential for reuse, repurposing, or second life |
Product Signals Score | 15 pts | Presence of eco-positive indicators (organic labels, minimal packaging) |
Dispose Smart Actions
For post-use scanning, the engine determines the single best action and provides actionable guidance:
- RECYCLE — step-by-step sorting instructions by material type
- DONATE — suggestions for local donation channels
- COMPOST — composting viability and method instructions
- REPAIR — repair feasibility assessment
- REUSE / REPURPOSE — creative DIY upcycling ideas
- SAFE DISPOSAL — hazardous material handling for batteries, e-waste, chemicals
🤔 Why Amazon Rekognition Instead of Bedrock?
This was a deliberate architectural decision, not a limitation:
Factor | Rekognition | Bedrock |
|---|---|---|
Activation | Instant — no access request needed | Requires approval (can take days) |
Free Tier | 5,000 images/month for 12 months | Limited / varies by model |
Response Time | Structured labels in < 2 seconds | Token-by-token generation, higher latency |
Output | Deterministic JSON — same input = same output | Probabilistic — outputs can vary |
Fit | Purpose-built for object & material detection | General-purpose, overkill for labels |
The key insight: Not every AI problem needs a foundation model. Sometimes the best architecture is a purpose-built vision API paired with domain-specific business logic.💡 What I Learned1. Presigned URLs are a superpower — Direct-to-S3 uploads eliminate the Lambda 6 MB payload limit, cut API Gateway data transfer costs, and improve upload speed. This should be the default pattern for any serverless file upload. 2. Rekognition is underrated for rapid prototyping — For hackathons and MVPs, DetectLabels is incredibly fast to integrate (3 lines of boto3) and surprisingly accurate for material identification. Don't reach for Bedrock when Rekognition solves your problem. 3. Cognito saves you an entire day — Instead of building custom auth, Cognito handles signup, email verification, password policies, and token management out of the box. That's hours I redirected toward the actual product. 4. SAM makes serverless approachable — Defining all resources in one YAML file and deploying with one command dramatically reduced the infrastructure learning curve. 5. Domain knowledge > model size — The sustainability knowledge base — a curated mapping of materials to eco-scores — is where the real value lives. Rekognition tells us what it sees; our knowledge base tells us what it means for the planet.🌱 Impact & What's Next Sustainify AI proves that meaningful environmental technology doesn't require expensive infrastructure. Running entirely on AWS Free Tier, it puts sustainability intelligence in the hands of anyone with a smartphone.Future roadmap:📊 Barcode/QR scanning for richer product data 🏆 Community leaderboards using DynamoDB Streams + Lambda 📍 Regional disposal rules — recycling varies by municipality 🌿 Carbon footprint tracking — aggregate lifetime impact per user
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article