{"id":21710908,"url":"https://github.com/jareechang/api-gateway-lamba","last_synced_at":"2026-05-04T08:37:49.313Z","repository":{"id":87963107,"uuid":"287432402","full_name":"Jareechang/api-gateway-lamba","owner":"Jareechang","description":"API gateway with lambda using Node.js 12.x","archived":false,"fork":false,"pushed_at":"2020-08-15T19:14:36.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-04T04:13:37.626Z","etag":null,"topics":["api-gateway","aws","cloudwatch","iam","infra","infrastructure","infrastructure-as-code","lambda","lambda-functions","nodejs","serverless"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/Jareechang.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-08-14T03:13:54.000Z","updated_at":"2020-08-15T19:15:41.000Z","dependencies_parsed_at":"2023-06-19T08:45:12.400Z","dependency_job_id":null,"html_url":"https://github.com/Jareechang/api-gateway-lamba","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jareechang/api-gateway-lamba","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jareechang%2Fapi-gateway-lamba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jareechang%2Fapi-gateway-lamba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jareechang%2Fapi-gateway-lamba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jareechang%2Fapi-gateway-lamba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jareechang","download_url":"https://codeload.github.com/Jareechang/api-gateway-lamba/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jareechang%2Fapi-gateway-lamba/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32600967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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":["api-gateway","aws","cloudwatch","iam","infra","infrastructure","infrastructure-as-code","lambda","lambda-functions","nodejs","serverless"],"created_at":"2024-11-25T23:18:18.892Z","updated_at":"2026-05-04T08:37:49.306Z","avatar_url":"https://github.com/Jareechang.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"## API gateway with Lambda demo on Node.js\n\nTerraform setup of API gateway with Lambda running on Node.js.\n\n**Quick demo few AWS services and concepts:**\n\n- AWS IAM roles (Lambda and API gateway)\n- AWS API gateway\n- Lambda CW logs setup \n- Lambda S3 store \n- Terraform (\u003e= v0.12.24)\n\n**Folder structure:**  \n\n```sh\npet/\n├── create.js - create new pet\n├── get.js    - get pet by id\n└── list.js   - list pets\n```\n\n### Sections\n\n1. [Quick Start](#quick-start)  \n2. [Lambda Versioning](#lambda-versioning)  \n3. [Testing The API](#testing-the-api)  \n- GET `/pets` [List Pets](#list-pets)  \n- GET `/pet/:id` [Get pet by ID](#get-pet-by-id)  \n- POST `/pets` [Create new pet](#create-pet)  \n\n### Quick Start\n\n1. Setup the environment   \n```sh\n\n// create a file called setup-env.sh \nexport AWS_ACCESS_KEY_ID=\u003cyour-aws-key\u003e\nexport AWS_SECRET_ACCESS_KEY=\u003cyour-aws-secret\u003e\nexport AWS_DEFAULT_REGION=us-east-1\n\n. ./setup-env.sh\n```\n\n2. Create Infrastructure  \n\n```sh\nterraform init\nterraform plan\nterraform apply -auto-approve \n\n# init the dist files for lambda\nyarn run version:patch\n```\n\n3. See Instructions below for testing the api.\n\n\n### Lambda Versioning \n\nCreated custom versioning of lambda code changes via node.js scripts. The gist of it is when versioning is done through the npm (patch, minor, major) the terraform configuration will pick up changes and push changes based on the version in the `package.json`. \n\n\n**Publishing:**\n```sh\n// Patch\nyarn run version:patch\n\n// Minor \nyarn run version:minor\n\n// Major \nyarn run version:major\n```\n\n**Deploying:**\n\n```\nterraform plan\nterraform apply -auto-approve \n```\n\n### Testing The API\n\n\n#### List Pets \n\n**Request:**  \n```sh\ncurl -X GET \"\u003coutput-api-gateway-invoke-url\u003e/pets\"\n```\n\n**Response:**  \n```sh\n[\n    {\n        \"id\": 1,\n        \"price\": 249.99,\n        \"type\": \"dog\"\n    },\n    {\n        \"id\": 2,\n        \"price\": 124.99,\n        \"type\": \"cat\"\n    },\n    {\n        \"id\": 3,\n        \"price\": 0.99,\n        \"type\": \"fish\"\n    }\n]\n```\n\n#### Get pet by ID:\n\n**Request:**    \n\n```\ncurl -X GET \"\u003coutput-api-gateway-invoke-url\u003e/pets/:petId\"\n\n```\n\n**Response:**  \n\n```sh\ncurl -X GET \"\u003coutput-api-gateway-invoke-url\u003e/pets/1\"\n\n[\n    {\n        \"id\": 1,\n        \"price\": 249.99,\n        \"type\": \"dog\"\n    }\n]\n```\n\n#### Create pet:\n\n**Note:** All the data is in memory so there will be no persistence between lambda requests (ie. creating this endpoint will not update the list `pets` endpoint)\n\n**Request:**    \n\n```\ncurl -X POST \"\u003coutput-api-gateway-invoke-url\u003e/stage/pets\" \\\n--data-raw '{\n    \"pet\": {\n        \"id\": {\n            \"id\": 4,\n            \"type\": \"Snake\",\n            \"price\": 399.99\n        }\n    }\n}'\n```\n\n**Response:**  \n\n```sh\n[\n  {\n    \"id\": 1,\n    \"type\": \"dog\",\n    \"price\": 249.99\n  },\n  {\n    \"id\": 2,\n    \"type\": \"cat\",\n    \"price\": 124.99\n  },\n  {\n    \"id\": 3,\n    \"type\": \"fish\",\n    \"price\": 0.99\n  },\n  {\n    \"id\": {\n      \"id\": 4,\n      \"type\": \"Snake\",\n      \"price\": 399.99\n    }\n  }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareechang%2Fapi-gateway-lamba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjareechang%2Fapi-gateway-lamba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareechang%2Fapi-gateway-lamba/lists"}