{"id":19350621,"url":"https://github.com/slevin48/serverless","last_synced_at":"2025-02-24T10:23:20.189Z","repository":{"id":112496767,"uuid":"565867456","full_name":"slevin48/serverless","owner":"slevin48","description":"Learning about serverless options for Python like AWS Lambda","archived":false,"fork":false,"pushed_at":"2024-03-15T18:44:30.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-06T15:32:47.976Z","etag":null,"topics":["lambda","serverless"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slevin48.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-14T13:52:13.000Z","updated_at":"2023-01-14T20:48:46.000Z","dependencies_parsed_at":"2024-11-10T04:33:21.975Z","dependency_job_id":"9a07c33e-d1d0-463b-99e7-cdc0063c2c86","html_url":"https://github.com/slevin48/serverless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slevin48%2Fserverless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slevin48%2Fserverless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slevin48%2Fserverless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slevin48%2Fserverless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slevin48","download_url":"https://codeload.github.com/slevin48/serverless/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240458943,"owners_count":19804657,"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":["lambda","serverless"],"created_at":"2024-11-10T04:33:17.186Z","updated_at":"2025-02-24T10:23:20.146Z","avatar_url":"https://github.com/slevin48.png","language":"Jupyter Notebook","readme":"# serverless 🚀\nLearning about serverless options for Python like AWS Lambda\n\n## What is serverless for?\n\nFor short running tasks, like a stateless web service (often reffered to as [RESTful API](https://aws.amazon.com/what-is/restful-api/)) a call to the serverless function will spin up a machine, perform the task and turn off the machine. The task might be receiving data through the call to a simple public URL (also called the API Gateway) or fetch data from a bucket. It would then compute your code. And it will save or return the results before shutting down the machine. As such, you don't need to manage the server running your code in serverless mode.\n\n## What it is not\n\nFor serving web assets, consider a content delivery network (CDN). Amazon CloudFront is an AWS service built specifically for this purpose. Her is a guide on how to use it with S3 and other options: [Using various origins with CloudFront distributions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html)\n\n## Chalice\n\n![](https://aws.github.io/chalice/_static/img/chalice-logo-icon-small.png)\n\nrepo: [aws/chalice](https://github.com/aws/chalice) - website: [aws.github.io/chalice/](https://aws.github.io/chalice/)\n\n---\n\nFirst create a virtual environment\n```\npython -m venv env\n.\\env\\Scripts\\activate\n```\nOnce activated, install Chalice\n```\n(env) pip install -r requirements.txt\n```\nThen create a new project:\n```\nchalice new-project helloworld\n```\n\nMove to the created project folder:\n```\ncd helloworld\ncode app.py\n```\n\nCreate a simple REST API:\n```python\nfrom chalice import Chalice\n\napp = Chalice(app_name=\"helloworld\")\n\n@app.route(\"/\")\ndef index():\n    return {\"hello\": \"world\"}\n```\n\nSimply deploy the lambda function:\n```\nchalice deploy\n```\n\nDelete the function once you stop playing:\n```\nchalice delete\n```\n\n\n### Tuto video\n[streamlit-streamlit_app-2022-11-14-22-11-15.webm](https://user-images.githubusercontent.com/12418115/201817792-1ea00a76-aa99-468e-96f7-2b7217add872.webm)\n\nCall REST API from Postman \n![image](https://user-images.githubusercontent.com/12418115/201817921-999befd8-f69c-4d36-a02f-010c7b127851.png)\n\nFinally the Lambda function can be managed from the AWS console:\n![image](https://user-images.githubusercontent.com/12418115/201818285-4977245a-0c56-4e9b-8f7a-9d9f664bda4e.png)\n\n## Deploy serverless container with Fargate\nhttps://github.com/slevin48/fargate\n\n## Resources\n\n* [serverless/examples](https://github.com/serverless/examples/)\n* [examples/aws-python-flask-api](https://github.com/serverless/examples/tree/master/aws-python-flask-api)\n* [Tutorial Serverless](https://newrelic.com/blog/best-practices/create-a-serverless-function-in-python)\n* [Running TensorFlow on AWS Lambda using Serverless](https://medium.com/@mike.p.moritz/running-tensorflow-on-aws-lambda-using-serverless-5acf20e00033)\n* [RealPython Tutorial](https://realpython.com/aws-chalice-serverless-python/)\n* [Using Chalice to serve SageMaker predictions](https://julsimon.medium.com/using-chalice-to-serve-sagemaker-predictions-a2015c02b033)\n* [AWS Chalice — Painless Serverless Adventure](https://awstip.com/aws-chalice-painless-serverless-adventure-2-a7aa5f93840f) - [last part (in turkish)](https://kemalcanbora.medium.com/aws-chalice-ac%C4%B1s%C4%B1z-serverless-ser%C3%BCveni-3-61a57d9a248e)\n* [Building Serverless Python Apps Using AWS Chalice](https://realpython.com/aws-chalice-serverless-python/)\n* [Render, Fly.io \u0026 Railway: PaaS Container Deployment in 2024](https://alexfranz.com/posts/deploying-container-apps-2024/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslevin48%2Fserverless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslevin48%2Fserverless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslevin48%2Fserverless/lists"}