Building a Cloud-Based Weather Dashboard: Day 1 of My 30 Days DevOps Challenge


As part of the 30 Days DevOps Challenge from Cozy Cloud Crew, I started on a journey to refine my cloud (specially AWS) and DevOps skills. For Day 1, the challenge was to build a Python-based Weather Dashboard that fetches real-time weather data and securely stores it in an AWS S3 bucket. This blog will take you through my project, challenges, and learnings from Day 1.
Project Overview
The Weather Dashboard app retrieves real-time weather data for any city using the OpenWeatherMap API. It displays the weather data in a clean GUI built with Tkinter and saves the raw data in JSON format to an AWS S3 bucket for long-term storage or analysis.
Core Features
Data Fetching: Retrieves current weather details using OpenWeatherMap API.
User-Friendly Interface: A graphical interface for input and display.
Cloud Integration: Stores fetched weather data in an AWS S3 bucket via the Boto3 SDK.
Tech Stack
Python: Core programming language.
Tkinter: For creating the GUI.
Boto3: AWS SDK for Python to interact with S3.
dotenv: To manage sensitive credentials.
OpenWeatherMap API: For real-time weather data.
Project Structure
The project was modular, organized as follows:
weather-dashboard/
βββ src/ # Source code for the application
β βββ __init__.py # Makes src a package (can be empty)
β βββ gui.py # Tkinter GUI code
β βββ weather_api.py # Weather API interaction logic
β βββ s3_utils.py # S3 bucket interaction logic
βββ tests/ # Unit tests for the application
β βββ __init__.py
β βββ test_gui.py
β βββ test_weather_api.py
β βββ test_s3_utils.py
βββ .gitignore # Files/folders to exclude from Git
βββ requirements.txt # Project dependencies
βββ README.md # Project description and instructions
βββ main.py # Entry point of the application
Checkout the Github Repo:
Check out the Day 1 code here : Day 1 - Weather Dashboard
Architecture
Fun fact: I had bit of time so I also learned to create Mermaid diagrams, it was a fun activity. Below is the outcome of my learning.
graph LR
subgraph User_Interaction
A[User] -.-> B{Enter City}
end
subgraph Weather_Application
M[main.py] --> C
M[main.py] --> E
M[main.py] --> G
B{Enter City} --"City Name"--> C[weather_api.py]
C[weather_api.py] --"API Request"--> D[OpenWeather API]
D[OpenWeather API] --"Weather Data"--> C
C --"Formatted Data"--> E[Weather Dashboard GUI]
E[Weather Dashboard GUI] --> F[Display Weather]
end
subgraph Data_Storage
C[weather_api.py] -- "Weather Data" --> G[s3_utils.py]
G[s3_utils.py] --"Store Data"--> H[AWS S3]
end
F[Display Weather] -.-> A[User]
%% Styling for better readability
style A fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,font-size:16px,color:#1b5e20
style B fill:#ffffff,stroke:#2e7d32,stroke-width:1px,font-size:16px,color:#000000
style C fill:#e1f5fe,stroke:#01579b,stroke-width:2px,font-size:16px,color:#000000
style D fill:#f5f5f5,stroke:#616161,stroke-width:1px,font-size:16px,color:#000000
style E fill:#e1f5fe,stroke:#01579b,stroke-width:2px,font-size:16px,color:#000000
style F fill:#f5f5f5,stroke:#616161,stroke-width:1px,font-size:16px,color:#000000
style G fill:#e1f5fe,stroke:#01579b,stroke-width:2px,font-size:16px,color:#000000
style H fill:#f5f5f5,stroke:#616161,stroke-width:1px,font-size:16px,color:#000000
style M fill:#e1f5fe,stroke:#01579b,stroke-width:2px,font-size:16px,color:#000000
Learnings and Reflections
This project gave me hands-on experience with cloud and DevOps principles. Here are my key takeaways:
Managing Secrets Securely:
Storing API keys and AWS credentials in a.env
file ensured sensitive information wasnβt exposed in the codebase. Usingdotenv
, I dynamically loaded these variables at runtime.Cloud Storage Basics:
While I had prior experience with AWS, integrating an application to dynamically interact with S3 gave me insights into API-first design.GUI Development with Tkinter in Python:
Building a graphical interface taught me how to enhance usability while adhering to project requirements.Writing Unit Tests:
Testing each module independently was a valuable learning experience. It reinforced the importance of modular design and highlighted how unit tests ensure reliability. For example, I tested API responses with mock data and verified S3 interactions using a test bucket.
Challenges and Troubleshooting
The issues and errors I faced and troubleshooted:
1. IllegalLocationConstraintException
Problem: When creating an S3 bucket, I encountered this error due to an unspecified or mismatched region.
Solution: Updated
boto3.client()
to include the appropriate region:self.s3 = boto3.client('s3', region_name='ap-south-1')
2. NoSuchBucket Error
Problem: This error occurred when trying to save data to a non-existent S3 bucket.
Solution: I added a function to verify bucket existence and ensure creation:
def create_bucket_if_not_exists(bucket_name): if bucket_name not in existing_buckets: s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={'LocationConstraint': 'ap-south-1'})
Outcome
The final app successfully fetched weather data, displayed it on the GUI, and saved it to S3. Hereβs a snapshot of the GUI:
Final Thoughts
This project laid a strong foundation for integrating Python apps with cloud services. It gave me a glimpse into real-world challenges, from handling API responses to troubleshooting AWS configuration issues. Most importantly, it solidified my belief that hands-on projects are the best way to learn DevOps.
π What's Next?
Next up, Iβll be working on a Game Day Notification System. Stay tuned as I continue this challenge, building new projects and documenting my journey.
If youβre curious, feel free to check out the project repository: Weather Dashboard Repo
Subscribe to my newsletter
Read articles from Chetan Thapliyal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Chetan Thapliyal
Chetan Thapliyal
π§ Curious Engineer with a Passion for Linux, IT, and Open Source | Embracing Innovation and Ready to Make Waves in the Tech World! π