No, it’s optional. However, you must complete the MFA challenge if you plan to call APIs that are secured by MFA-protected API access.
If you are calling AWS APIs using access keys for your AWS root account or IAM user, you do not need to enter an MFA code. For security reasons, we recommend that you remove all access keys from your AWS root account and instead call AWS APIs with the access keys for an IAM user that has the required permissions.