Deleting a Managed Policy Version

You can delete a policy version at any time if you no longer need it and if it is not set as the default one. For more information about how to find out which version is set as the default one, see Listing the Versions of a Managed Policy.

To delete the default policy version, you need to delete all the other versions of this managed policy and then delete the policy. For more information, see Deleting a Managed Policy.

Deleting a Managed Policy Version Using OSC CLI

The DeletePolicyVersion command deletes a specified version of a managed policy, if it is not set as the default one.

Request sample
$ osc-cli api DeletePolicyVersion --profile "default" \
    --PolicyOrn "orn:ows:idauth::012345678910:policy/example/example-user-policy" \
    --VersionId "v1"

This command contains the following attributes that you need to specify:

  • PolicyOrn: The OUTSCALE Resource Name (ORN) of the policy. For more information, see Resource Identifiers.

  • VersionId: The ID of the version of the policy you want to delete.

The DeletePolicyVersion command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Deleting a Managed Policy Version Using oapi-cli

The DeletePolicyVersion command deletes a specified version of a managed policy, if it is not set as the default one.

Request sample
$ oapi-cli --profile "default" DeletePolicyVersion \
    --PolicyOrn "orn:ows:idauth::012345678910:policy/example/example-user-policy" \
    --VersionId "v1"

This command contains the following attributes that you need to specify:

  • PolicyOrn: The OUTSCALE Resource Name (ORN) of the policy. For more information, see Resource Identifiers.

  • VersionId: The ID of the version of the policy you want to delete.

The DeletePolicyVersion command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Deleting a Managed Policy Version Using AWS CLI

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

To delete a policy version, use the delete-policy-version command following this syntax:

Request sample
$ aws iam delete-policy-version \
    --profile YOUR_PROFILE \
    --policy-arn arn:aws:iam::123456789012:policy/MY_POLICY \
    --version-id v2 \
    --endpoint https://eim.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • policy-arn: The OUTSCALE Resource Name (ORN) of the policy.

  • version-id: The ID of the policy version you want to delete.

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

The specified policy version is deleted.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.