Soru

Zorluk: ZorAWS Serverless Application Model (SAM)

A developer is using AWS Serverless Application Model (SAM) to deploy a Lambda function that processes incoming orders via Amazon API Gateway. The developer wants to configure the deployment pipeline to perform a canary deployment, shifting 10% of the traffic to the new version for a 5-minute evaluation period before routing the remaining traffic.

The current `template.yaml` is defined below:

yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Deployment template for order processing service

Resources:
ProcessOrderFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs18.x
CodeUri: ./src
Events:
PostOrder:
Type: Api
Properties:
Path: /orders
Method: post

Which of the following modifications must the developer make to the template to enable this gradual deployment strategy? (Select TWO.)

  1. Add the AutoPublishAlias property under the Properties section of ProcessOrderFunction and assign it an alias name.Cevap
  2. Add the DeploymentPreference property under the Properties section of ProcessOrderFunction and set the Type to Canary10Percent5Minutes.Cevap
  3. C
    Remove the Transform: AWS::Serverless-2016-10-31 declaration from the header to allow standard AWS CloudFormation parsing.
  4. D
    Increase the Timeout property of the ProcessOrderFunction resource to at least 15 minutes to accommodate the 5-minute canary window.
  5. E
    Modify the Events section to change the Api integration type from a Lambda Proxy integration to a custom integration.

Cevap

Add the AutoPublishAlias property under the Properties section of ProcessOrderFunction and assign it an alias name; and add the DeploymentPreference property under the Properties section of ProcessOrderFunction and set the Type to Canary10Percent5Minutes.
To configure a canary deployment for an AWS::Serverless::Function, the template must define both the AutoPublishAlias property (to create a Lambda alias pointing to the newly published version) and the DeploymentPreference property (to define the routing policy such as Canary10Percent5Minutes). AWS SAM uses these properties to automatically generate the underlying CodeDeploy resources and configurations needed to route traffic gradually.

Adım Adım Çözüm

1
Identify the requirement for AWS CodeDeploy in gradual serverless deployments.
Recognize that AWS SAM relies on AWS CodeDeploy to perform canary or linear traffic shifting.
Enabling gradual traffic shifting requires configuring properties that AWS SAM uses to provision the necessary CodeDeploy resources.
2
Configure function versioning and aliasing in the SAM template.
Identify that AutoPublishAlias must be added to the function properties.
Traffic shifting can only happen between distinct, immutable Lambda function versions referenced by a Lambda alias.
3
Define the traffic shifting strategy details.
Add the DeploymentPreference object under the function properties, specifying the Type as Canary10Percent5Minutes.
This configuration maps directly to the CodeDeploy deployment configuration that manages the 10% traffic routing and 5-minute evaluation window.

Anahtar Kavram

Configuring gradual deployments (canary/linear) in AWS SAM using AutoPublishAlias and DeploymentPreference properties.
Bu soruyu puanla