Soru

Zorluk: KolayAWS Serverless Application Model (SAM)

An operations team writes a CloudFormation template containing an AWS::Serverless::Function resource. When they attempt to deploy this template using the AWS CLI, CloudFormation returns an error stating that the resource type is invalid or unsupported. What is the root cause of this deployment failure?

  1. A
    The template specifies a Lambda custom integration instead of a Lambda proxy integration.
  2. B
    The Lambda function configuration defines an execution timeout parameter that exceeds the 15-minute maximum limit.
  3. The template does not include the required Transform declaration to invoke the AWS Serverless Application Model parser.Cevap
  4. D
    The IAM execution role's trust policy does not list the Lambda service principal as a trusted entity.

Cevap

The template does not include the required Transform declaration to invoke the AWS Serverless Application Model parser.
The correct answer is correct because AWS CloudFormation requires the Transform declaration (specifically Transform: AWS::Serverless-2016-10-31) at the root of the template. Without this declaration, CloudFormation does not recognize or parse custom resource types like AWS::Serverless::Function, resulting in an invalid resource type error.

Adım Adım Çözüm

1
Identify the resource types declared in the template.
The template contains the resource type AWS::Serverless::Function.
AWS::Serverless::Function is a custom resource type defined by the AWS Serverless Application Model (SAM).
2
Determine how CloudFormation processes SAM resource types.
CloudFormation requires the Transform: AWS::Serverless-2016-10-31 declaration to translate these resource types.
Without the Transform declaration, CloudFormation treats the template as standard CloudFormation and does not recognize the AWS::Serverless namespace.
3
Diagnose the error message indicating the resource type is invalid.
The lack of the Transform header causes CloudFormation to reject AWS::Serverless::Function.
Adding the Transform declaration resolves this issue by invoking the SAM translator before processing the resources.

Anahtar Kavram

AWS SAM templates require a Transform declaration (Transform: AWS::Serverless-2016-10-31) at the root level so that CloudFormation can translate serverless resources into standard CloudFormation resources.
Bu soruyu puanla