SAM's Transform

AWS SAM's Transform as a Special Case

AWS 24 ::Serverless-2016-10-31 is the most used macro. AWS hosts it, and its translator is open source (github.com/aws/serverless-application-model (https://github.com/aws/serverless-application-model 9,573 )), so LocalStack 63,725 runs it too. infra/serverless-hello.yaml declares one AWS::Serverless::Function with InlineCode and an Api event on GET /hello, 14 lines in all:

Deploying a SAM template and listing what it expanded intoShell
aws cloudformation deploy --stack-name booknest-hello --template-file serverless-hello.yaml \
  --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND
aws cloudformation get-template --stack-name booknest-hello --template-stage Processed \
  --output text --query 'keys(TemplateBody.Resources)' | tr '\t' '\n'
Output
...
Successfully created/updated stack - booknest-hello
HelloFunctionRole
HelloFunctionHelloPermissionProd
ServerlessRestApiProdStage
HelloFunction
ServerlessRestApiDeploymentbdb62fdebc
ServerlessRestApi

One resource became six: the function, its role, a REST API with a deployment and a Prod stage, and the permission for API Gateway 24 to invoke the function. The deployment's ID ends in a hash of the API definition, so each API change creates a new deployment. Unlike your own macro, SAM 24 's translator also runs inside the SAM CLI 6,733 , so sam build and sam local invoke understand the template before it is deployed (AWS SAM for Serverless). An HttpApi event, API Gateway's cheaper HTTP API, expands into AWS::ApiGatewayV2::* resources that LocalStack 4.13.1 Community skips with the warning from Custom Resources on LocalStack, so BookNest uses the REST Api event.