This sample demonstrates AWS Lambda Function URLs - HTTPS endpoints directly on Lambda functions without requiring API Gateway.
+-------------------+
| |
Client (HTTP) ----> | Lambda Function | ----> Response
| URL (HTTPS) |
| |
+-------------------+
- AWS Lambda: Serverless compute
- Lambda Function URLs: Built-in HTTPS endpoints
- Lambda Function URLs: Creating HTTP endpoints directly on Lambda functions
- Public Access: Configuring NONE authentication for public access
- Request Handling: Processing HTTP method, path, query params, and body
- JSON Responses: Returning structured JSON responses
- LocalStack Pro running
- AWS CLI or awslocal installed
- jq for JSON parsing
# Deploy the sample
./scripts/deploy.sh
# Run tests
./scripts/test.shcd terraform
./deploy.shThe test script validates:
| Test | Description |
|---|---|
| Function State | Lambda function is Active |
| URL Configuration | Function URL created with NONE auth |
| Direct Invocation | lambda invoke returns 200 |
| HTTP GET | GET request via Function URL works |
| HTTP POST | POST with JSON body is processed |
Request:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name":"LocalStack"}' \
"$FUNCTION_URL"Response:
{
"message": "Hello from Lambda Function URL!",
"request": {
"method": "POST",
"path": "/",
"queryParams": {},
"body": {"name": "LocalStack"}
},
"functionName": "local-function-url-xxx"
}Resources are automatically cleaned up when LocalStack restarts. For manual cleanup:
awslocal lambda delete-function --function-name $FUNCTION_NAME
awslocal iam delete-role --role-name $ROLE_NAMEThis sample is the AWS equivalent of deploying an Azure Function with HTTP trigger.