Delete a user managed policy
Deleting process (adapted from paws
docs)
Before you can delete a managed policy, you must first detach the policy from all users, groups, and roles that it is attached to. In addition, you must delete all the policy's versions. The following steps describe the process for deleting a managed policy:
Detach the policy from all users, groups, and roles that the policy is attached to using
aws_policy_attach()
. To list all the users, groups, and roles that a policy is attached to useaws_policy_list_entities()
Delete all versions of the policy using
aws_policy_delete_version()
. To list the policy's versions, useaws_policy_list_versions()
. You cannot useaws_policy_delete_version()
to delete the version that is marked as the default version. You delete the policy's default version in the next step of the process.Delete the policy using this function (this automatically deletes the policy's default version)
See also
Other policies:
as_policy_arn()
,
aws_policies()
,
aws_policy()
,
aws_policy_attach()
,
aws_policy_create()
,
aws_policy_delete_version()
,
aws_policy_detach()
,
aws_policy_exists()
,
aws_policy_list_entities()
,
aws_policy_list_versions()
Examples
if (FALSE) { # interactive()
doc <- aws_policy_document_create(
region = "us-east-2",
account_id = "1234567890",
resource_id = "*",
user = "jane_doe",
action = "rds-db:connect"
)
aws_policy_create("RdsAllow456", document = doc)
aws_policy_delete("RdsAllow456")
}