In this post, we will explore How To Fix - ""Entity Already Exists" error creating MFA Device in AWS IAM which happens while we are trying to create multi-factor authentication (MFA) device for AWS Identity and Access Management (IAM) user. Error Log
This entity already exists.
<!-- more -->
MFADevice entity at the same path and name already exists.
Before you can add a new virtual MFA device, ask your administrator
to delete the existing device using the CLI or API.MFA Device entity at the same path and name already exists.
MFA Device entity at the same path and name already exists
$aws iam list-virtual-mfa-devices
You get output in below format.
"VirtualMFADevices": \[
{
"SerialNumber": "arn:aws:iam::123456789012:mfa/TestMFADevice"
},
{
"SerialNumber": "arn:aws:iam::1234648412:mfa/user1"
}
\]
Complete command syntax
list-virtual-mfa-devices
\[--assignment-status <value>\]
\[--max-items <value>\]
\[--cli-input-json | --cli-input-yaml\]
\[--starting-token <value>\]
\[--page-size <value>\]
\[--generate-cli-skeleton <value>\]
\[--debug\]
\[--endpoint-url <value>\]
\[--no-verify-ssl\]
\[--no-paginate\]
\[--output <value>\]
\[--query <value>\]
\[--profile <value>\]
\[--region <value>\]
\[--version <value>\]
\[--color <value>\]
\[--no-sign-request\]
\[--ca-bundle <value>\]
\[--cli-read-timeout <value>\]
\[--cli-connect-timeout <value>\]
\[--cli-binary-format <value>\]
\[--no-cli-pager\]
\[--cli-auto-prompt\]
arn:aws:iam::<aws\_acc\_id>:mfa/<user>
$aws iam deactivate-mfa-device --user-name <user\_name> --serial-number arn:aws:iam::<aws\_acc\_id>:mfa/<Your\_username>
Example-
aws iam deactivate-mfa-device --user-name Joy --serial-number arn:aws:iam::210987654321:mfa/JoyMFADevice
If above gives error MFA Device doesn't exist, you could still proceed to the next step. Complete Syntax
deactivate-mfa-device
--user-name <value>
--serial-number <value>
\[--cli-input-json | --cli-input-yaml\]
\[--generate-cli-skeleton <value>\]
\[--debug\]
\[--endpoint-url <value>\]
\[--no-verify-ssl\]
\[--no-paginate\]
\[--output <value>\]
\[--query <value>\]
\[--profile <value>\]
\[--region <value>\]
\[--version <value>\]
\[--color <value>\]
\[--no-sign-request\]
\[--ca-bundle <value>\]
\[--cli-read-timeout <value>\]
\[--cli-connect-timeout <value>\]
\[--cli-binary-format <value>\]
\[--no-cli-pager\]
\[--cli-auto-prompt\]
\[--no-cli-auto-prompt\]
$aws iam delete-virtual-mfa-device --serial-number arn:aws:iam::<aws\_acc\_id>:mfa/<Your\_username>
Example
aws iam delete-virtual-mfa-device --serial-number arn:aws:iam::123456789012:mfa/JoyMFADevice
delete-virtual-mfa-device
--serial-number <value>
\[--cli-input-json | --cli-input-yaml\]
\[--generate-cli-skeleton <value>\]
\[--debug\]
\[--endpoint-url <value>\]
\[--no-verify-ssl\]
\[--no-paginate\]
\[--output <value>\]
\[--query <value>\]
\[--profile <value>\]
\[--region <value>\]
\[--version <value>\]
\[--color <value>\]
\[--no-sign-request\]
\[--ca-bundle <value>\]
\[--cli-read-timeout <value>\]
\[--cli-connect-timeout <value>\]
\[--cli-binary-format <value>\]
\[--no-cli-pager\]
\[--cli-auto-prompt\]
\[--no-cli-auto-prompt\]
MFA Device entity at the same path and name already exists ,aws mfa entity already exists error ,error entity\_already\_exists ,aws mfadevice entity at the same path and name already exists ,ensure multi factor authentication (mfa is enabled for all iam users that have a console password) ,mfa device, ask your administrator to delete the existing device using the cli or api. ,an error occurred accessdenied when calling the deletevirtualmfadevice operation ,aws iam list-virtual-mfa-devices ,aws root user mfa ,aws multiple mfa devices ,aws console ,mfa device, ask your administrator to delete the existing device using the cli or api. ,ensure multi factor authentication (mfa is enabled for all iam users that have a console password) ,aws cli mfa delete ,aws iam list-virtual-mfa-devices ,aws mfa 1password ,aws root user mfa ,aws multiple mfa devices ,aws mfa setup ,This entity already exists