Building a Weather Dashboard with Docker and AWS S3

Hardik GandhiHardik Gandhi
1 min read

This blog will demonstrate how to build a weather dashboard application using Docker and AWS S3. This program fetches weather data from the OpenWeather API and saves it to an AWS S3 bucket.

Prerequisites:

  • Docker installed on your machine

  • AWS account with access keys

  • OpenWeather API key

Repository Structure:

Here's an overview of the repository structure:

weather-dashboard/
├── src/
│   ├── __init__.py
│   └── weather_dashboard.py
├── .env
├── .gitignore
├── Dockerfile
└── README.md

Setup:

  1. Clone this repository:

     git clone https://github.com/hardikgandhi03/Weather-Dashboard-Demo.git
     cd Weather-Dashboard-Demo
    
  2. Create a .env file in the root directory with the following content:

       OPENWEATHER_API_KEY=your_openweather_api_key
       AWS_BUCKET_NAME=weather-dashboard-demo-
       # AWS CREDENTIALS
       AWS_ACCESS_KEY_ID=your_aws_secret_key_id
       AWS_SECRET_ACCESS_KEY=your_aws-secret_access_key
       AWS_DEFAULT_REGION=your_aws_default_region
    
  3. Build the docker image:

     docker build -t weatherDashboard .
    
  4. Run the docker container:

     docker run weatherDashboard --name aws-app
    

Usage:

The program will fetch weather data from the cities added into the json file at /data/cities.json file. The weather data will be saved to the specified AWS S3 bucket.

AWS configuration:

The program uses the AWS CLI to interact with the S3. Ensure your AWS credentials are correctly set in the .env file.

GitHub link: hardikgandhi03/Weather-Dashboard-Demo

0
Subscribe to my newsletter

Read articles from Hardik Gandhi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hardik Gandhi
Hardik Gandhi