module
Version:
v0.0.0-...-75875d8
Opens a new window with list of versions in this module.
Published: Oct 26, 2024
License: MIT
Opens a new window with license information.
README
¶
Marukyu Koyamaen Stock Checker
This is a simple serverless application that scrapes the stock of Marukyu Koyamaen ceremonial matcha products and sends the result to a Telegram bot.
How It Works
- The system uses a Go-based Lambda function to scrape the Marukyu Koyamaen website.
- It checks the stock status of matcha products.
- The results are formatted into a readable message.
- This message is sent to a specified Telegram chat using a Telegram bot.
- The process is automated to run twice daily at noon and midnight Singapore time.
Deployment Architecture
The project is deployed on AWS with the following components:
- AWS Lambda: Hosts the Go function that performs the web scraping and sends Telegram messages.
- Amazon CloudWatch Events: Triggers the Lambda function on a schedule.
- Terraform: Used for Infrastructure as Code (IaC) to manage and deploy AWS resources.
AWS Services Used
-
AWS Lambda
- good for intermittent work; pay per use (cost efficiency)
- response time not critical (so cold starts not a problem)
- I don’t need continuous server uptime (don’t need ec2)
-
AWS EventBridge (CloudWatch Events)
- Provides a reliable way to trigger Lambda functions on a schedule.
- Serverless and fully managed by AWS.
- Integrates seamlessly with Lambda.
Deployment
-
Ensure you have AWS CLI configured and Terraform installed.
-
Clone this repository.
-
From the root directory, run make build
to build the Lambda function.
-
Navigate to the deployment
directory.
-
Create a terraform.tfvars
file with the following content:
<!-- terraform.tfvars file-->
lambda_role_arn = "your-lambda-role-arn"
telegram_bot_token = "your-telegram-bot-token"
telegram_chat_id = "your-telegram-chat-id"
-
Apply the Terraform configuration:
terraform init
terraform plan
terraform apply
Directories
¶
Click to show internal directories.
Click to hide internal directories.