How to detach a policy from an IAM user

Use the below command to detach an attached policy from an IAM user where username is the name of the user and arn:aws:iam::123456789123:policy/POLICYNAME is the arn of the policy being detached.

aws iam detach-user-policy --user-name username --policy-arn arn:aws:iam::123456789123:policy/POLICYNAME

See also  How to delete an IAM user