{"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645030262", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645030262, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTAzMDI2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T21:51:01Z", "updated_at": "2020-06-16T21:51:39Z", "author_association": "OWNER", "body": "File locking is interesting here. https://docs.aws.amazon.com/lambda/latest/dg/services-efs.html\r\n\r\n> Amazon EFS supports [file locking](https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html#consistency) to prevent corruption if multiple functions try to write to the same file system at the same time. Locking in Amazon EFS follows the NFS v4.1 protocol for advisory locking, and enables your applications to use both whole file and byte range locks. \r\n\r\nSQLite can apparently work on NFS v4.1. I think I'd rather set things up so there's only ever one writer - so a Datasette instance could scale reads by running lots more lambda functions but only one function ever writes to a file at a time. Not sure if that's feasible with Lambda though - maybe by adding some additional shared state mechanism like Redis?", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 1, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645031225", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645031225, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTAzMTIyNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T21:53:25Z", "updated_at": "2020-06-16T21:53:25Z", "author_association": "OWNER", "body": "Easier solution to this might be to have two functions - a \"read-only\" one which is allowed to scale as much as it likes, and a \"write-only\" one which can write to the database files but is limited to running a maximum of one Lambda instance. https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645032643", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645032643, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTAzMjY0Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T21:57:10Z", "updated_at": "2020-06-16T21:57:10Z", "author_association": "OWNER", "body": "https://docs.aws.amazon.com/efs/latest/ug/wt1-getting-started.html is an EFS walk-through using the AWS CLI tool instead of clicking around in their web interface.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645041663", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645041663, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA0MTY2Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:21:44Z", "updated_at": "2020-06-16T22:21:44Z", "author_association": "OWNER", "body": "https://github.com/jordaneremieff/mangum looks like the best way to run an ASGI app on Lambda at the moment.\r\n\r\n```python\r\nfrom mangum import Mangum\r\n\r\nasync def app(scope, receive, send):\r\n await send(\r\n {\r\n \"type\": \"http.response.start\",\r\n \"status\": 200,\r\n \"headers\": [[b\"content-type\", b\"text/plain; charset=utf-8\"]],\r\n }\r\n )\r\n await send({\"type\": \"http.response.body\", \"body\": b\"Hello, world!\"})\r\n\r\n\r\nhandler = Mangum(app)\r\n``` ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645042625", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645042625, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA0MjYyNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:24:26Z", "updated_at": "2020-06-16T22:24:26Z", "author_association": "OWNER", "body": "From https://mangum.io/adapter/\r\n\r\n> The AWS Lambda handler `event` and `context` arguments are made available to an ASGI application in the ASGI connection scope.\r\n> \r\n> ```\r\n> scope['aws.event']\r\n> scope['aws.context']\r\n> ```\r\nI can use https://github.com/simonw/datasette-debug-asgi to see that.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645045055", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645045055, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA0NTA1NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:31:49Z", "updated_at": "2020-06-16T22:31:49Z", "author_association": "OWNER", "body": "It looks like SAM - AWS Serverless Application Model - is the currently recommended way to deploy Python apps to Lambda from the command-line: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645047703", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645047703, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA0NzcwMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:40:19Z", "updated_at": "2020-06-16T22:40:19Z", "author_association": "OWNER", "body": "Installed SAM:\r\n```\r\nbrew tap aws/tap\r\nbrew install aws-sam-cli\r\nsam --version\r\nSAM CLI, version 0.52.0\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645048062", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645048062, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA0ODA2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:41:33Z", "updated_at": "2020-06-16T22:41:33Z", "author_association": "OWNER", "body": "```\r\nsimon@Simons-MacBook-Pro /tmp % sam init\r\n\r\n\tSAM CLI now collects telemetry to better understand customer needs.\r\n\r\n\tYou can OPT OUT and disable telemetry collection by setting the\r\n\tenvironment variable SAM_CLI_TELEMETRY=0 in your shell.\r\n\tThanks for your help!\r\n\r\n\tLearn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html\r\n\r\nWhich template source would you like to use?\r\n\t1 - AWS Quick Start Templates\r\n\t2 - Custom Template Location\r\nChoice: 1\r\n\r\nWhich runtime would you like to use?\r\n\t1 - nodejs12.x\r\n\t2 - python3.8\r\n\t3 - ruby2.7\r\n\t4 - go1.x\r\n\t5 - java11\r\n\t6 - dotnetcore3.1\r\n\t7 - nodejs10.x\r\n\t8 - python3.7\r\n\t9 - python3.6\r\n\t10 - python2.7\r\n\t11 - ruby2.5\r\n\t12 - java8\r\n\t13 - dotnetcore2.1\r\nRuntime: 2\r\n\r\nProject name [sam-app]: datasette-proof-of-concept\r\n\r\nCloning app templates from https://github.com/awslabs/aws-sam-cli-app-templates.git\r\n\r\nAWS quick start application templates:\r\n\t1 - Hello World Example\r\n\t2 - EventBridge Hello World\r\n\t3 - EventBridge App from scratch (100+ Event Schemas)\r\n\t4 - Step Functions Sample App (Stock Trader)\r\nTemplate selection: 1\r\n\r\n-----------------------\r\nGenerating application:\r\n-----------------------\r\nName: datasette-proof-of-concept\r\nRuntime: python3.8\r\nDependency Manager: pip\r\nApplication Template: hello-world\r\nOutput Directory: .\r\n\r\nNext steps can be found in the README file at ./datasette-proof-of-concept/README.md\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645050948", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645050948, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1MDk0OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:51:30Z", "updated_at": "2020-06-16T22:52:30Z", "author_association": "OWNER", "body": "```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam build --use-container\r\nStarting Build inside a container\r\nBuilding function 'HelloWorldFunction'\r\n\r\nFetching lambci/lambda:build-python3.8 Docker container image..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................\r\nMounting /private/tmp/datasette-proof-of-concept/hello_world as /tmp/samcli/source:ro,delegated inside runtime container\r\n\r\nBuild Succeeded\r\n\r\nBuilt Artifacts : .aws-sam/build\r\nBuilt Template : .aws-sam/build/template.yaml\r\n\r\nCommands you can use next\r\n=========================\r\n[*] Invoke Function: sam local invoke\r\n[*] Deploy: sam deploy --guided\r\n \r\nRunning PythonPipBuilder:ResolveDependencies\r\nRunning PythonPipBuilder:CopySource\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645051370", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645051370, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1MTM3MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:53:05Z", "updated_at": "2020-06-16T22:53:05Z", "author_association": "OWNER", "body": "```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam local invoke\r\nInvoking app.lambda_handler (python3.8)\r\n\r\nFetching lambci/lambda:python3.8 Docker container image....................................................................................................................................................................................................................................\r\nMounting /private/tmp/datasette-proof-of-concept/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container\r\nSTART RequestId: 4616ab43-6882-1627-e5e3-5a29730d52f9 Version: $LATEST\r\nEND RequestId: 4616ab43-6882-1627-e5e3-5a29730d52f9\r\nREPORT RequestId: 4616ab43-6882-1627-e5e3-5a29730d52f9\tInit Duration: 140.84 ms\tDuration: 2.49 ms\tBilled Duration: 100 ms\tMemory Size: 128 MBMax Memory Used: 25 MB\t\r\n\r\n{\"statusCode\":200,\"body\":\"{\\\"message\\\": \\\"hello world\\\"}\"}\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam local invoke\r\nInvoking app.lambda_handler (python3.8)\r\n\r\nFetching lambci/lambda:python3.8 Docker container image......\r\nMounting /private/tmp/datasette-proof-of-concept/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container\r\nSTART RequestId: 3189df2f-e9c0-1be4-b9ac-f329c5fcd067 Version: $LATEST\r\nEND RequestId: 3189df2f-e9c0-1be4-b9ac-f329c5fcd067\r\nREPORT RequestId: 3189df2f-e9c0-1be4-b9ac-f329c5fcd067\tInit Duration: 87.22 ms\tDuration: 2.34 ms\tBilled Duration: 100 ms\tMemory Size: 128 MB\tMax Memory Used: 25 MB\t\r\n\r\n{\"statusCode\":200,\"body\":\"{\\\"message\\\": \\\"hello world\\\"}\"}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645051972", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645051972, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1MTk3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T22:55:04Z", "updated_at": "2020-06-16T22:55:04Z", "author_association": "OWNER", "body": "```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam deploy --guided\r\n\r\nConfiguring SAM deploy\r\n======================\r\n\r\n\tLooking for samconfig.toml : Not found\r\n\r\n\tSetting default arguments for 'sam deploy'\r\n\t=========================================\r\n\tStack Name [sam-app]: datasette-proof-of-concept\r\n\tAWS Region [us-east-1]: \r\n\t#Shows you resources changes to be deployed and require a 'Y' to initiate deploy\r\n\tConfirm changes before deploy [y/N]: y\r\n\t#SAM needs permission to be able to create roles to connect to the resources in your template\r\n\tAllow SAM CLI IAM role creation [Y/n]: y\r\n\tHelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y\r\n\tSave arguments to samconfig.toml [Y/n]: y\r\nError: Failed to create managed resources: Unable to locate credentials\r\n```\r\nI need to get my AWS credentials sorted. I'm going to follow https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started_create-admin-group.html and https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-set-up-credentials.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645053923", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645053923, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1MzkyMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:01:49Z", "updated_at": "2020-06-16T23:01:49Z", "author_association": "OWNER", "body": "I used https://console.aws.amazon.com/billing/home?#/account and activated \"IAM user/role access to billing information\" - what a puzzling first step!\r\n\r\nI created a new user with AWS console access (which means access to the web UI) called `simon-administrator` and set a password. I created an `Administrators` group with `AdministratorAccess`.\r\n\r\n\"Banners_and_Alerts_and_IAM_Management_Console\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645054206", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645054206, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1NDIwNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:02:54Z", "updated_at": "2020-06-16T23:04:59Z", "author_association": "OWNER", "body": "I think I need to sign in to the AWS console with this new `simon-administrator` account and create IAM credentials for it.\r\n\r\n... for which I needed my root \"account ID\" - a 12 digit number - to use on the IAM login form.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645055200", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645055200, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1NTIwMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:05:48Z", "updated_at": "2020-06-16T23:05:48Z", "author_association": "OWNER", "body": "Logged in as `simon-administrator` I'm using https://console.aws.amazon.com/iam/home?region=us-east-2#/security_credentials to create credentials:\r\n\r\n\"Banners_and_Alerts_and_IAM_Management_Console\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645056636", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645056636, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1NjYzNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:10:22Z", "updated_at": "2020-06-16T23:10:22Z", "author_association": "OWNER", "body": "Clicking that button generated me an access key ID / access key secret pair. Dropping those into `~/.aws/credentials` using this format:\r\n```\r\n[default]\r\naws_access_key_id = your_access_key_id\r\naws_secret_access_key = your_secret_access_key\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645058617", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645058617, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1ODYxNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:17:09Z", "updated_at": "2020-06-16T23:17:09Z", "author_association": "OWNER", "body": "OK, `sam deploy --guided` now works!\r\n```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam deploy --guided\r\n\r\nConfiguring SAM deploy\r\n======================\r\n\r\n\tLooking for samconfig.toml : Not found\r\n\r\n\tSetting default arguments for 'sam deploy'\r\n\t=========================================\r\n\tStack Name [sam-app]: datasette-proof-of-concept\r\n\tAWS Region [us-east-1]: \r\n\t#Shows you resources changes to be deployed and require a 'Y' to initiate deploy\r\n\tConfirm changes before deploy [y/N]: \r\n\t#SAM needs permission to be able to create roles to connect to the resources in your template\r\n\tAllow SAM CLI IAM role creation [Y/n]: \r\n\tHelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y\r\n\tSave arguments to samconfig.toml [Y/n]: \r\n\r\n\tLooking for resources needed for deployment: Not found.\r\n\tCreating the required resources...\r\n\tSuccessfully created!\r\n\r\n\t\tManaged S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-1ksajo4h62s07\r\n\t\tA different default S3 bucket can be set in samconfig.toml\r\n\r\n\tSaved arguments to config file\r\n\tRunning 'sam deploy' for future deployments will use the parameters saved above.\r\n\tThe above parameters can be changed by modifying samconfig.toml\r\n\tLearn more about samconfig.toml syntax at \r\n\thttps://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html\r\n\r\n\tDeploying with following values\r\n\t===============================\r\n\tStack name : datasette-proof-of-concept\r\n\tRegion : us-east-1\r\n\tConfirm changeset : False\r\n\tDeployment s3 bucket : aws-sam-cli-managed-default-samclisourcebucket-1ksajo4h62s07\r\n\tCapabilities : [\"CAPABILITY_IAM\"]\r\n\tParameter overrides : {}\r\n\r\nInitiating deployment\r\n=====================\r\nUploading to datasette-proof-of-concept/0c208b5656a7aeb6186d49bebc595237 535344 / 535344.0 (100.00%)\r\nHelloWorldFunction may not have authorization defined.\r\nUploading to datasette-proof-of-concept/14bd9ce3e21f9c88634d13c0c9b377e4.template 1147 / 1147.0 (100.00%)\r\n\r\nWaiting for changeset to be created..\r\n\r\nCloudFormation stack changeset\r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\nOperation LogicalResourceId ResourceType \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\n+ Add HelloWorldFunctionHelloWorldPermissionProd AWS::Lambda::Permission \r\n+ Add HelloWorldFunctionRole AWS::IAM::Role \r\n+ Add HelloWorldFunction AWS::Lambda::Function \r\n+ Add ServerlessRestApiDeployment47fc2d5f9d AWS::ApiGateway::Deployment \r\n+ Add ServerlessRestApiProdStage AWS::ApiGateway::Stage \r\n+ Add ServerlessRestApi AWS::ApiGateway::RestApi \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\n\r\nChangeset created successfully. arn:aws:cloudformation:us-east-1:462092780466:changeSet/samcli-deploy1592349262/d685f2de-87c1-4b8e-b13a-67b94f8fc928\r\n\r\n\r\n2020-06-16 16:14:29 - Waiting for stack create/update to complete\r\n\r\nCloudFormation events from changeset\r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\nResourceStatus ResourceType LogicalResourceId ResourceStatusReason \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\nCREATE_IN_PROGRESS AWS::IAM::Role HelloWorldFunctionRole - \r\nCREATE_IN_PROGRESS AWS::IAM::Role HelloWorldFunctionRole Resource creation Initiated \r\nCREATE_COMPLETE AWS::IAM::Role HelloWorldFunctionRole - \r\nCREATE_IN_PROGRESS AWS::Lambda::Function HelloWorldFunction Resource creation Initiated \r\nCREATE_IN_PROGRESS AWS::Lambda::Function HelloWorldFunction - \r\nCREATE_COMPLETE AWS::Lambda::Function HelloWorldFunction - \r\nCREATE_IN_PROGRESS AWS::ApiGateway::RestApi ServerlessRestApi Resource creation Initiated \r\nCREATE_IN_PROGRESS AWS::ApiGateway::RestApi ServerlessRestApi - \r\nCREATE_COMPLETE AWS::ApiGateway::RestApi ServerlessRestApi - \r\nCREATE_IN_PROGRESS AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissi - \r\n onProd \r\nCREATE_IN_PROGRESS AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9 - \r\n d \r\nCREATE_COMPLETE AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9 - \r\n d \r\nCREATE_IN_PROGRESS AWS::ApiGateway::Deployment ServerlessRestApiDeployment47fc2d5f9 Resource creation Initiated \r\n d \r\nCREATE_IN_PROGRESS AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissi Resource creation Initiated \r\n onProd \r\nCREATE_IN_PROGRESS AWS::ApiGateway::Stage ServerlessRestApiProdStage - \r\nCREATE_COMPLETE AWS::ApiGateway::Stage ServerlessRestApiProdStage - \r\nCREATE_IN_PROGRESS AWS::ApiGateway::Stage ServerlessRestApiProdStage Resource creation Initiated \r\nCREATE_COMPLETE AWS::Lambda::Permission HelloWorldFunctionHelloWorldPermissi - \r\n onProd \r\nCREATE_COMPLETE AWS::CloudFormation::Stack datasette-proof-of-concept - \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\n\r\nCloudFormation outputs from deployed stack\r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\nOutputs \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\nKey HelloWorldFunctionIamRole \r\nDescription Implicit IAM Role created for Hello World function \r\nValue arn:aws:iam::462092780466:role/datasette-proof-of-concept-HelloWorldFunctionRole-8MIDNIV5ECA6 \r\n\r\nKey HelloWorldApi \r\nDescription API Gateway endpoint URL for Prod stage for Hello World function \r\nValue https://q7lymja3sj.execute-api.us-east-1.amazonaws.com/Prod/hello/ \r\n\r\nKey HelloWorldFunction \r\nDescription Hello World Lambda Function ARN \r\nValue arn:aws:lambda:us-east-1:462092780466:function:datasette-proof-of-concept-HelloWorldFunction-QTF78ZEUDCB \r\n---------------------------------------------------------------------------------------------------------------------------------------------------------\r\n\r\nSuccessfully created/updated stack - datasette-proof-of-concept in us-east-1\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645058947", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645058947, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1ODk0Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:18:18Z", "updated_at": "2020-06-16T23:18:18Z", "author_association": "OWNER", "body": "https://q7lymja3sj.execute-api.us-east-1.amazonaws.com/Prod/hello/\r\n\r\nThat's a pretty ugly URL. I'm not sure how to get rid of the `/Prod/` prefix on it. Might have to use the `base_url` setting to get something working: https://datasette.readthedocs.io/en/stable/config.html#base-url ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645059663", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645059663, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA1OTY2Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:20:46Z", "updated_at": "2020-06-16T23:20:46Z", "author_association": "OWNER", "body": "I added an exclamation mark to hello world and ran `sam deploy` again. https://q7lymja3sj.execute-api.us-east-1.amazonaws.com/Prod/hello/ still shows the old message.\r\n\r\nRunning `sam build --use-container` first and then `sam deploy` did the right thing.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645060598", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645060598, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2MDU5OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:24:01Z", "updated_at": "2020-06-16T23:24:01Z", "author_association": "OWNER", "body": "I changed `requirements.txt` to this:\r\n```\r\ndatasette\r\nmangum\r\n```\r\nAnd `app.py` to this:\r\n```python\r\nfrom datasette.app import Datasette\r\nfrom mangum import Mangum\r\n\r\n\r\ndatasette = Datasette([], memory=True)\r\nlambda_handler = Mangum(datasette.app())\r\n```\r\nBut then when I ran `sam build --use-container` I got this:\r\n```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam build --use-container\r\nStarting Build inside a container\r\nBuilding function 'HelloWorldFunction'\r\n\r\nFetching lambci/lambda:build-python3.8 Docker container image......\r\nMounting /private/tmp/datasette-proof-of-concept/hello_world as /tmp/samcli/source:ro,delegated inside runtime container\r\n\r\nBuild Failed\r\nRunning PythonPipBuilder:ResolveDependencies\r\nError: PythonPipBuilder:ResolveDependencies - {uvloop==0.14.0(wheel)}\r\n```\r\n`uvloop` isn't actually necessary for this project, since it's used by `uvicorn` which isn't needed if Lambda is serving ASGI traffic directly.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645061088", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645061088, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2MTA4OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:25:41Z", "updated_at": "2020-06-16T23:25:41Z", "author_association": "OWNER", "body": "Someone else ran into this problem: https://github.com/iwpnd/fastapi-aws-lambda-example/issues/1\r\n\r\nSo I need to be able to pip install MOST of Datasette, but skip `uvicorn`. Tricky. I'll try installing a custom fork?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645062266", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645062266, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2MjI2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:30:12Z", "updated_at": "2020-06-16T23:33:12Z", "author_association": "OWNER", "body": "OK, changed `requirements.txt` to this:\r\n```\r\nhttps://github.com/simonw/datasette/archive/no-uvicorn.zip\r\nmangum\r\n```\r\nNo `sam build --use-container` runs without errors. Ran `sam deploy` too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645063058", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645063058, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2MzA1OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:32:57Z", "updated_at": "2020-06-16T23:32:57Z", "author_association": "OWNER", "body": "https://q7lymja3sj.execute-api.us-east-1.amazonaws.com/Prod/hello/ is now giving me a 500 internal server error.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645063386", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645063386, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2MzM4Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:34:07Z", "updated_at": "2020-06-16T23:34:07Z", "author_association": "OWNER", "body": "Tried `sam local invoke`:\r\n```\r\nsimon@Simons-MacBook-Pro datasette-proof-of-concept % sam local invoke\r\nInvoking app.lambda_handler (python3.8)\r\n\r\nFetching lambci/lambda:python3.8 Docker container image......\r\nMounting /private/tmp/datasette-proof-of-concept/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container\r\nSTART RequestId: 7c04480b-5d42-168e-dec0-4e8bf34fa596 Version: $LATEST\r\n[INFO]\t2020-06-16T23:33:27.24Z\t7c04480b-5d42-168e-dec0-4e8bf34fa596\tWaiting for application startup.\r\n[INFO]\t2020-06-16T23:33:27.24Z\t7c04480b-5d42-168e-dec0-4e8bf34fa596\tLifespanCycleState.STARTUP: 'lifespan.startup.complete' event received from application.\r\n[INFO]\t2020-06-16T23:33:27.24Z\t7c04480b-5d42-168e-dec0-4e8bf34fa596\tApplication startup complete.\r\n[INFO]\t2020-06-16T23:33:27.24Z\t7c04480b-5d42-168e-dec0-4e8bf34fa596\tWaiting for application shutdown.\r\n[INFO]\t2020-06-16T23:33:27.24Z\t7c04480b-5d42-168e-dec0-4e8bf34fa596\tLifespanCycleState.SHUTDOWN: 'lifespan.shutdown.complete' event received from application.\r\n[ERROR] KeyError: 'requestContext'\r\nTraceback (most recent call last):\r\n\u00a0\u00a0File \"/var/task/mangum/adapter.py\", line 110, in __call__\r\n\u00a0\u00a0\u00a0\u00a0return self.handler(event, context)\r\n\u00a0\u00a0File \"/var/task/mangum/adapter.py\", line 130, in handler\r\n\u00a0\u00a0\u00a0\u00a0if \"eventType\" in event[\"requestContext\"]:\r\nEND RequestId: 7c04480b-5d42-168e-dec0-4e8bf34fa596\r\nREPORT RequestId: 7c04480b-5d42-168e-dec0-4e8bf34fa596\tInit Duration: 1120.76 ms\tDuration: 7.08 ms\tBilled Duration: 100 ms\tMemory Size: 128 MBMax Memory Used: 47 MB\t\r\n\r\n{\"errorType\":\"KeyError\",\"errorMessage\":\"'requestContext'\",\"stackTrace\":[\" File \\\"/var/task/mangum/adapter.py\\\", line 110, in __call__\\n return self.handler(event, context)\\n\",\" File \\\"/var/task/mangum/adapter.py\\\", line 130, in handler\\n if \\\"eventType\\\" in event[\\\"requestContext\\\"]:\\n\"]}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645064332", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645064332, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2NDMzMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:37:34Z", "updated_at": "2020-06-16T23:37:34Z", "author_association": "OWNER", "body": "Just realized Colin Dellow reported an issue with Datasette and Mangum back in April - #719 - and has in fact been working on https://github.com/code402/datasette-lambda for a while!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/850#issuecomment-645068128", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/850", "id": 645068128, "node_id": "MDEyOklzc3VlQ29tbWVudDY0NTA2ODEyOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-06-16T23:52:16Z", "updated_at": "2020-06-16T23:52:16Z", "author_association": "OWNER", "body": "https://aws.amazon.com/blogs/compute/announcing-http-apis-for-amazon-api-gateway/ looks very important here: AWS HTTP APIs were introduced in December 2019 and appear to be a third of the price of API Gateway.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 639993467, "label": "Proof of concept for Datasette on AWS Lambda with EFS"}, "performed_via_github_app": null}