AWS Builder Center

Building AIRGUARD on AWS: An AI-Powered Air Quality Intelligence Platform

Discover how we built AIRGUARD, a platform combining air-quality intelligence, AI-powered recommendations, geospatial insights, and cloud deployment on Amazon EC2 to help people make more informed environmental decisions.

Introduction

Imagine planning a morning run, sending your child to school, or choosing a route to college. Wouldn't it be useful to know not only the air quality in your city, but also how pollution might change and what precautions you should consider?
This is the problem we set out to address with AIRGUARD — an AI-powered air quality intelligence and personal safety platform.
Air pollution is more than a number on a dashboard. People need to understand where pollution may be concentrated, how it might change, and how they can make more informed everyday decisions.
AIRGUARD brings air-quality information, forecasting interfaces, geospatial insights, exposure estimation, and AI-powered recommendations into one platform.

What Is AIRGUARD?

AIRGUARD is designed to help citizens, students, parents, commuters, schools, and communities explore environmental information and understand its potential implications.
The platform brings together several capabilities:
  • Overview Dashboard: Presents AQI information, pollutant measurements, and safety guidance.
  • Live GIS Map: Helps users explore location-based environmental information.
  • ML Forecast: Displays hourly and multi-day air-quality forecasts.
  • Clean Routes: Supports comparison of journeys using travel and estimated pollution-exposure information.
  • Exposure Engine: Estimates PM2.5 exposure across daily activities and locations.
  • Activity Planner: Helps users consider air-quality conditions when planning outdoor activities.
  • Predictive Alerts: Supports alerts for configured environmental risks.
  • Citizen Reports: Provides an interface for reporting pollution incidents.
  • School Safety Hub: Presents campus-related air-quality information and precautionary guidance.
  • Indoor IoT: Provides an interface for indoor air-quality measurements and compatible device information.
  • Analytics Hub: Presents historical trends and pollutant comparisons.
  • City Command: Explores simulated environmental interventions.
  • AI Assistant: Allows users to ask natural-language questions about air quality and related safety considerations.
These capabilities aim to make environmental information more accessible and actionable. Forecasts, exposure estimates, and simulations should be interpreted according to the data and models supporting them.

Technology Stack

AIRGUARD combines modern web technologies and application services:
  • Next.js for the frontend.
  • FastAPI for backend APIs.
  • Python for application logic and AI-related workflows.
  • PostgreSQL/PostGIS for structured and geospatial data.
  • Redis for supporting application workloads.
  • Docker Compose for managing containerized application components.
  • Amazon EC2 for cloud hosting.
The modular architecture allows the frontend, backend, database, cache, and supporting components to operate together as an integrated application.

Deploying AIRGUARD on Amazon EC2

As the team leader, I focused on web development, application integration, and deployment.
We deployed AIRGUARD on an Amazon EC2 instance and used Docker Compose to run its main application components.
Our deployment workflow involved:
  1. Preparing the application code and environment configuration.
  1. Connecting to the EC2 instance using SSH.
  1. Configuring environment variables for the application.
  1. Running the containerized frontend, backend, database, cache, and supporting services.
  1. Checking container health and inspecting application logs.
  1. Testing backend endpoints and application responses.
  1. Troubleshooting configuration, location validation, and service connectivity.
One important lesson was that starting a container does not necessarily mean the complete application is working correctly. Each important API and integration needs to be tested independently.
For example, we verified the backend health endpoint, tested the analytics endpoint, and sent a request to the AI Assistant. The assistant returned a successful response when valid latitude and longitude values were provided in the request context.
This also highlighted the importance of consistent data handling between the frontend and backend. A request can fail even when the server is healthy if required fields are missing or formatted incorrectly.

Lessons Learned

1. Configuration is critical

Environment variables, service connectivity, port mappings, and application settings can affect the behavior of an otherwise functional application. Configuration should be organized carefully, and credentials should never be committed to source control.

2. Validate the complete workflow

Testing individual services is useful, but end-to-end testing reveals integration issues that may not be obvious from the interface alone. We checked API status codes and response payloads to understand whether the application was returning the expected results.

3. Security must be part of deployment

Cloud deployments need appropriate network access controls. Databases and caches should not be unnecessarily exposed to the public internet, and application secrets should be stored securely. Development access rules should be reviewed before a deployment is used in production.

4. Communicate data limitations

Air-quality forecasts, exposure calculations, and simulated policy interventions are not the same as direct measurements. Clear explanations of uncertainty and data availability help users interpret environmental insights responsibly.

What's Next?

Our next priorities include improving frontend-backend location handling, strengthening deployment security, validating data freshness, and testing more complete user workflows.
We also want to continue improving the integration of environmental information with AI-powered recommendations so users can move from a question to relevant, understandable information more easily.

Conclusion

Building AIRGUARD has been an opportunity to connect web development, environmental data, AI workflows, and cloud deployment around an important real-world problem.
Amazon EC2 provided a flexible environment for hosting and testing our application, while Docker Compose helped us manage its containerized components. API testing and deployment debugging helped us identify integration issues and improve our understanding of running a multi-component application in the cloud.
The key lesson is that building a useful AI-powered platform requires more than a compelling interface. Reliable integrations, secure configuration, transparent data limitations, and careful testing are equally important.
AIRGUARD — From Air Quality Intelligence to Everyday Protection.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article