https://github.com/kiquetal/infi-scheduler-lambda
https://github.com/kiquetal/infi-scheduler-lambda
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kiquetal/infi-scheduler-lambda
- Owner: kiquetal
- Created: 2023-05-28T18:27:34.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-01T12:50:53.000Z (over 2 years ago)
- Last Synced: 2025-02-01T07:20:39.107Z (8 months ago)
- Language: Python
- Homepage:
- Size: 11.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless Framework AWS Python Example
This template demonstrates how to deploy a Python function running on AWS Lambda using the traditional Serverless Framework. The deployed function does not include any event definitions as well as any kind of persistence (database). For more advanced configurations check out the [examples repo](https://github.com/serverless/examples/) which includes integrations with SQS, DynamoDB or examples of functions that are triggered in `cron`-like manner. For details about configuration of specific `events`, please refer to our [documentation](https://www.serverless.com/framework/docs/providers/aws/events/).
## Usage
### Deployment
In order to deploy the example, you need to run the following command:
```
$ serverless deploy
```After running deploy, you should see output similar to:
```bash
Deploying aws-python-project to stage dev (us-east-1)✔ Service deployed to stack aws-python-project-dev (112s)
functions:
hello: aws-python-project-dev-hello (1.5 kB)
```### Invocation
After successful deployment, you can invoke the deployed function by using the following command:
```bash
serverless invoke --function hello
```Which should result in response similar to the following:
```json
{
"statusCode": 200,
"body": "{\"message\": \"Go Serverless v3.0! Your function executed successfully!\", \"input\": {}}"
}
```### Local development
You can invoke your function locally by using the following command:
```bash
serverless invoke local --function hello
```Which should result in response similar to the following:
```
{
"statusCode": 200,
"body": "{\"message\": \"Go Serverless v3.0! Your function executed successfully!\", \"input\": {}}"
}
```### Bundling dependencies
In case you would like to include third-party dependencies, you will need to use a plugin called `serverless-python-requirements`. You can set it up by running the following command:
```bash
serverless plugin install -n serverless-python-requirements
```Running the above will automatically add `serverless-python-requirements` to `plugins` section in your `serverless.yml` file and add it as a `devDependency` to `package.json` file. The `package.json` file will be automatically created if it doesn't exist beforehand. Now you will be able to add your dependencies to `requirements.txt` file (`Pipfile` and `pyproject.toml` is also supported but requires additional configuration) and they will be automatically injected to Lambda package during build process. For more details about the plugin's configuration, please refer to [official documentation](https://github.com/UnitedIncome/serverless-python-requirements).