{"id":17174190,"url":"https://github.com/lingyielia/apigateway-lambda-rds-postgis","last_synced_at":"2025-10-28T16:03:48.035Z","repository":{"id":68440978,"uuid":"121091013","full_name":"lingyielia/apigateway-lambda-rds-postgis","owner":"lingyielia","description":"Create an API using Amazon Web Services","archived":false,"fork":false,"pushed_at":"2018-03-30T03:34:00.000Z","size":946,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-27T00:36:47.294Z","etag":null,"topics":["aws-apigateway","aws-lambda","aws-rds","postgis","postgresql"],"latest_commit_sha":null,"homepage":"https://geocrosswalk.herokuapp.com/api","language":"Jupyter Notebook","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/lingyielia.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-11T06:03:51.000Z","updated_at":"2020-06-25T16:28:11.000Z","dependencies_parsed_at":"2023-07-08T15:46:05.727Z","dependency_job_id":null,"html_url":"https://github.com/lingyielia/apigateway-lambda-rds-postgis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lingyielia/apigateway-lambda-rds-postgis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingyielia%2Fapigateway-lambda-rds-postgis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingyielia%2Fapigateway-lambda-rds-postgis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingyielia%2Fapigateway-lambda-rds-postgis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingyielia%2Fapigateway-lambda-rds-postgis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lingyielia","download_url":"https://codeload.github.com/lingyielia/apigateway-lambda-rds-postgis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingyielia%2Fapigateway-lambda-rds-postgis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281467288,"owners_count":26506464,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-apigateway","aws-lambda","aws-rds","postgis","postgresql"],"created_at":"2024-10-14T23:53:29.332Z","updated_at":"2025-10-28T16:03:48.030Z","avatar_url":"https://github.com/lingyielia.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build an API using AWS API Gateway and Lambda\n- [AWS API Gateway](https://aws.amazon.com/api-gateway/)\n- [AWS Lambda](https://aws.amazon.com/lambda/)\n- [AWS RDS](https://aws.amazon.com/rds/)\n\nAPI Gateway takes in http calls and trigger the Lambda function. Lambda function takes in the request data (lon/lat in json format) from the API Gateway, queries the Database, and returns the result back to API Gateway. In this example, I will build an API for query geo-cross-walk data of New York City.\n\n![gateway](figure/gateway.png)\n\n## Create Lambda function\n1. Choose Runtime. Runtime is the runtime environment for the Lambda function you are uploading. Some major runtime supported by Lambda function are Node.js, Python, Java, Go, and C#. Here we use Node.js.\nThe basic syntax of Lambda function is:\n\n        exports.myHandler = function(event, context, callback) {\n            ...\n            // Use callback() and return information to the caller.  \n        }\n\n2. Choose Role. Role defines the permissions this Lambda function has regarding all AWS resources.\n3. Upload the .zip file containing the Lambda function you've written and its related packages.\n\n![functioncode](figure/functioncode.png)\n\n__Note:__ The handler defines how to trigger this lambda function. \"index\" means to find the file \"index.js\", \"handler\" corresponds to the function name \"handler\".\n\n4. Add API Gateway as trigger.\n\n![addtrigger](figure/addtrigger.png)\n\n## Create API\n1. In the API Gateway interface, create a new API.\n2. Choose `Actions` --\u003e `Create Resource`, here the Resource Name is \"nyc\".\n3. Choose `Actions` --\u003e `Create Method` as `GET`, and connect it with the Lambda function created before.\n\n![method](figure/method.png)\n\n4. For this /nyc-GET Method, choose `Integration Request` --\u003e `Body Mapping Templates`, add a mapping template in it.\n- Content-Type: application/json\n\n        {\n            \"long\": $input.params('long'),\n            \"lati\": $input.params('lati')\n        }\n\n5. Choose `Actions` --\u003e `Deploy API`. Now the API is ready for query.\n\n## Test\n### Query NYC dataset:\nNYU CUSP: (40.693258, -73.987493)\n\n        https://d5tgnm602g.execute-api.us-east-1.amazonaws.com/beta/nyc?long=-73.987493\u0026lati=40.693258\n\n![cusp](figure/cusp.png)\n\n### Query LA County dataset:\nLos Angeles International Airport: (33.945421, -118.408518)\n\n        https://d5tgnm602g.execute-api.us-east-1.amazonaws.com/beta/la?long=-118.408518\u0026lati=33.945421\n\n![airport](figure/airport.png)\n\nYou can also integrate geo-cross-walk data in your analysis using this API. See examples [here](https://github.com/argo-marketplace/LA-LocalGeo-CrossWalk/blob/master/AWS_API_Gateway/API_user_instruction.ipynb).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingyielia%2Fapigateway-lambda-rds-postgis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flingyielia%2Fapigateway-lambda-rds-postgis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingyielia%2Fapigateway-lambda-rds-postgis/lists"}