Question

Difficulty: EasyAWS Serverless Application Model (SAM)

A developer is deploying a serverless application using AWS SAM. During the deployment process, AWS CloudFormation returns a validation error stating that the resource type 'AWS::Serverless::Function' could not be found or is invalid. Which of the following is the most likely cause of this error?

  1. The template is missing the required Transform declaration specifying the AWS::Serverless-2016-10-31 transform.Answer
  2. B
    The Lambda function's execution role has a misconfigured trust policy that prevents AWS CloudFormation from assuming the role.
  3. C
    The Lambda function is configured with a timeout value that exceeds the maximum limit allowed for serverless function resources.
  4. D
    The template specifies a Lambda proxy integration when it should be configured as a Lambda custom integration.

Answer

The template is missing the required Transform declaration specifying the AWS::Serverless-2016-10-31 transform.
The correct answer is correct because AWS SAM is an extension of AWS CloudFormation. In order for CloudFormation to recognize and parse SAM-specific resource types like AWS::Serverless::Function, the template must include the 'Transform: AWS::Serverless-2016-10-31' declaration. This declaration tells CloudFormation to run the macro that translates the SAM template into standard CloudFormation resources.

Step-by-Step Solution

1
Analyze the CloudFormation error message.
The error indicates that the resource type 'AWS::Serverless::Function' is unrecognized or invalid.
This error occurs because CloudFormation does not natively support the AWS::Serverless namespace without a translator.
2
Identify the mechanism that enables CloudFormation to parse SAM resources.
The template must contain the 'Transform: AWS::Serverless-2016-10-31' declaration.
The Transform declaration instructs CloudFormation to invoke the SAM transform macro, which translates SAM-specific resources into standard CloudFormation resources during deployment.

Key Concept

AWS SAM templates must include the Transform declaration to translate serverless resources into standard CloudFormation resources.
Rate this question