# aws/aws-lambda-go architecture

> Architecture diagram of the GitHub repository aws/aws-lambda-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws/aws-lambda-go
- Repository: https://github.com/aws/aws-lambda-go

## Overview

AWS Lambda for Go is a runtime and support library for implementing Go functions: it receives Lambda invocations, decodes and dispatches them to a function, then reports success or failure. It also supplies event schemas, Lambda context access, Function URL HTTP adaptation, and CloudFormation custom-resource response handling. The runtime orchestration and several event families are identified from the tree and README; their internal wiring is not shown in the sampled source, so uncertain links are omitted.

Main entry points: [`lambda/entry.go`](https://github.com/aws/aws-lambda-go/blob/main/lambda/entry.go) (Start entry points), [`lambda/invoke_loop.go`](https://github.com/aws/aws-lambda-go/blob/main/lambda/invoke_loop.go) (Invocation loop), [`lambda/handler.go`](https://github.com/aws/aws-lambda-go/blob/main/lambda/handler.go) (Handler dispatch), [`lambdaurl/http_handler.go`](https://github.com/aws/aws-lambda-go/blob/main/lambdaurl/http_handler.go) (Function URL adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Lambda runtime"]
  node_entry["Start entry points<br/>[entry.go]"]
  node_loop["Invocation loop<br/>[invoke_loop.go]"]
  node_runtimeapi["Runtime API client"]
  node_extapi["Extensions API client"]
end

subgraph group_function["Function interfaces"]
  node_handler["Handler dispatch<br/>[handler.go]"]
  node_generic["Generic entry<br/>[entry_generic.go]"]
  node_events["Event schemas"]
end

subgraph group_integrations["AWS integrations"]
  node_url["Function URL adapter<br/>[http_handler.go]"]
  node_urlrequest["URL event schemas"]
  node_cfnwrap["Custom resource wrapper<br/>[wrap.go]"]
  node_cfnevent["Custom resource event<br/>[event.go]"]
  node_cfnresponse["Custom resource response<br/>[response.go]"]
end

subgraph group_metadata["Invocation metadata"]
  node_context["Lambda context<br/>[context.go]"]
end

node_aws(("AWS Lambda"))
node_userfn(("Function handler"))
node_httpapp(("HTTP application"))
node_cloudformation(("CloudFormation"))

node_aws -->|"sends invocation"| node_runtimeapi
node_loop -->|"polls invocations"| node_runtimeapi
node_loop -->|"dispatches payload"| node_handler
node_entry -->|"configures handler"| node_handler
node_handler -->|"invokes function"| node_userfn
node_runtimeapi -->|"posts result"| node_aws
node_entry -->|"starts runtime"| node_loop
node_entry -->|"supports generic start"| node_generic
node_url -->|"adapts request"| node_urlrequest
node_url -->|"serves request"| node_httpapp
node_url -->|"starts Lambda handler"| node_entry
node_cfnwrap -->|"invokes resource function"| node_userfn
node_cfnwrap -->|"builds response"| node_cfnresponse
node_cfnwrap -->|"handles event"| node_cfnevent
node_cfnresponse -->|"sends response"| node_cloudformation
node_handler -->|"provides invocation context"| node_context
node_loop -.->|"polls extension events"| node_extapi

click node_entry "https://github.com/aws/aws-lambda-go/blob/main/lambda/entry.go"
click node_loop "https://github.com/aws/aws-lambda-go/blob/main/lambda/invoke_loop.go"
click node_runtimeapi "https://github.com/aws/aws-lambda-go/blob/main/lambda/runtime_api_client.go"
click node_extapi "https://github.com/aws/aws-lambda-go/blob/main/lambda/extensions_api_client.go"
click node_handler "https://github.com/aws/aws-lambda-go/blob/main/lambda/handler.go"
click node_generic "https://github.com/aws/aws-lambda-go/blob/main/lambda/entry_generic.go"
click node_events "https://github.com/aws/aws-lambda-go/tree/main/events"
click node_url "https://github.com/aws/aws-lambda-go/blob/main/lambdaurl/http_handler.go"
click node_urlrequest "https://github.com/aws/aws-lambda-go/blob/main/events/lambda_function_urls.go"
click node_cfnwrap "https://github.com/aws/aws-lambda-go/blob/main/cfn/wrap.go"
click node_cfnevent "https://github.com/aws/aws-lambda-go/blob/main/cfn/event.go"
click node_cfnresponse "https://github.com/aws/aws-lambda-go/blob/main/cfn/response.go"
click node_context "https://github.com/aws/aws-lambda-go/blob/main/lambdacontext/context.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_loop,node_runtimeapi,node_extapi toneBlue
class node_handler,node_generic,node_events toneAmber
class node_url,node_urlrequest,node_cfnwrap,node_cfnevent,node_cfnresponse,node_userfn toneMint
class node_context toneRose
class node_aws,node_httpapp,node_cloudformation toneIndigo
```

## Components

### Lambda runtime

- [Start entry points](https://github.com/aws/aws-lambda-go/blob/main/lambda/entry.go): `lambda/entry.go`
- [Invocation loop](https://github.com/aws/aws-lambda-go/blob/main/lambda/invoke_loop.go): `lambda/invoke_loop.go`
- [Runtime API client](https://github.com/aws/aws-lambda-go/blob/main/lambda/runtime_api_client.go): `lambda/runtime_api_client.go`
- [Extensions API client](https://github.com/aws/aws-lambda-go/blob/main/lambda/extensions_api_client.go): `lambda/extensions_api_client.go`

### Function interfaces

- [Handler dispatch](https://github.com/aws/aws-lambda-go/blob/main/lambda/handler.go): `lambda/handler.go`
- [Generic entry](https://github.com/aws/aws-lambda-go/blob/main/lambda/entry_generic.go): `lambda/entry_generic.go`
- [Event schemas](https://github.com/aws/aws-lambda-go/tree/main/events): `events`

### AWS integrations

- [Function URL adapter](https://github.com/aws/aws-lambda-go/blob/main/lambdaurl/http_handler.go): `lambdaurl/http_handler.go`
- [URL event schemas](https://github.com/aws/aws-lambda-go/blob/main/events/lambda_function_urls.go): `events/lambda_function_urls.go`
- [Custom resource wrapper](https://github.com/aws/aws-lambda-go/blob/main/cfn/wrap.go): `cfn/wrap.go`
- [Custom resource event](https://github.com/aws/aws-lambda-go/blob/main/cfn/event.go): `cfn/event.go`
- [Custom resource response](https://github.com/aws/aws-lambda-go/blob/main/cfn/response.go): `cfn/response.go`

### Invocation metadata

- [Lambda context](https://github.com/aws/aws-lambda-go/blob/main/lambdacontext/context.go): `lambdacontext/context.go`

### Other components

- **AWS Lambda**
- **Function handler**
- **HTTP application**
- **CloudFormation**

## Connections

- AWS Lambda → Runtime API client: sends invocation
- Invocation loop → Runtime API client: polls invocations
- Invocation loop → Handler dispatch: dispatches payload
- Start entry points → Handler dispatch: configures handler
- Handler dispatch → Function handler: invokes function
- Runtime API client → AWS Lambda: posts result
- Start entry points → Invocation loop: starts runtime
- Start entry points → Generic entry: supports generic start
- Function URL adapter → URL event schemas: adapts request
- Function URL adapter → HTTP application: serves request
- Function URL adapter → Start entry points: starts Lambda handler
- Custom resource wrapper → Function handler: invokes resource function
- Custom resource wrapper → Custom resource response: builds response
- Custom resource wrapper → Custom resource event: handles event
- Custom resource response → CloudFormation: sends response
- Handler dispatch → Lambda context: provides invocation context
- Invocation loop → Extensions API client: polls extension events
