# IAM policy example: let users manage their own MFA device, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Allows an IAM user to create, enable, resync and delete a virtual MFA device and to list their own MFA devices, scoped to their own user name with the aws:username variable. It follows the AWS documentation example for self-managed MFA. The original uses a wildcard on every user.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ManageMfa",
      "Effect": "Allow",
      "Action": [
        "iam:*MFADevice",
        "iam:ListMFADevices",
        "iam:ListVirtualMFADevices"
      ],
      "Resource": "*"
    }
  ]
}
```

## What it allows

- Allows creating, enabling, deactivating, deleting and resyncing MFA devices for every user in the account.

- Allows 10 actions (iam:*MFADevice, iam:ListMFADevices, iam:ListVirtualMFADevices) on every resource.

Checks:
- medium: Allows 5 write or permissions-management actions on every resource ("Resource": "*"). (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)

The wildcard iam:*MFADevice covers 8 actions and the resource is every user, so one user can remove another user's MFA.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ListOwnMfa",
      "Effect": "Allow",
      "Action": [
        "iam:ListMFADevices",
        "iam:ListVirtualMFADevices"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ManageOwnMfa",
      "Effect": "Allow",
      "Action": [
        "iam:CreateVirtualMFADevice",
        "iam:EnableMFADevice",
        "iam:ResyncMFADevice",
        "iam:DeactivateMFADevice",
        "iam:DeleteVirtualMFADevice"
      ],
      "Resource": [
        "arn:aws:iam::111122223333:mfa/${aws:username}",
        "arn:aws:iam::111122223333:user/${aws:username}"
      ]
    }
  ]
}
```

The rewrite names five actions and scopes them to the caller's own user and MFA device ARN. Other users' devices cannot be changed.

- Allows 2 actions (iam:ListMFADevices, iam:ListVirtualMFADevices) on every resource.
- Allows 5 actions (iam:CreateVirtualMFADevice, iam:EnableMFADevice, iam:ResyncMFADevice, iam:DeactivateMFADevice, iam:DeleteVirtualMFADevice) on arn:aws:iam::111122223333:mfa/${aws:username}, arn:aws:iam::111122223333:user/${aws:username}.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every IAM action and its access level](/actions/iam/)

## Related pages

- [IAM policy example: change your own password and keys](/examples/iam-manage-own-credentials/)
- [IAM policy example: let a user pass one role to Lambda](/examples/iam-pass-one-role-to-lambda/)
- [IAM policy example: let a team create roles under one path](/examples/iam-delegate-role-management-by-path/)
- [All of them](/examples/)

## Sources

- IAM User Guide: self-manage an MFA device: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_iam_mfa-selfmanage.html (read 16 Nov 2026)
- IAM User Guide: require MFA for API access: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/iam-manage-own-mfa-device/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
