Skip to content

Latest commit

 

History

History
81 lines (63 loc) · 4.12 KB

sam-property-function-deploymentpreference.md

File metadata and controls

81 lines (63 loc) · 4.12 KB

DeploymentPreference

Specifies the configurations to enable gradual Lambda deployments. For more information about configuring gradual Lambda deployments, see Deploying Serverless Applications Gradually.

Note: You must specify an AutoPublishAlias in your AWS::Serverless::Function to use a DeploymentPreference object, otherwise an error will result.

Syntax

To declare this entity in your AWS SAM template, use the following syntax:

YAML

  [Alarms](#sam-function-deploymentpreference-alarms): List
  [Enabled](#sam-function-deploymentpreference-enabled): Boolean
  [Hooks](#sam-function-deploymentpreference-hooks): [Hooks](sam-property-function-hooks.md)
  [Role](#sam-function-deploymentpreference-role): String
  [TriggerConfigurations](#sam-function-deploymentpreference-triggerconfigurations): List
  [Type](#sam-function-deploymentpreference-type): String

Properties

Alarms A list of CloudWatch alarms that you want to be triggered by any errors raised by the deployment.
Type: List
Required: No
AWS CloudFormation Compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Enabled Whether this deployment preference is enabled.
Type: Boolean
Required: No
Default: True
AWS CloudFormation Compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Hooks Validation Lambda functions that are run before and after traffic shifting.
Type: Hooks
Required: No
AWS CloudFormation Compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Role An IAM role ARN that CodeDeploy will use for traffic shifting. An IAM role will not be created if this is provided.
Type: String
Required: No
AWS CloudFormation Compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

TriggerConfigurations A list of trigger configurations you want to associate with the deployment group. Used to notify an SNS topic on lifecycle events.
Type: List
Required: No
AWS CloudFormation Compatibility: This property is passed directly to the [TriggerConfigurations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-triggerconfigurations) property of an AWS::CodeDeploy::DeploymentGroup.

Type There are two categories of deployment types at the moment: Linear and Canary. For more information about available deployment types see Deploying Serverless Applications Gradually.
Type: String
Required: Yes
AWS CloudFormation Compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Examples

DeploymentPreference

Example deployment preference

YAML

DeploymentPreference:
  Enabled: True
  Type: Canary10Percent10Minutes 
  Alarms:
    - Ref: AliasErrorMetricGreaterThanZeroAlarm
    - Ref: LatestVersionErrorMetricGreaterThanZeroAlarm
  Hooks:
    PreTraffic:
      Ref: PreTrafficLambdaFunction
    PostTraffic:
      Ref: PostTrafficLambdaFunction