{"id":19854647,"url":"https://github.com/obytes/terraform-aws-lambda-apigw","last_synced_at":"2025-02-28T21:35:06.940Z","repository":{"id":77139388,"uuid":"422135510","full_name":"obytes/terraform-aws-lambda-apigw","owner":"obytes","description":"AWS Lambda API Gateway HTTP API","archived":false,"fork":false,"pushed_at":"2021-10-31T09:14:39.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-01-11T13:50:32.745Z","etag":null,"topics":["api-gateway","aws","aws-lambda","lambda","rest-api","serverless"],"latest_commit_sha":null,"homepage":"https://www.obytes.com/blog/go-serverless-part-3-deploy-http-api-to-aws-lambda-and-expose-it-via-api-gateway","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/obytes.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}},"created_at":"2021-10-28T09:04:07.000Z","updated_at":"2023-10-25T00:41:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"1c96bff8-c360-4495-89d4-935ed3a7337f","html_url":"https://github.com/obytes/terraform-aws-lambda-apigw","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/obytes%2Fterraform-aws-lambda-apigw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-lambda-apigw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-lambda-apigw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-lambda-apigw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obytes","download_url":"https://codeload.github.com/obytes/terraform-aws-lambda-apigw/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241244600,"owners_count":19933293,"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":["api-gateway","aws","aws-lambda","lambda","rest-api","serverless"],"created_at":"2024-11-12T14:10:02.759Z","updated_at":"2025-02-28T21:35:06.935Z","avatar_url":"https://github.com/obytes.png","language":"HCL","readme":"# Terraform AWS Lambda API Gateway\n\nA reusable terraform module for provisioning API Gateway HTTP API that integrates with upstream Lambda Functions,\nauthorize and proxy requests.\n\n\n## Prerequisites\n\nThis module requires:\n\n- A Lambda API built with any Restfull API framework like Flask API and Fast API, and able to adapt a Lambda API Gateway\n  event into an HTTP Request and HTTP Response into API Gateway Response, you can use this\n  [Lambda Flask Starter Application](https://github.com/obytes/lambda-flask-api) for demo.\n\n- An alias pointing to the lambda function.\n\n## Usage\n\n```hcl\nmodule \"flask_api_gw\" {\n  source      = \"git::https://github.com/obytes/terraform-aws-lambda-apigw.git//modules/gw\"\n  prefix      = local.prefix\n  common_tags = local.common_tags\n\n  stage_name     = \"mvp\"\n  api_lambda     = {\n    name       = aws_lambda_function.function.function_name\n    arn        = aws_lambda_function.function.arn\n    runtime    = aws_lambda_function.function.runtime\n    alias      = aws_lambda_alias.alias.name\n    invoke_arn = aws_lambda_alias.alias.invoke_arn\n  }\n  jwt_authorizer = {\n    issuer   = \"https://securetoken.google.com/flask-lambda\"\n    audience = [ \"flask-lambda\" ]\n  }\n  routes_definitions = {\n    health_check = {\n      operation_name = \"Service Health Check\"\n      route_key      = \"GET /v1/manage/hc\"\n    }\n    whoami = {\n      operation_name = \"Get user claims\"\n      route_key      = \"GET /v1/users/whoami\"\n      # Authorization\n      api_key_required     = false\n      authorization_type   = \"JWT\"\n      authorization_scopes = []\n    }\n    site_map = {\n      operation_name = \"Get endpoints list\"\n      route_key      = \"GET /v1/admin/endpoints\"\n      # Authorization\n      api_key_required     = false\n      authorization_type   = \"JWT\"\n      authorization_scopes = []\n    }\n  }\n}\n```\n\n## Authorization\n\nFor the authorizers the module supports a JWT Authorizer because IN order to leverage a token-based Authentication and\nAuthorization standard to allow an application to access our API, but the routes can also support **`NONE`** for open\naccess mode and **IAM** for authorization with STS tokens generated by Cognito Identity Pools.\n\nThe JWT **`issuer(iss)`** and **`audience(aud)`** depends on the IaaS provider that you will use. in our case we are\nusing Firebase. so these are the issuer and audience format:\n\n- **`issuer`** - https://securetoken.google.com/[YOUR_FIREBASE_PROJECT_ID]\n- **`audience`** - YOUR_FIREBASE_PROJECT_ID\n\nFor AWS Cognito:\n\n- **`issuer`** - https://cognito-idp.[REGION_NAME].amazonaws.com/[YOUR_USER_POOL_ID]\n- **`audience`** - COGNITO_APPLICATION_CLIENT_ID\n\nFor Auth0:\n\n- **issuer`** - https://[YOUR_AUTH0_DOMAIN]/\n- **`audience`** - YOUR_AUTH0_API_ID\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-lambda-apigw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobytes%2Fterraform-aws-lambda-apigw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-lambda-apigw/lists"}