Manage your cron jobs with AWS Cloudwatch and Lambda
Project description
Cronyo
The missing cron CLI for AWS Cloudwatch and Lambda
What is it?
Do you have an AWS account? Great. Do you want to run cron jobs in the cloud?
Cronyo provides A simple CLI to manage your cron jobs on AWS.
In addition, Cronyo can instantly deploy a couple of super-simple, helpful and secure lambda functions to perform HTTP GET/POST requests for you. So if you need to trigger any webhooks on schedule, an AWS account and Cronyo is all you need :)
Key Features:
- Simple command line interface to manage cron jobs (much simpler than aws events put-rules, aws lambda add-permission, aws events put-targets, Cloudformation, or Terraform)
- Pre-built AWS Lambda functions for simple HTTP GET/POST requests, or use your own lambdas.
- Cost Effective (you'll need a TON of cron rules to worry about costs).
- Simple but Secure (HTTP GET/POST include an HMAC signature so you can validate the request is genuine).
- Easy deployment of lambda functions using
cronyo deploy
. No need to twiddle with AWS. - Easily add, delete, enable, disable and export (to yaml) your cron rules.
Background
read the blog post: Simple and Secure Cron using AWS Lambda
Cronyo takes the next step, and provides an automated solution with a CLI.
Roadmap
- import from yaml
- export/import from crontab-esque files
- add other lambdas?
Installation / Quick Start
You will need an AWS account with the aws cli
installed. Then run:
$ pip install cronyo
$ cronyo configure
$ cronyo deploy # (optional, if you want to use the http POST/GET lambdas)
It will automatically configure two AWS Lambda functions (cronyo-http_post
and cronyo-http_get
)
Intro
Examples
cronyo --help
- prints a help screen.cronyo configure
- opens your editor so you can edit the config.json file. Use it to update your namespace and signing key.cronyo preflight
- runs preflight checks to make sure you have access to AWS.cronyo deploy
- deploys the code and configs to AWS automatically.cronyo export
- exports all existing cron rules to yamlcronyo export --prefix
- exports all existing cron rules starting withprefix
to yamlcronyo export --search
- exports all existing cron rules matching the search string anywhere in the namecronyo add http_get '{"url": "https://example.com"}' --cron "5 4 * * ? *"
- sends an HTTP GET request to example.com at 4:05am every daycronyo disable cronyo-24a0b5504111d9b1d797
- disables cron with the namecronyo-24a0b5504111d9b1d797
cronyo enable cronyo-24a0b5504111d9b1d797
- enables cron with the namecronyo-24a0b5504111d9b1d797
cronyo delete cronyo-24a0b5504111d9b1d797
- deletes cron with the namecronyo-24a0b5504111d9b1d797
cronyo update http_get '{"url": "https://example.com"}' --cron "5 4 * * ? *" --name myrule
- updates an existing rule
Advanced
Names
cronyo creates a name for your cron jobs automatically (unless a custom name is specified). Names are required unique identifiers, and cannot be changed after creation (this is AWS limitation). Names can only contain certain characters.
cronyo comes with a (configurable) namespace -- cronyo
by default. You can change the default using cronyo configure
.
cron expressions
cronyo supports cron
or rate
expressions. See the AWS
docs for specific info.
Note that --cron "<expr>"
must be surrounded by quotes, however --rate
won't work with quotes. This is because cron
expressions include characters like *
which mess-up the CLI input.
adding a cron job
cronyo add http_get '{"url": "https://example.com"}' --cron "5 4 * * ? *"
will send an HTTP GET request to example.com at 4:05am every daycronyo add http_post '{"url": "https://example.com"}' --rate 5 minutes
will send an HTTP POST request to example.com every 5 minutescronyo add http_post '{"url": "https://example.com", "headers": {"User-Agent": "007"}, "cookies": {"biscuit": "oreo"}, "params": {"a": "b"}, "data": {"key": "value"}}' --rate 5 minutes
will send an HTTP POST with custom cookies, headers, URL params and form data.cronyo add arn:aws:lambda:us-east-1:313623401231:function:cronyo-http_post:live '{"url": "https://example.com"}' --rate 5 minutes
will call a lambda function with a specific ARN with given event paramaters every 5 minutescronyo add http_post '{"url": "https://example.com"}' --rate 5 minutes --name my-cron-job
using--name
to provide a custom name (see Names above)cronyo add http_post '{"url": "https://example.com"}' --rate 5 minutes --description "describe your cron job"
using--description
to provide a description for the job.
License
Cronyo is distributed under the MIT license. All 3rd party libraries and components are distributed under their respective license terms.
Copyright (C) 2020 Yoav Aner
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cronyo-0.4.5.tar.gz
.
File metadata
- Download URL: cronyo-0.4.5.tar.gz
- Upload date:
- Size: 982.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bdae8d743d665bd81c991b058783861cff73c47596c0c2f4a2cbec3b931ffca |
|
MD5 | 18b5e49b418a43d373d774b7d1c93986 |
|
BLAKE2b-256 | 8b8d443a96fdecc990cd3ac8e3f35fd35bac7ebbd46c3d241345ec71d5920883 |
File details
Details for the file cronyo-0.4.5-py3-none-any.whl
.
File metadata
- Download URL: cronyo-0.4.5-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fde7bfdbc231e963664f6adff6f2692f46afc46a1cb4c3c5e6dd4c38ea91d91 |
|
MD5 | a48704a3ad7d8f0d0467afcebecdd589 |
|
BLAKE2b-256 | 36a93e9d645184e16d25fe7126ba822a1987f026ecce7a3a6caac3c4c791fa07 |