[FEAT] Support `AWS::Serverless-2016-10-31` SAM Transform in CloudFormation
Service
CloudFormation
API Action / Feature
CloudFormation Transform — AWS::Serverless-2016-10-31 (AWS SAM macro)
AWS Documentation
- [AWS SAM Transform reference](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-transforms.html)
- [CloudFormation Transform reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-reference.html)
- [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
Why is this needed?
AWS SAM is the standard deployment tool for Lambda-based serverless projects. sam deploy sends SAM templates to CloudFormation with Transform: AWS::Serverless-2016-10-31 and relies on CloudFormation to expand resource types before provisioning:
AWS::Serverless::Function→AWS::Lambda::Function+AWS::IAM::RoleAWS::Serverless::Api→AWS::ApiGateway::RestApi+ deployment + stageAWS::Serverless::SimpleTable→AWS::DynamoDB::Table
Currently, Floci ignores the Transform directive. SAM resource types are accepted without error but assigned synthetic physical IDs — no real Lambdas, API Gateway, or event source mappings are created. The stack reports CREATE_COMPLETE with nothing actually provisioned, which is a silent failure and very difficult to debug.
All the underlying resource types (AWS::Lambda::Function, AWS::ApiGateway::*, etc.) are already supported by Floci — the missing piece is the transform expansion step before resource processing.
The open-source [aws-sam-translator](https://github.com/aws/serverless-application-model) Python library implements this transform and could be invoked as a pre-processing step on any template containing Transform: AWS::Serverless-2016-10-31.
Without this, Floci is incompatible with the majority of AWS Lambda projects that use SAM as their IaC tool — which is the primary motivation for migrating from LocalStack Community (sunset March 2026).
Steps to Reproduce
1. Start Floci
docker run --rm -p 4566:4566 floci/floci:latest
2. Create a minimal SAM template
# template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
HelloFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs22.x
InlineCode: |
exports.handler = async () => ({ statusCode: 200, body: 'ok' });
3. Deploy via AWS CLI
export AWS_ENDPOINT_URL=http://localhost:4566
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
export AWS_DEFAULT_REGION=us-east-1
aws cloudformation deploy \
--template-file template.yaml \
--stack-name hello-stack \
--capabilities CAPABILITY_IAM
4. Inspect the stack resources
aws cloudformation describe-stack-resources --stack-name hello-stack
Actual output:
{
"StackResources": [
{
"StackName": "hello-stack",
"LogicalResourceId": "HelloFunction",
"PhysicalResourceId": "HelloFunction-7f81714c",
"ResourceType": "AWS::Serverless::Function",
"Timestamp": "2026-05-21T03:55:36.930004+00:00",
"ResourceStatus": "CREATE_COMPLETE"
}
]
}
5. Confirm no Lambda function was created
aws lambda list-functions
# Actual: {"Functions": []}
Expected behavior: The transform expands AWS::Serverless::Function into AWS::Lambda::Function + AWS::IAM::Role. describe-stack-resources should show ResourceType: AWS::Lambda::Function with a real function name, and lambda list-functions should return it.
Actual behavior: The resource type remains AWS::Serverless::Function (untransformed) with a synthetic physical ID HelloFunction-7f81714c. No real Lambda function is created. The stack silently reports CREATE_COMPLETE with nothing provisioned.
Are you willing to contribute a PR?
- [ ] Yes
- [x] No
@hectorvent The review comments are addressed. Thanks! https://github.com/floci-io/floci/pull/1012