An AWS Lambda that saves NHK NEWS WEB EASY as ting.
First create an AWS Lambda function, click Enable VPC
under Advanced settings
, and select the VPC of your MySQL instance. Remember to add the security group of your Lambda function as an inbound rule to your MySQL instance.
Second, follow the instructions here to enable the Lambda to have the access to Internet.
Then run sh ./package.sh
to package the function, and upload lambda.zip
to your Lambda function. Also add the following environment variables to the Lambda function:
- DB_USER_NAME: user name of MySQL database
- DB_PASSWORD: password of MySQL user
- DB_HOST: host of MySQL database
- DB_PORT: port of MySQL database
Finally, create an EventBridge rule to trigger the Lambda function daily:
- Select
Schedule
asRule type
- This task relies on nhk-easy-task which runs at 10:00 AM (UTC) every day, so the cron expression should be set after that, for example
30 10 * * ? *