{"id":23045658,"url":"https://github.com/inovex/cloudwatch-scheduler","last_synced_at":"2026-05-09T09:55:43.499Z","repository":{"id":139542214,"uuid":"285773207","full_name":"inovex/cloudwatch-scheduler","owner":"inovex","description":"Example implementation for a serverless scheduling solution described in the blog article \"Scheduling AWS Lambda Invocations\".","archived":false,"fork":false,"pushed_at":"2020-08-24T08:00:26.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-15T03:03:23.506Z","etag":null,"topics":["aws","cloudwatch-events","dynamodb","eventbridge","events","lambda","scheduler","scheduling"],"latest_commit_sha":null,"homepage":"https://www.inovex.de/blog/schedule-aws-lambda","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inovex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-07T08:02:02.000Z","updated_at":"2024-06-19T09:08:13.065Z","dependencies_parsed_at":"2024-06-19T09:08:11.921Z","dependency_job_id":"f80ce662-1f41-484f-b07a-28b140e64251","html_url":"https://github.com/inovex/cloudwatch-scheduler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovex%2Fcloudwatch-scheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovex%2Fcloudwatch-scheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovex%2Fcloudwatch-scheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovex%2Fcloudwatch-scheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inovex","download_url":"https://codeload.github.com/inovex/cloudwatch-scheduler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922242,"owners_count":20855345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cloudwatch-events","dynamodb","eventbridge","events","lambda","scheduler","scheduling"],"created_at":"2024-12-15T21:27:42.924Z","updated_at":"2026-05-09T09:55:38.466Z","avatar_url":"https://github.com/inovex.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloudwatch-scheduler\nExample implementation for a serverless scheduling solution described in the [blog article](https://www.inovex.de/blog/schedule-aws-lambda-invocations-how-slow-schedulers/) \"Schedule AWS Lambda Invocations: How to Build Slow Schedulers\".\n\n## What it does\nThis is a *very slow* scheduler implementation based on a classical serverless AWS stack:\nEventBridge, Cloudwatch, Lambda and Dynamo.\nIts intended purpose is to schedule infrequent events far into the future and have them processed by a serverless function.\nA good practical use case for this is the publishing and withdrawal of certain media in a content-drive platform.\nSometimes, the publishing and withdrawal dates of certain items are known months (if not years) in advance due to license agreements.\nA scheduler implementation like this would allow users to automate tasks like these while efficiently working around certain limitations imposed by EventBridge.\n\n## How to build it and use it\nThis is a monorepo containing two build targets.\nThe `editor/` package contains the sources for a task editor that is used to submit tasks to the scheduler.\nThe code for the worker lambda function that is triggered by Cloudwatch is located in `worker/`.\nShared code is within the other packages that can be found in the repository root.\nThere are Makefiles for both targets in their respective directories.\n\nI included some basic terraform code for the worker lambda function and for the Cloudwatch/EventBridge rule in the `terraform/` directory.\nYou can easily build everything and deploy it to your AWS account as-is to play around with it.\nHowever, if you end up using (some of) this code, you should probably read the [article](https://www.inovex.de/blog/schedule-aws-lambda-invocations-how-slow-schedulers/) and get a more conceptual understanding of how everything comes together.\n\n### Editor\nTo create a binary:\n```bash\ncd editor\nmake build\n```\nThis will create an `editor` binary which you can run:\n```bash\n./editor start-server\n```\nYou can put `.aws.access` and `.aws.secret` files in the working directory or have your access credentials set up in `~/.aws`.\nMake sure the AWS user has write access to DynamoDB and EventBridge.\n\n#### API\nThe command will start a web server on port 8080 that offers a simple REST API to manipulate our task queue.\n\nList Tasks:\n```bash\ncurl --request GET \\\n  --url http://localhost:8080/tasks\n```\n\nCreate new or overwrite existing task:\n```bash\ncurl --request POST \\\n  --url http://localhost:8080/tasks \\\n  --header 'content-type: application/json' \\\n  --data '{\n    \"id\": \"some task id\",\n    \"due\": \"2020-12-31T00:00:00Z\",\n    \"action\": \"APPLY_SALE\",\n    \"payload\": {\n      \"itemID\": \"some item\",\n      \"newPrice\": 29.99,\n      \"salePercent\": 50\n    }\n  }'\n```\n\n### Worker\nYou can create a binary of the worker just as easily:\n```bash\ncd worker\nmake build\n```\nThe resulting `main` binary just processes all due tasks.\nYou can pass an additional `fakenow` argument to mock a call at a specific time.\nThe time needs to be formatted the same way as before when submitting a new task.\n```bash\n./main --fakenow 2020-12-31T00:00:00Z\n```\nYou can also `make zip` to create a deployable `function.zip` in the `terraform/` directory.\n\n## How not to use it (POC Warning)\nThis implementation is a proof of concept rather than an actual finished library you could use in your application.\nThe code contains around a handful of issues that I am aware of, and probably some more that I'm not.\nI would advise against using this code without thorough review, and I am in no way responsible for the damage it does to your production system.\nUse caution and carefully test everything.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finovex%2Fcloudwatch-scheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finovex%2Fcloudwatch-scheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finovex%2Fcloudwatch-scheduler/lists"}