https://github.com/saatwik-mehta/serverlessv4-deploy-project
A simple project based on Github Actions and serverless framework deployment. It helps to deploy a lambda functions which requires a http-requests library.
https://github.com/saatwik-mehta/serverlessv4-deploy-project
aws-lambda cloudformation deployment github-actions python3 serverless-framework sls
Last synced: 2 months ago
JSON representation
A simple project based on Github Actions and serverless framework deployment. It helps to deploy a lambda functions which requires a http-requests library.
- Host: GitHub
- URL: https://github.com/saatwik-mehta/serverlessv4-deploy-project
- Owner: Saatwik-Mehta
- Created: 2025-02-22T16:56:51.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-26T10:07:16.000Z (over 1 year ago)
- Last Synced: 2025-02-26T10:37:15.228Z (over 1 year ago)
- Topics: aws-lambda, cloudformation, deployment, github-actions, python3, serverless-framework, sls
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless(v4) Deploy with GitHub Actions
Successfully deployed the serverless-stack using `Github Actions` and `Serverless-framework` V4.
# Serverless Framework AWS Python Example
This template demonstrates how to deploy a Python function running on AWS Lambda using the 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:
```
Deploying "aws-python" to stage "dev" (us-east-1)
✔ Service deployed to stack aws-python-dev (90s)
functions:
hello: aws-python-dev-hello (1.9 kB)
```
### Invocation
After successful deployment, you can invoke the deployed function by using the following command:
```
serverless invoke --function hello
```
Which should result in response similar to the following:
```json
{
"statusCode": 200,
"body": "{\"message\": \"Go Serverless v4.0! Your function executed successfully!\"}"
}
```
### Local development
You can invoke your function locally by using the following command:
```
serverless invoke local --function hello
```
Which should result in response similar to the following:
```
{
"statusCode": 200,
"body": "{\"message\": \"Go Serverless v4.0! Your function executed successfully!\"}"
}
```
### 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:
```
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).