server-lambda

command
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

samples/server-lambda/main.go

Demonstra o bloco Lambda com API Gateway v2 (HTTP API) e ALB. O mesmo Router e os mesmos Handlers funcionam com ambas as origens — basta trocar WithSource() para alternar entre elas.

O handler é idêntico ao do servidor HTTP; apenas o ponto de entrada muda.

Deploy:

GOOS=linux GOARCH=amd64 go build -tags lambda.norpc -o bootstrap .
zip function.zip bootstrap
aws lambda update-function-code --function-name my-api --zip-file fileb://function.zip

Variáveis de ambiente (configuradas no Lambda console ou Terraform):

LAMBDA_SOURCE   "apigateway_v2" | "apigateway_v1" | "alb"  (default: apigateway_v2)
AWS_REGION      região AWS (configurada automaticamente pelo runtime)
USERS_TABLE     nome da tabela DynamoDB
REDIS_ADDR      endpoint do Redis (ElastiCache)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL