Skip to main content

Lambda

Protocol: REST JSON
Endpoint: http://localhost:4566/2015-03-31/functions/...
Lambda runs your function code inside real Docker containers — the same way real AWS Lambda does.
Lambda requires the Docker socket. Mount it in your compose file:
services:
  floci:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Supported Operations

OperationDescription
CreateFunctionDeploy a Lambda function
GetFunctionGet function details and download URL
GetFunctionConfigurationGet runtime configuration
ListFunctionsList all functions
UpdateFunctionCodeUpload new code
DeleteFunctionRemove a function
InvokeInvoke a function synchronously or asynchronously
CreateEventSourceMappingConnect SQS / Kinesis / DynamoDB Streams to a function
GetEventSourceMappingGet event source mapping details
ListEventSourceMappingsList all event source mappings
UpdateEventSourceMappingUpdate a mapping
DeleteEventSourceMappingRemove a mapping
PublishVersionPublish an immutable version
CreateAliasCreate a named alias pointing to a version
GetAliasGet alias details
ListAliasesList all aliases for a function
UpdateAliasUpdate an alias
DeleteAliasDelete an alias

Configuration

floci:
  services:
    lambda:
      enabled: true
      ephemeral: false                     # Remove container after each invocation
      default-memory-mb: 128
      default-timeout-seconds: 3
      docker-host: unix:///var/run/docker.sock
      runtime-api-base-port: 9200
      runtime-api-max-port: 9299
      code-path: ./data/lambda-code        # ZIP storage location
      poll-interval-ms: 1000
      container-idle-timeout-seconds: 300  # Idle container cleanup

Supported Runtimes

Any runtime with an official AWS Lambda container image works with Floci — for example: nodejs22.x, python3.13, java21, go1.x, provided.al2023.

Examples

export AWS_ENDPOINT=http://localhost:4566

# Package a simple Node.js function
cat > index.mjs << 'EOF'
export const handler = async (event) => {
  console.log("Event:", JSON.stringify(event));
  return { statusCode: 200, body: JSON.stringify({ hello: "world" }) };
};
EOF
zip function.zip index.mjs

# Deploy the function
aws lambda create-function \
  --function-name my-function \
  --runtime nodejs22.x \
  --role arn:aws:iam::000000000000:role/lambda-role \
  --handler index.handler \
  --zip-file fileb://function.zip \
  --endpoint-url $AWS_ENDPOINT

# Invoke synchronously
aws lambda invoke \
  --function-name my-function \
  --payload '{"key":"value"}' \
  --cli-binary-format raw-in-base64-out \
  response.json \
  --endpoint-url $AWS_ENDPOINT

cat response.json

# Invoke asynchronously
aws lambda invoke \
  --function-name my-function \
  --invocation-type Event \
  --payload '{"key":"value"}' \
  --cli-binary-format raw-in-base64-out \
  /dev/null \
  --endpoint-url $AWS_ENDPOINT

# Update code
zip function.zip index.mjs
aws lambda update-function-code \
  --function-name my-function \
  --zip-file fileb://function.zip \
  --endpoint-url $AWS_ENDPOINT

Event Source Mappings

Connect Lambda to SQS, Kinesis, or DynamoDB Streams:
# SQS trigger
QUEUE_ARN=$(aws sqs get-queue-attributes \
  --queue-url $AWS_ENDPOINT/000000000000/orders \
  --attribute-names QueueArn \
  --query Attributes.QueueArn --output text \
  --endpoint-url $AWS_ENDPOINT)

aws lambda create-event-source-mapping \
  --function-name my-function \
  --event-source-arn $QUEUE_ARN \
  --batch-size 10 \
  --endpoint-url $AWS_ENDPOINT
Supported event sources for mappings: SQS, Kinesis, and DynamoDB Streams.

API Gateway

Floci supports both API Gateway v1 (REST APIs) and API Gateway v2 (HTTP APIs).
Protocol: REST JSON
Endpoint: http://localhost:4566/restapis/...

Supported Operations

CategoryOperations
APIsCreateRestApi, GetRestApi, GetRestApis, UpdateRestApi, DeleteRestApi
ResourcesCreateResource, GetResource, GetResources, UpdateResource, DeleteResource
MethodsPutMethod, GetMethod, DeleteMethod
Method ResponsesPutMethodResponse, GetMethodResponse, DeleteMethodResponse
IntegrationsPutIntegration, GetIntegration, DeleteIntegration
Integration ResponsesPutIntegrationResponse, GetIntegrationResponse, DeleteIntegrationResponse
DeploymentsCreateDeployment, GetDeployment, GetDeployments
StagesCreateStage, GetStage, GetStages, UpdateStage, DeleteStage
API KeysCreateApiKey, GetApiKey, GetApiKeys, UpdateApiKey, DeleteApiKey
Usage PlansCreateUsagePlan, GetUsagePlan, GetUsagePlans, UpdateUsagePlan, DeleteUsagePlan
Base Path MappingsCreateBasePathMapping, GetBasePathMapping, DeleteBasePathMapping

Example

export AWS_ENDPOINT=http://localhost:4566

# Create a REST API
API_ID=$(aws apigateway create-rest-api \
  --name "My API" \
  --query id --output text \
  --endpoint-url $AWS_ENDPOINT)

# Get the root resource
ROOT_ID=$(aws apigateway get-resources \
  --rest-api-id $API_ID \
  --query 'items[?path==`/`].id' --output text \
  --endpoint-url $AWS_ENDPOINT)

# Create a resource
RESOURCE_ID=$(aws apigateway create-resource \
  --rest-api-id $API_ID \
  --parent-id $ROOT_ID \
  --path-part users \
  --query id --output text \
  --endpoint-url $AWS_ENDPOINT)

# Add a GET method
aws apigateway put-method \
  --rest-api-id $API_ID \
  --resource-id $RESOURCE_ID \
  --http-method GET \
  --authorization-type NONE \
  --endpoint-url $AWS_ENDPOINT

# Add a Lambda proxy integration
aws apigateway put-integration \
  --rest-api-id $API_ID \
  --resource-id $RESOURCE_ID \
  --http-method GET \
  --type AWS_PROXY \
  --integration-http-method POST \
  --uri "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:000000000000:function:my-function/invocations" \
  --endpoint-url $AWS_ENDPOINT

# Deploy to a stage
aws apigateway create-deployment \
  --rest-api-id $API_ID \
  --stage-name dev \
  --endpoint-url $AWS_ENDPOINT

# Call the deployed API
curl http://localhost:4566/restapis/$API_ID/dev/_user_request_/users

Build docs developers (and LLMs) love