AWS::StepFunctions::StateMachineVersion
Represents a state machine version. A published version uses the latest state machine revision. A revision is an immutable, read-only snapshot of a state machine’s definition and configuration.
You can publish up to 1000 versions for each state machine.
Important
Before you delete a version, make sure that version's ARN isn't being referenced in any long-running workflows or application code outside of the stack.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::StepFunctions::StateMachineVersion", "Properties" : { "Description" :
String
, "StateMachineArn" :String
, "StateMachineRevisionId" :String
} }
YAML
Type: AWS::StepFunctions::StateMachineVersion Properties: Description:
String
StateMachineArn:String
StateMachineRevisionId:String
Properties
Description
-
An optional description of the state machine version.
Required: No
Type: String
Minimum:
1
Maximum:
2048
Update requires: No interruption
StateMachineArn
-
The Amazon Resource Name (ARN) of the state machine.
Required: Yes
Type: String
Minimum:
1
Maximum:
2048
Update requires: Replacement
StateMachineRevisionId
-
Identifier for a state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration.
Only publish the state machine version if the current state machine's revision ID matches the specified ID. Use this option to avoid publishing a version if the state machine has changed since you last updated it.
To specify the initial state machine revision, set the value as
INITIAL
.Required: No
Type: String
Minimum:
1
Maximum:
2048
Update requires: Replacement
Return values
Ref
When you provide the logical ID of this resource to the Ref
intrinsic
function, Ref
returns the ARN of the published state machine version. For example, arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1.
For more information about using Ref
, see Ref.
Fn::GetAtt
Fn::GetAtt
returns a value for a specified attribute of this type. The following is the available attribute.
For more information about using Fn::GetAtt
, see Fn::GetAtt.
Arn
-
Returns the ARN of the state machine version. For example,
arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1
.
Examples
The following CloudFormation template examples show how you can create multiple versions of the same state machine and publish a version using the latest revision of a state machine.
Publish multiple state machine versions
YAML
MyStateMachineVersionA: Type: AWS::StepFunctions::StateMachineVersion Properties: Description: Version 1 StateMachineArn: !Ref MyStateMachine MyStateMachineVersionB: Type: AWS::StepFunctions::StateMachineVersion Properties: Description: Version 2 StateMachineArn: !Ref MyStateMachine
Publish a version for the latest revision of a state machine
The following example uses the StateMachineRevisionId
property, which returns a unique value for revision ID of the state machine resource whenever an update is made to the state machine. CloudFormation automatically detects a different value for the StateMachineRevisionId
property compared to the property's value in previous stack and makes a replacement update to the AWS::StepFunctions::StateMachineVersion
resource. This publishes a new version that points to the most recent revision of your state machine.
YAML
MyLatestStateMachineVersion: Type: AWS::StepFunctions::StateMachineVersion Properties: Description: This version points to the most recent revision of a state machine. StateMachineArn: !Ref MyStateMachine StateMachineRevisionId: !GetAtt MyStateMachine.StateMachineRevisionId