:doc:`SFN <../../stepfunctions>` / Client / publish_state_machine_version

*****************************
publish_state_machine_version
*****************************



.. py:method:: SFN.Client.publish_state_machine_version(**kwargs)

  

  Creates a `version <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-version.html>`__ from the current revision of a state machine. Use versions to create immutable snapshots of your state machine. You can start executions from versions either directly or with an alias. To create an alias, use  CreateStateMachineAlias.

   

  You can publish up to 1000 versions for each state machine. You must manually delete unused versions using the  DeleteStateMachineVersion API action.

   

  ``PublishStateMachineVersion`` is an idempotent API. It doesn't create a duplicate state machine version if it already exists for the current revision. Step Functions bases ``PublishStateMachineVersion``'s idempotency check on the ``stateMachineArn``, ``name``, and ``revisionId`` parameters. Requests with the same parameters return a successful idempotent response. If you don't specify a ``revisionId``, Step Functions checks for a previously published version of the state machine's current revision.

   

  **Related operations:**

   

  
  *  DeleteStateMachineVersion
   
  *  ListStateMachineVersions
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/PublishStateMachineVersion>`_  


  **Request Syntax**
  ::

    response = client.publish_state_machine_version(
        stateMachineArn='string',
        revisionId='string',
        description='string'
    )
    
  :type stateMachineArn: string
  :param stateMachineArn: **[REQUIRED]** 

    The Amazon Resource Name (ARN) of the state machine.

    

  
  :type revisionId: string
  :param revisionId: 

    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 changed since you last updated it. If the specified revision ID doesn't match the state machine's current revision ID, the API returns ``ConflictException``.

     

    .. note::

      

      To specify an initial revision ID for a state machine with no revision ID assigned, specify the string ``INITIAL`` for the ``revisionId`` parameter. For example, you can specify a ``revisionID`` of ``INITIAL`` when you create a state machine using the  CreateStateMachine API action.

      

    

  
  :type description: string
  :param description: 

    An optional description of the state machine version.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'creationDate': datetime(2015, 1, 1),
          'stateMachineVersionArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **creationDate** *(datetime) --* 

        The date the version was created.

        
      

      - **stateMachineVersionArn** *(string) --* 

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

        
  
  **Exceptions**
  
  *   :py:class:`SFN.Client.exceptions.ValidationException`

  
  *   :py:class:`SFN.Client.exceptions.StateMachineDeleting`

  
  *   :py:class:`SFN.Client.exceptions.StateMachineDoesNotExist`

  
  *   :py:class:`SFN.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`SFN.Client.exceptions.ConflictException`

  
  *   :py:class:`SFN.Client.exceptions.InvalidArn`

  