https://github.com/oieduardorabelo/cdk-eventbridge-scheduler-last-modified
EventBridge Scheduled Rule to check "Last-Modified" header of a URL
https://github.com/oieduardorabelo/cdk-eventbridge-scheduler-last-modified
aws aws-cdk aws-cdk-typescript aws-dynamodb aws-eventbridge aws-lambda serverless typescript
Last synced: about 1 month ago
JSON representation
EventBridge Scheduled Rule to check "Last-Modified" header of a URL
- Host: GitHub
- URL: https://github.com/oieduardorabelo/cdk-eventbridge-scheduler-last-modified
- Owner: oieduardorabelo
- Created: 2023-03-15T09:24:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-15T09:25:05.000Z (about 2 years ago)
- Last Synced: 2025-02-08T12:12:29.844Z (3 months ago)
- Topics: aws, aws-cdk, aws-cdk-typescript, aws-dynamodb, aws-eventbridge, aws-lambda, serverless, typescript
- Language: TypeScript
- Homepage:
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EventBridge Scheduled Rule to check "Last-Modified" header of a URL
This project contains a CDK template that creates a rule that
runs on a schedule every Friday at 07:00 am. It triggers a lambda to fetch the "Last-Modified" header of a URL and check if the header is older than the specified number of days (e.g., "older than 30 days ago"). The default value is 30 days. Finally, a payload object is created:```js
const payload = {
url: TARGET_URL,
lastModified: lastModified,
};if (date < daysAgo) {
payload.expired = true;
}
```If the header value is older than the specified number of days, a property `expired` is added to the payload object and is saved to DynamoDB.
If the header is not older than the specified number of days, the property `expired` is not added to the payload object and is saved to DynamoDB.
### Final architecture:
