This weather app was inspired by the Cloud Resume Challenge. Although instead of implementing a personal website or resume, I created a simple weather app. My web app still achieves the goal of the cloud challenge by making use of many of Amazon's AWS services.
Frontend
The static site is hosted in an AWS S3 Bucket and uses AWS CloudFront as a CDN and to serve content over HTTPS.
Javascript is used to fetch weather data from WeatherAPI.com's REST API. The JSON response is then parsed to show the appropriate images and data to the user.
The frontend code is stored in a GitHub repository and uses a GitHub Actions pipeline to automate continuous deployment. The frontend pipeline updates the S3 Bucket with the latest files and invalidates the CloudFront cache.
Backend
The visitor counter is implemented using a number of AWS backend services. AWS DynamoDB is a Key-Value database and is used to store the value of the visitor counter. A lambda function is written in Python using the boto3 library to increment and return the value of the visitor counter stored in the database. The lambda function is called via the AWS API Gateway, which allows a request issued via Javascript to trigger the backend lambda function.
The database, lambda function and REST API are all defined in an AWS Serverless Application Model (SAM) template file. This allowed me to modify and update my backend resources using an Infrastructure as Code approach.
All of the backend code is stored in a GitHub repository and has its own GitHub Actions pipeline. The backend pipeline first runs some unit tests against the lambda function using pytest to catch bugs. The pipeline then uses the AWS SAM CLI to build and deploy the AWS SAM template.