☰

AWS IAM Multi-Factor Authentication (MFA)

AWS IAM MFA: How to Enable MFA for IAM Users Step by Step

All types of AWS accounts including sub-accounts now require the root user to utilize multi-factor authentication. Therefore good knowledge of AWS IAM MFA is now fundamental for those who look after a cloud account. Implementation can be achieved in a few minutes and provides security for all assets that can be accessed via a login.

⚡ QUICK ANSWER

MFA is a further layer of verification to a user logging into AWS. As well as a username and password, a user can input a code, or press a button on a pre-registered device (such as a mobile phone/tablet) to verify their identity. Each user can register up to 8 devices for MFA.

Within this Tutorial we show you how to use AWS IAM Multi-Factor Authentication. Are you searching for the best provider to provide you with information and also looking to undertake the Advanced Certification Course from India’s Leading AWS Training Institute? If so, then you have found the Right Path.

By following the below Tutorial, you can gain an in-depth understanding of AWS IAM Multi-Factor Authentication. Simply follow all India’s Leading Best AWS Training Institute’s Tutorials to become a Pro AWS Developer.

In this article, you will learn:

  • What is AWS multi-factor authentication?
  • Why use AWS multi-factor authentication?
  • What do you need to implement multi-factor authentication?
  • How to implement a virtual MFA device on an IAM user (console)
  • Which type of MFA should I use?
  • Best practice and solving issues

What is AWS multi-factor authentication (AWS MFA)?

AWS multi-factor authentication (MFA) is an extra security feature that can be implemented within your AWS environment. Both your AWS account and the IAM users that you create within your AWS account can have MFA implemented.

Introduction

With MFA implemented, when a user logs into an AWS website, they will be required to input:

♦ Their username and password (first factor – ‘something known’)

♦ An authentication code or press a button on their MFA device (Smartphone/Tablet) (second factor – ‘something owned’) to authenticate. Combining these different factors greatly increases the security of both your AWS account and its assets.

How AWS MFA protects your login using two-factor authentication with a password and a second verification method.

AWS IAM Multi-Factor Authentication

Amazon MFA provides further security. Those accessing AWS websites and services are required to input a unique authentication code (which can either be a one off password or access key). This code is generated via a permitted MFA device (for example, Smartphone/Tablet) or received via a Short Message Service (SMS) text message.

Why use AWS multi-factor authentication?

AWS utilizes MFA due to the excellent security that it offers. Benefits include:

  • Excellent security provision.
  • Fine-grained control.
  • One-off credentials.
  • Versatile and secure credential provision.
  • Interoperability with AWS services.
  • Ability to utilise an external identity solution.

What do you need to implement multi-factor authentication?

♦ Virtual MFA devices:

Mobile devices including Smartphones and tablets can be utilised as a virtual MFA device. There are various AWS compatible apps available to download onto a mobile device. These apps generate 6-figure authentication codes. There is no cost for this service.

Depending on your Smartphone operating system, you will need to install the relevant virtual MFA apps.

Permissions Required for AWS IAM MFA

PERMISSIONS NEEDED:

To administer a virtual MFA device for an IAM user, the policy permissions must be set to allow authenticatedIAM Users to ‘Manage’ their own MFA Device.

♦Not only can you implement MFA on your AWS account, but also on specific IAM users that you have created within your AWS account group. Furthermore, MFA can be implemented to regulate access to AWS service APIs.

Once you have acquired a suitable U2F security key, hardware MFA device or virtual MFA device, there is no extra cost for implementing MFA on AWS.

♦Furthermore, MFA can also be used to secure inter-account access.

There are 2 Amazon MFA device types – a Security Token and SMS Text Message.

Steps To enable a virtual MFA device for an IAM user (console)

Below is a step-by-step guide to implement a virtual MFA device on an IAM user.

AWS MFA best practices, including using a TOTP app, entering codes quickly, adding a backup device and following least privilege access.

  1. Log into the AWS Management Console and subsequently onto the IAM console at https://console.aws.amazon.com/iam/

Step 1: Open the IAM Dashboard

2: Select the IAM User

  1. Within the navigation panel, click on Users.
  2. Select the user name for whom the MFA device is to be implemented.

 3: Open Security Credentials

  1. Click on Security credentials. Next to the Assigned MFA device, click on Manage.

 4: Configure the Virtual MFA Device

  1. Within the Manage MFA Device application, click on Virtual MFA device and then click on Continue.
  2. Launch the virtual MFA app on your mobile device.
  3. Check if your MFA app is able to recognise and scan a QR code. Either:
  4. Use the ‘Show QR Code’ function within the application to display the code. Then, for example, press on the camera icon within the app or select a ‘Scan code’ function to allow your mobile device to scan the displayed QR code (if your device is able to). Within the Manage MFA Device application, click on Show secret key and then input this secret key into your MFA app.
  5. Once completed, your virtual MFA device will begin producing authentication codes in the form of one off passwords.
  6. Within the Manage MFA Device application, input the current one off password that is shown on your virtual MFA app into the MFA code 1 field. Then wait up to 30 seconds for your MFA device to produce a fresh one off password. Enter this second one off password into the MFA code 2 section (having first received it). Click on the Assign MFA button.

