This is a weather bot to send daily weather updates to an email list using AWS Lamda, Amazon SES and python.
- Python Notebook 1: notebook_1_Abhinav_kohar.ipynb -- Notebook that can take lat long inputs and generate weather report/forecast with charts for the location
- Python Notebook 2: notebook_2_Abhinav_kohar.ipynb -- Notebook that has function to send an email to given email_id
- Python Notebook 3: notebook_3_Abhinav_kohar.ipynb -- Notebook that can take lat/long, email_id as input at top and when run sends an email of weather report
AWS
- Configure the aws cli
- Verify email addresses to send/receive email while in sandbox mode
- Sign up for the OpenWeatherMap API and use the provided API key to set an
OPEN_WEATHER_MAP_API
environment variable - Create a lambda function called
weather-bot
. Use this name in build and deploy shell scripts in thescripts
directory. - Provide values for all environment variables mentioned in
.env
to the lambda function - Configure AWS Eventbridge to trigger the lambda function
Local
- Setup a virtual environment,
python3 -m venv .venv
- Run
pip install -r requirements.txt
to install dependencies - Run
python lambda_function.py
to test locally- Note: Either populate a
.env
file and load its contents for local development or manually replace environment variables used in the code with values while testing locally. - pip install python-dotenv
- from dotenv import load_dotenv
- load_dotenv()
- Note: Either populate a
-
Run
./scripts/build-deploy.sh
to build and deploy the lambda to AWS -
Run
./aws/ses/scripts/ses-create-weather-reminder-template.sh
to create theWeatherReminderTemplate
email template in SES -
Run
./aws/ses/scripts/ses-update-template-weather-reminder.sh
to update theWeatherReminderTemplate
email templae in SES -
AWS eventbridge config
- AWS lamda function config
- IAM policy