:doc:`IAM <../../iam>` / Client / delete_policy_version

*********************
delete_policy_version
*********************



.. py:method:: IAM.Client.delete_policy_version(**kwargs)

  

  Deletes the specified version from the specified managed policy.

   

  You cannot delete the default version from a policy using this operation. To delete the default version from a policy, use `DeletePolicy <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeletePolicy.html>`__. To find out which version of a policy is marked as the default version, use `ListPolicyVersions <https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListPolicyVersions.html>`__.

   

  For information about versions for managed policies, see `Versioning for managed policies <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html>`__ in the *IAM User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeletePolicyVersion>`_  


  **Request Syntax**
  ::

    response = client.delete_policy_version(
        PolicyArn='string',
        VersionId='string'
    )
    
  :type PolicyArn: string
  :param PolicyArn: **[REQUIRED]** 

    The Amazon Resource Name (ARN) of the IAM policy from which you want to delete a version.

     

    For more information about ARNs, see `Amazon Resource Names (ARNs) <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html>`__ in the *Amazon Web Services General Reference*.

    

  
  :type VersionId: string
  :param VersionId: **[REQUIRED]** 

    The policy version to delete.

     

    This parameter allows (through its `regex pattern <http://wikipedia.org/wiki/regex>`__) a string of characters that consists of the lowercase letter 'v' followed by one or two digits, and optionally followed by a period '.' and a string of letters and digits.

     

    For more information about managed policy versions, see `Versioning for managed policies <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html>`__ in the *IAM User Guide*.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`IAM.Client.exceptions.NoSuchEntityException`

  
  *   :py:class:`IAM.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IAM.Client.exceptions.InvalidInputException`

  
  *   :py:class:`IAM.Client.exceptions.DeleteConflictException`

  
  *   :py:class:`IAM.Client.exceptions.ServiceFailureException`

  