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?
- The template is missing the required Transform declaration specifying the AWS::Serverless-2016-10-31 transform.Cevap
- BThe Lambda function's execution role has a misconfigured trust policy that prevents AWS CloudFormation from assuming the role.
- CThe Lambda function is configured with a timeout value that exceeds the maximum limit allowed for serverless function resources.
- DThe template specifies a Lambda proxy integration when it should be configured as a Lambda custom integration.
Cevap
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.
Adım Adım Çözüm
Anahtar Kavram
AWS SAM templates must include the Transform declaration to translate serverless resources into standard CloudFormation resources.