!!! Fair warning this is my first Dev.To post so it won't be the prettiest thing ツ
Purpose
The purpose of this post is to outline the steps I took to create a Weather Dashboard utilizing AWS, OpenWeather, GitHub, VS Code, etc.
This is a part of the #DevOpsAllStarsChallenge hosted by a few Cloud Engineers and DevOps folks that are trying to help others get involved. It's a pretty neat community and I highly recommend you take a look at the Discord if you're interested!
Resources
Discord
YouTube Video from Shae
Tools Needed
VS Code (or your favorite text editor)
AWS Free Tier Account
OpenWeather Account
GitHub Account
Knowledge of Git, Linux commands, APIs and AWS
Prerequisites
Aside from installing the necessary software and packages (such as VS Code, Python, pip, etc.), the next few things are necessary in order to properly pull from the OpenWeather API and dump that data into an AWS S3 bucket.
Create API key in OpenWeather
Create an account with OpenWeather, select "API Keys" and generate an API key. This will be used later in the .env file within the Git repo.
Create IAM user in AWS, assign group, permissions and generate Access Key
This step is imperative in order to allow the python script to function. The script goes out and creates the S3 bucket using the user credentials and the secret key. For further explanation, please reference the AWS IAM user documentation.
I have created the user "weather-data", assigned the user to a group, and given the group permissions of "AmazonS3FullAccess". This gives the user the necessary permissions to create an S3 bucket.
Spinning Up the Weather Dashboard
- Clone the repo
git clone https://github.com/asciikeyboard/weather-dashboard.git
cd weather-dashboard
- Create a .env file with your OpenWeather API key and AWS credentials.
touch .env
Now it is up to you to use vim, nano, or your favorite text editor to make the necessary modifications to the .env file.
Below you will see the different variables necessary. The blurred variables should never be shared as these are sensitive keys/IDs.
- Run the python script
python3 src/weather_dashboard.py
The output should look similar to this:
"Trust but verify" ... so let's check AWS and boom - the data is in the newly created S3 bucket!
- Now delete the S3 bucket to ensure you don't get billed!
Conclusion
This project is a nice way to get introduced to common DevOps tools such as GitHub, Python, AWS, etc. This repo allows a user to pull weather data from an API and upload it to a S3 bucket in Amazon. There are plenty of customizations that could be made. Feel free to explore!
Top comments (0)