Note: It is essential that you complete the assignment process without delay following production of the one off passwords. Should there be too great a delay between creation of the one off passwords and assignment, although the MFA device will successfully be linked to the relevant user, the MFA device will become desynchronised due to time based one off passwords (TOTP) having a limited lifetime. Should this occur, you can attempt to re-link the MFA device.

Your virtual MFA device is now ready for use.

♦In addition, it is also possible to implement a virtual MFA device on your AWS root user via the AWS Management Console.

In order to implement MFA devices for your AWS account, you must log into AWS as the root user (using your e-mail ID and password).

♦It is not possible to implement a MFA device for the root user of your AWS account in the IAM console nor using the AWS CLI, AWS API or other command line tools.

Should your MFA device (Smartphone/Tablet) be misplaced, stolen or malfunction, you can still log into AWS by using other authentication factors.

I trust that through reading this article you have learnt how to implement a virtual MFA device (mobile device) for an IAM user and also gained knowledge of AWS Multi-factor authentication.

Last but not least, always ask for help!

AWS Two Factor Authentication Options: Which MFA Type to Pick

Whilst previous tutorials and also previously mentioned SMS text message MFA still exist, AWS has now discontinued SMS text message MFA. Currently, there are 3 MFA device types available for implementation on IAM users (a maximum of 8 devices can be implemented per user):

 

MFA type How it works Good to know
Passkey or security key Fingerprint, face, PIN or a USB key      Phishing resistant, and the type AWS recommends where possible   
Virtual authenticator app      A phone app shows a six-digit code Free, and the usual choice for learners
Hardware TOTP token A small device shows a code AWS suggests security keys instead

 

Two practical examples

  • A developer implements a virtual authenticator app to log in on a daily basis and carries a security key in a drawer. Should their mobile device be misplaced, they can still log in with the security key.
  • A team leader includes a condition in an IAM policy which means that staff must use MFA during their sessions in order to perform actions such as database deletion which are of a sensitive nature.

MFA Best Practices and Troubleshooting

Below are best practice guidelines to follow when implementing and using your AWS MFA authenticator app.

  • Download a TOTP compliant app such as Google Authenticator or Authy.
  • Input the two codes swiftly as warned above.
  • Also implement a secondary device – in case your mobile device is lost.
  • Multi-factor authentication is most effective when combined with the principle of least privilege.7 steps to enable virtual MFA for an AWS IAM user using an authenticator app.

Conclusion

Implementing MFA is one of the most economical methods of securing an AWS account. Simply log into the IAM console, select a user and allocate a device. Validation of two codes then occurs. Generally, the main issue in implementing MFA can be overcome by implementing a modern and a secondary MFA device.

 

 

Frequently Asked Questions

 

1. How do I implement MFA on AWS IAM users?

Log into the IAM console. Select Users and then the appropriate user. Next, open Security credentials and implement an MFA device. Select a virtual MFA app, scan the displayed QR code and then input 2 successive codes. The device can then be used to log in. On each login attempt, a code is requested.

2. Does AWS charge for MFA?

No. There is no charge for implementing MFA on AWS. In addition, there is no cost to download virtual authenticator apps. However, you only need to pay if you choose to purchase a physical MFA device, such as a security key. Therefore, you can enable MFA without any initial cost.

3. Which MFA authenticator app should I use?

Any app which is TOTP compliant can be used. Popular apps for both Android and iOS mobile devices include Google Authenticator, Microsoft Authenticator, Authy and Duo Mobile. Select an app with which you are already familiar. Also, it is advisable to implement a secondary device so that you can still log in should your mobile device be lost.

4. Is it still possible to implement MFA via SMS text messages on AWS?

No. Although some older resources continue to explain how to do so, AWS has now stopped supporting SMS text message MFA. Instead, implement a passkey/security key, virtual authenticator app or hardware TOTP token. Again, passkeys and security keys offer the greatest anti-phishing protection.

5. How many MFA devices can an IAM user implement?

An IAM user or root user can implement a maximum of 8 MFA devices. This may comprise a combination of different MFA types. Registering multiple devices provides a backup if one gets lost or damaged. However, you only need one functioning MFA device to log in.

6. What should I do if I lose my MFA device?

If you have a second implemented device, then log in using this. Otherwise, utilise the recovery features available on AWS for MFA secured identities. Alternatively, contact an administrator to disable your lost MFA device and then implement a new one. Ideally, a secondary device should be implemented in advance to avoid this situation.

7. How do I implement MFA on the root user?

Login to AWS as the root user (using your e-mail ID and password). Then implement an MFA device by accessing the security credentials page. Since AWS requires MFA for the root user on all account types, enable it during the initial setup. Going forward, use IAM users for day-to-day tasks.

8. Why is my MFA code not working?

As noted above, MFA codes are time dependent and so have a limited lifetime. Set your mobile phone to update its time automatically and enter each authentication code promptly. During setup, make sure you enter both codes without delay.Otherwise, your MFA device may become out of synchronisation. If this does occur, disable and then re-implement the MFA device.

Popular Tags:

IAM for Beginners - A Comprehensive Guide Mastering AWS IAM Policies Securely Control Access to AWS Resources with IAM