Skip to content
v2.277.0

DeploymentPreferenceProperty Struct ​

Enables gradual state machine deployments.

CloudFormation automatically shifts traffic from the version the alias currently points to, to a new state machine version that you specify.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
const deploymentPreferenceProperty: stepfunctions.CfnStateMachineAlias.DeploymentPreferenceProperty = {
  stateMachineVersionArn: 'stateMachineVersionArn',
  type: 'type',

  // the properties below are optional
  alarms: ['alarms'],
  interval: 123,
  percentage: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_stepfunctions as stepfunctions

deployment_preference_property = stepfunctions.CfnStateMachineAlias.DeploymentPreferenceProperty(
    state_machine_version_arn="stateMachineVersionArn",
    type="type",

    # the properties below are optional
    alarms=["alarms"],
    interval=123,
    percentage=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.stepfunctions.*;

DeploymentPreferenceProperty deploymentPreferenceProperty = DeploymentPreferenceProperty.builder()
        .stateMachineVersionArn("stateMachineVersionArn")
        .type("type")

        // the properties below are optional
        .alarms(List.of("alarms"))
        .interval(123)
        .percentage(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.StepFunctions;

var deploymentPreferenceProperty = new DeploymentPreferenceProperty {
    StateMachineVersionArn = "stateMachineVersionArn",
    Type = "type",

    // the properties below are optional
    Alarms = new [] { "alarms" },
    Interval = 123,
    Percentage = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

deploymentPreferenceProperty := &DeploymentPreferenceProperty{
	StateMachineVersionArn: jsii.String("stateMachineVersionArn"),
	Type: jsii.String("type"),

	// the properties below are optional
	Alarms: []*string{
		jsii.String("alarms"),
	},
	Interval: jsii.Number(123),
	Percentage: jsii.Number(123),
}

Properties ​

alarmsoptionalstring[]alarmsoptionaltyping.List[str]alarmsoptionalList<String>Alarmsoptionalstring[]Alarmsoptional*[]*string#
A list of Amazon CloudWatch alarm names to be monitored during the deployment.
notes

The deployment fails and rolls back if any of these alarms go into the ALARM state.

Amazon CloudWatch considers nonexistent alarms to have an OK state. If you provide an invalid alarm name or provide the ARN of an alarm instead of its name, your deployment may not roll back correctly.

intervaloptionalnumberintervaloptionalint | floatintervaloptionalNumberIntervaloptionaldoubleIntervaloptional*float64#
The time in minutes between each traffic shifting increment.
percentageoptionalnumberpercentageoptionalint | floatpercentageoptionalNumberPercentageoptionaldoublePercentageoptional*float64#
The percentage of traffic to shift to the new version in each increment.
stateMachineVersionArnstringstate_machine_version_arnstrstateMachineVersionArnStringStateMachineVersionArnstringStateMachineVersionArn*stringrequired#
The Amazon Resource Name (ARN) of the [`AWS::StepFunctions::StateMachineVersion`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachineversion.html) resource that will be the final version to which the alias points to when the traffic shifting is complete.

While performing gradual deployments, you can only provide a single state machine version ARN. To explicitly set version weights in a CloudFormation template, use RoutingConfiguration instead.

typestringtypestrtypeStringTypestringType*stringrequired#
The type of deployment you want to perform. You can specify one of the following types:.
notes
  • LINEAR - Shifts traffic to the new version in equal increments with an equal number of minutes between each increment.

For example, if you specify the increment percent as 20 with an interval of 600 minutes, this deployment increases traffic by 20 percent every 600 minutes until the new version receives 100 percent of the traffic. This deployment immediately rolls back the new version if any CloudWatch alarms are triggered.

  • ALL_AT_ONCE - Shifts 100 percent of traffic to the new version immediately. CloudFormation monitors the new version and rolls it back automatically to the previous version if any CloudWatch alarms are triggered.
  • CANARY - Shifts traffic in two increments.

In the first increment, a small percentage of traffic, for example, 10 percent is shifted to the new version. In the second increment, before a specified time interval in seconds gets over, the remaining traffic is shifted to the new version. The shift to the new version for the remaining traffic takes place only if no CloudWatch alarms are triggered during the specified time interval.