{"id":18903994,"url":"https://github.com/dudeperf3ct/12-serverless-deploy","last_synced_at":"2026-04-10T23:45:02.493Z","repository":{"id":191864843,"uuid":"453308396","full_name":"dudeperf3ct/12-serverless-deploy","owner":"dudeperf3ct","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-02T17:48:52.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-24T11:38:42.024Z","etag":null,"topics":["aws-lambda","docker","fastapi","mlops","model-serving","serverless-framework","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dudeperf3ct.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-01-29T05:45:07.000Z","updated_at":"2023-03-04T09:02:06.000Z","dependencies_parsed_at":"2023-09-01T07:12:32.664Z","dependency_job_id":null,"html_url":"https://github.com/dudeperf3ct/12-serverless-deploy","commit_stats":null,"previous_names":["dudeperf3ct/12-serverless-deploy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dudeperf3ct/12-serverless-deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudeperf3ct%2F12-serverless-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudeperf3ct%2F12-serverless-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudeperf3ct%2F12-serverless-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudeperf3ct%2F12-serverless-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dudeperf3ct","download_url":"https://codeload.github.com/dudeperf3ct/12-serverless-deploy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudeperf3ct%2F12-serverless-deploy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261733990,"owners_count":23201753,"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-lambda","docker","fastapi","mlops","model-serving","serverless-framework","transformers"],"created_at":"2024-11-08T09:07:07.524Z","updated_at":"2026-04-10T23:44:57.422Z","avatar_url":"https://github.com/dudeperf3ct.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless\n\nIn this exercise, transformers sentiment classifier fastapi application is deployed using [Serverless Framework](https://www.serverless.com/framework/docs)\n\nServerless Version\n\n```bash\nsls --version\n\nFramework Core: 3.1.0 (standalone)\nPlugin: 6.0.0\nSDK: 4.3.0\n```\n\n## Serverless Framework\n\n[Serverless Framework](https://www.serverless.com/framework/docs) provides hassle free develop, deploy, troubleshoot and secure serverless applications.\n\nUnder the hood, the Serverless Framework is deploying your code to a cloud provider like AWS, Microsoft Azure, Google Cloud Platform, Apache OpenWhisk, Cloudflare Workers, or a Kubernetes-based solution like Kubeless.\n\nPre-requisites\n\n- AWS CLI\n- Serverless Framework installed and [AWS configured](https://www.serverless.com/framework/docs/providers/aws/cli-reference/config-credentials)\n\n## Run\n\n### Locally\n\nTest the sentiment classifier model\n\n```bash\ndocker build -t sentiment -f project/sentiment/Dockerfile.sentiment project/sentiment/\ndocker run --rm -it sentiment\n```\n\nRun tests using `pytest`\n\n```bash\ndocker build -t sentiment -f Dockerfile.test .\ndocker run -p 8000:8000 -it -v $(pwd):/app --entrypoint bash sentiment\npytest --cov\n```\n\nBuild a docker image and test the application that will be used to deploy as AWS Lambda function.\n\n```bash\ndocker build -t sentiment -f Dockerfile.prod .\ndocker run -p 8000:8000 sentiment\n```\n\n```bash\ncurl -X 'POST' \\\n  'http://0.0.0.0:8000/classify?input_text=i%20like%20you' \\\n  -H 'accept: application/json' \\\n  -d ''\n```\n\n### Deploy using serverless framework\n\nReference: [Serverless Docker deploy](https://www.serverless.com/blog/container-support-for-lambda)\n\nWe will now deploy this application using serverless. This will add the application to Monitor on serverless dashboard.\n\n```bash\n# add monitoring to serverless dashboard\nserverless\n```\n\nDeploy the application using Serverless Framework.\n\n```bash\nserverless deploy --stage dev --verbose\n```\n\nOnce application is deployed, get information about deployment.\n\n```bash\nserverless info\n```\n\nTest application\n\nVist `\u003capi-endpoint\u003e/docs` to see if Swagger UI is available.\n\n```bash\ncurl -i \u003capi-endpoint\u003e\n```\n\nTest the classification endpoint\n\n```bash\ncurl -X 'POST' \\\n  '\u003capi-endpoint\u003e/classify?input_text=i%20like%20you' \\\n  -H 'accept: application/json' \\\n  -d ''\n```\n\nFetch logs\n\n```bash\nserverless logs -f sentimentapi\n```\n\nRemove service\n\n```bash\nsls remove --stage dev\n```\n\nAdditional: CI/CD can be [integrated](https://www.serverless.com/framework/docs/guides/cicd) using Serverless Dashboard.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdudeperf3ct%2F12-serverless-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdudeperf3ct%2F12-serverless-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdudeperf3ct%2F12-serverless-deploy/lists"}