Sonic0 / local-crontab-serverless-infrastructure

Serverless service to expose a simple public API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local-Crontab Serverless infrastructure

This is the CDK code to deploy the backend infrastructure used for the front-end of the Local-Crontab python module.

Use of Rest-API

API endpoint and api-key are into the config.json file in the local-crontab-web-converter. They are in clear-text . API calls are limited to 100/day 1/sec, so please do not abuse it.

Try Lambda via SAM

https://docs.aws.amazon.com/cdk/latest/guide/sam.html

  1. Run your AWS CDK app and create an AWS CloudFormation template.
cdk synth --no-staging > template.yaml
  1. Find the logical ID for your Lambda function in template.yaml. It will look like MyFunction12345678, where 12345678 represents an 8-character unique ID that the AWS CDK generates for all resources.
sam local generate-event apigateway aws-proxy --body '{"cron":"0 10 * * *", "timezone":"America/Denver"}' --stage v1 --method POST --path utc-converter --resource None > apigateway-event-example.json
  1. Run the function by executing.
sam local invoke awslambda<ID> --profile <profile> --region <region> --event apigateway-event-example.json --debug

Todo

Starting with CDK Python projects!

Useful CDK commands

  • cdk ls list all stacks in the app
  • cdk synth emits the synthesized CloudFormation template
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk docs open CDK documentation

Enjoy!

Project info

This repo is part of my projects group, called Cron-Converter. Its related repositories:

About

Serverless service to expose a simple public API

License:MIT License


Languages

Language:HTML 97.7%Language:Python 2.2%Language:Batchfile 0.0%Language:Shell 0.0%