'Is that possible to delete a managed policy in AWS IAM from my account?

In web console of AWS IAM policies, the option "Delete" out of the "Action" drop down menu is disabled when selecting any managed policy.

In CLI, when trying to delete a managed policy, I got:

$ aws iam delete-policy --policy-arn arn:aws:iam::aws:policy/service-role/AWSQuickSightElasticsearchPolicy

An error occurred (AccessDenied) when calling the DeletePolicy operation: Cannot delete policies outside your own account.

the simple question: is that possible to remove any managed policy from my account? If yes, how?



Solution 1:[1]

No, you cannot delete IAM policies that are managed by AWS. The policy in your example seems to be the one managed by AWS and hence cannot be deleted. You can however delete customer managed IAM policies if you have appropriate permission to do so.

Ref: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-delete.html#:~:text=You%20cannot%20delete%20AWS%20managed%20policies

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1