SFN / Client / create_state_machine_alias

create_state_machine_alias#

SFN.Client.create_state_machine_alias(**kwargs)#

Creates an alias for a state machine that points to one or two versions of the same state machine. You can set your application to call StartExecution with an alias and update the version the alias uses without changing the client’s code.

You can also map an alias to split StartExecution requests between two versions of a state machine. To do this, add a second RoutingConfig object in the routingConfiguration parameter. You must also specify the percentage of execution run requests each version should receive in both RoutingConfig objects. Step Functions randomly chooses which version runs a given execution based on the percentage you specify.

To create an alias that points to a single version, specify a single RoutingConfig object with a weight set to 100.

You can create up to 100 aliases for each state machine. You must delete unused aliases using the DeleteStateMachineAlias API action.

CreateStateMachineAlias is an idempotent API. Step Functions bases the idempotency check on the stateMachineArn, description, name, and routingConfiguration parameters. Requests that contain the same values for these parameters return a successful idempotent response without creating a duplicate resource.

Related operations:

  • DescribeStateMachineAlias

  • ListStateMachineAliases

  • UpdateStateMachineAlias

  • DeleteStateMachineAlias

See also: AWS API Documentation

Request Syntax

response = client.create_state_machine_alias(
    description='string',
    name='string',
    routingConfiguration=[
        {
            'stateMachineVersionArn': 'string',
            'weight': 123
        },
    ]
)
Parameters:
  • description (string) – A description for the state machine alias.

  • name (string) –

    [REQUIRED]

    The name of the state machine alias.

    To avoid conflict with version ARNs, don’t use an integer in the name of the alias.

  • routingConfiguration (list) –

    [REQUIRED]

    The routing configuration of a state machine alias. The routing configuration shifts execution traffic between two state machine versions. routingConfiguration contains an array of RoutingConfig objects that specify up to two state machine versions. Step Functions then randomly choses which version to run an execution with based on the weight assigned to each RoutingConfig.

    • (dict) –

      Contains details about the routing configuration of a state machine alias. In a routing configuration, you define an array of objects that specify up to two state machine versions. You also specify the percentage of traffic to be routed to each version.

      • stateMachineVersionArn (string) – [REQUIRED]

        The Amazon Resource Name (ARN) that identifies one or two state machine versions defined in the routing configuration.

        If you specify the ARN of a second version, it must belong to the same state machine as the first version.

      • weight (integer) – [REQUIRED]

        The percentage of traffic you want to route to a state machine version. The sum of the weights in the routing configuration must be equal to 100.

Return type:

dict

Returns:

Response Syntax

{
    'stateMachineAliasArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • stateMachineAliasArn (string) –

      The Amazon Resource Name (ARN) that identifies the created state machine alias.

    • creationDate (datetime) –

      The date the state machine alias was created.

Exceptions

  • SFN.Client.exceptions.InvalidArn

  • SFN.Client.exceptions.InvalidName

  • SFN.Client.exceptions.ValidationException

  • SFN.Client.exceptions.StateMachineDeleting

  • SFN.Client.exceptions.ResourceNotFound

  • SFN.Client.exceptions.ConflictException

  • SFN.Client.exceptions.ServiceQuotaExceededException