{"id":15546816,"url":"https://github.com/sjkaliski/infer-lambda-api","last_synced_at":"2026-02-26T16:39:01.915Z","repository":{"id":145954221,"uuid":"132645528","full_name":"sjkaliski/infer-lambda-api","owner":"sjkaliski","description":"Deploy an Image Recognition API using Go, Terraform, Lambda, and API Gateway.","archived":false,"fork":false,"pushed_at":"2018-05-08T20:51:43.000Z","size":6,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-14T15:46:42.608Z","etag":null,"topics":["aws","aws-lambda","go","golang","lambda","machine-learning","tensorflow","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjkaliski.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":"2018-05-08T17:55:53.000Z","updated_at":"2024-06-19T10:20:38.218Z","dependencies_parsed_at":null,"dependency_job_id":"2d96ca3e-531e-406c-8ad7-f720e4edd052","html_url":"https://github.com/sjkaliski/infer-lambda-api","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/sjkaliski%2Finfer-lambda-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkaliski%2Finfer-lambda-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkaliski%2Finfer-lambda-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkaliski%2Finfer-lambda-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjkaliski","download_url":"https://codeload.github.com/sjkaliski/infer-lambda-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250487865,"owners_count":21438674,"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":["aws","aws-lambda","go","golang","lambda","machine-learning","tensorflow","terraform"],"created_at":"2024-10-02T13:04:54.356Z","updated_at":"2026-02-26T16:39:01.558Z","avatar_url":"https://github.com/sjkaliski.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# infer-lambda-api\n\nAn example image recognition API using [infer](https://github.com/sjkaliski/infer) and AWS [Lambda](#) + [API Gateway](#).\n\n## Overview\n\nThis project serves as an example for how to quickly deploy a Go Image Recognition API using Terraform and AWS. It uses [infer](https://github.com/sjkaliski/infer), a Go package that provides abstractions for interacting with TensorFlow models.\n\n## Setup\n\n### Build\n\nLambda functions require a zipped application containing the executable and any supporting assets. A `Dockerfile` has been provided to make the build step easy.\n\n```\n$ make build\n```\n\nOnce executed, a `deployment.zip` file will be included in the root of the project. The zip includes:\n\n- Lambda Function as a Go binary\n- TensorFlow bindings\n- Model file\n- Labels file\n\n### Deploy\n\nOnce the application has been built, it's ready to be deployed. The application is deployed as a Lambda function and uses API Gateway to provide HTTP access. [Terraform](https://www.terraform.io/) config has been included to make setup easy.\n\nFor an in-depth tutorial for using Terraform and Lambda/API Gateway, see [here](https://www.terraform.io/docs/providers/aws/guides/serverless-with-aws-lambda-and-api-gateway.html).\n\nFirst, make sure you have a valid AWS account and have installed Terraform.\n\n- [AWS Account](https://aws.amazon.com/)\n- [Terraform](https://www.terraform.io/)\n\nFrom there, initialize the Terraform build and apply. *Note: This will incur fees*.\n\n```\n$ cd terraform\n$ terraform init\n$ terraform apply\n```\n\nThis creates the following\n\n- S3 Bucket and Object containing deployment zip\n- Lambda Function\n- IAM Role\n- API Gateway Rest API\n- API Gateway Methods + Integrations into Lambda\n\nTogether, this results in a Lambda function that is accessible via HTTP over API Gateway.\n\n### Teardown\n\n```\n$ terraform destroy\n```\n\nA version number will be required. Any semver value works.\n\n## Usage\n\nLocate the API Gateway Endpoint.\n\n```\n$ cd terraform\n$ terraform output endpoint\n```\n\nExecute a request, example using `curl` below.\n\n```\n$ curl --upload-file \"/path/to/img.png\" \"ENDPOINT\" -H \"Content-Type: image/png\"\n[\n    {\n        \"Class\": \"thing\",\n        \"Score\": 0.875\n    },\n    ...\n]\n```\n\n## Notes\n\n- Lambda Function memory size set to 512mb. Any lower and the TF model could not execute.\n- Startup time on first request can often be slow.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjkaliski%2Finfer-lambda-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjkaliski%2Finfer-lambda-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjkaliski%2Finfer-lambda-api/lists"}