{"id":13858953,"url":"https://github.com/code402/datasette-lambda","last_synced_at":"2025-07-19T08:13:43.711Z","repository":{"id":222916533,"uuid":"253094186","full_name":"code402/datasette-lambda","owner":"code402","description":"Run Datasette on AWS serverless. ","archived":false,"fork":false,"pushed_at":"2020-04-17T04:47:49.000Z","size":74,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T22:32:45.161Z","etag":null,"topics":["asgi","cloudformation","datasette","mangum","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code402.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":"2020-04-04T20:37:39.000Z","updated_at":"2025-02-27T23:19:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"166304b2-186b-47f7-a493-89412f6a1333","html_url":"https://github.com/code402/datasette-lambda","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"6b78cbdd2a7203410b87869d8a364da5b7a46615"},"previous_names":["code402/datasette-lambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code402%2Fdatasette-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code402%2Fdatasette-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code402%2Fdatasette-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code402%2Fdatasette-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code402","download_url":"https://codeload.github.com/code402/datasette-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877391,"owners_count":21977634,"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":["asgi","cloudformation","datasette","mangum","sqlite"],"created_at":"2024-08-05T03:02:27.436Z","updated_at":"2025-05-13T04:41:42.042Z","avatar_url":"https://github.com/code402.png","language":"Shell","readme":"# datasette-lambda\n\nRun [Datasette](https://github.com/simonw/datasette) on AWS as a serverless application:\n\n\u003cdiv\u003e\u003ca href='//sketchviz.com/@cldellow/81af2bc7bec979e5725f0718e752ac47'\u003e\u003cimg src='https://sketchviz.com/@cldellow/81af2bc7bec979e5725f0718e752ac47/af75be24956b01795863c58650c7310affe28c61.sketchy.png' style='max-width: 100%;'\u003e\u003c/a\u003e\u003c/div\u003e\n\nSufficiently small databases (unzipped size up to ~250 MB, zipped size up to ~50 MB) will be inlined in the Lambda deployment package. Others will be published to S3 and fetched on Lambda startup.\n\nYou can see a demo using Datasette's fixtures db here: https://datasette-demo.code402.com/\n\n## Getting started\n\n### Creating\n\nClone the repo and run `./update-stack \u003cstack-name\u003e [flags] \u003csqlite.db\u003e [\u003csqlite.db\u003e ...]`, e.g.:\n\n```bash\ngit clone https://github.com/code402/datasette-lambda.git\ncd datasette-lambda\n./update-stack northwinds northwinds.db`\n```\n\nSome Datasette flags are supported:\n\n- `--config key:value`, to set [config options](https://datasette.readthedocs.io/en/stable/config.html)\n- `--cors`, to enable `Access-Control-Allow-Origin: *` headers on responses\n- `--metadata \u003cmetadata.json\u003e`, to provide [metadata](https://datasette.readthedocs.io/en/stable/metadata.html)\n\nAnd some non-Datasette flags are supported:\n\n- `--domain example.com` or `--domain subdomain.example.com`, if `example.com` is a hosted zone in Route 53\n  - register a `CNAME` record that points to the CloudFront distribution\n  - register an SSL certificate for the domain (you'll have to ack a confirmation email from Amazon)\n  - associate that certificate to the CloudFront distribution\n- `--prefix some/path`, to mount the Datasette app at a path other than the root\n\nA CloudFormation stack will be created (or updated) with an S3 bucket.\n\nThe stub code and SQLite database(s) will be uploaded to the S3 bucket.\n\nA second CloudFormation stack will then be created (or updated) with the necessary\nIAM roles, CloudFront, API Gateway and Lambda entities to expose your Datasette\ninstance to the web.\n\n### Watching logs\n\n`./tail-logs \u003cstack-name\u003e` will watch the CloudWatch logs for the Lambda (NB: not the API Gateway) service - this can be useful for debugging runtime errors in Datasette itself.\n\n### Destroying\n\nRun `./delete-stack \u003cstack-name\u003e` to tear down the infrastructure.\n\n_Note: AWS has a rough edge with deleting Lambda@Edge functions. You will need to run `delete-stack`, then wait a period of time, and run it again for the entire stack to be successfully removed. Ref: [AWS docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-delete-replicas.html)_\n\n## Known issues / future work\n\n- [x] Downloads from S3 should use an atomic fetch/rename to be robust against transient errors\n- [x] We should embed the DB in the Lambda package itself, when possible, to avoid the coldstart S3 fetch\n- [x] Repeated calls of update-stack should be robust against template-not-changed errors\n- [x] Fix issue with `base_url` not always being respected in generated URLs (maybe issue in how we use Mangum?)\n- [x] Be able to host multiple DBs\n- [x] Use the passed-in name of the DB as the DB name\n- [x] Create a CloudFront distribution\n- [x] Optionally be able to use a custom domain name on CloudFront\n- [x] Parity: Support CORS flag\n- [x] Parity: Support metadata flag\n- [x] Parity: Support config options\n- [x] Fix wrong absolute URLs for facets/next page (ds.absolute_url)\n- [ ] Use API Gateway's faster/cheaper HTTP APIs instead of REST APIs (requires [erm/mangum #94](https://github.com/erm/mangum/pull/94))\n\nMaybe:\n\n- [x] Be able to customize the \"mount\" point of the CloudFront distribution\n- [ ] Add support into core datasette's `publish` command, fixing [#236](https://github.com/simonw/datasette/issues/236)\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode402%2Fdatasette-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode402%2Fdatasette-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode402%2Fdatasette-lambda/lists"}