Skip to content

IAM  >  Operations  >  enable_mfa_device

enable_mfa_device

Operation

enable_mfa_device async

enable_mfa_device(input: EnableMFADeviceInput, plugins: list[Plugin] | None = None) -> EnableMFADeviceOutput

Enables the specified MFA device and associates it with the specified IAM user. When enabled, the MFA device is required for every subsequent login by the IAM user associated with the device.

Parameters:

Name Type Description Default
input EnableMFADeviceInput

An instance of EnableMFADeviceInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
EnableMFADeviceOutput

An instance of EnableMFADeviceOutput.

Input

EnableMFADeviceInput dataclass

Bases: _SerdeShape

Dataclass for EnableMFADeviceInput structure.

Attributes

authentication_code1 class-attribute instance-attribute
authentication_code1: str | None = ...

An authentication code emitted by the device.

The format for this parameter is a string of six digits.

Warning

Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device.

authentication_code2 class-attribute instance-attribute
authentication_code2: str | None = ...

A subsequent authentication code emitted by the device.

The format for this parameter is a string of six digits.

Warning

Submit your request immediately after generating the authentication codes. If you generate the codes and then wait too long to submit the request, the MFA device successfully associates with the user but the MFA device becomes out of sync. This happens because time-based one-time passwords (TOTP) expire after a short period of time. If this happens, you can resync the device.

serial_number class-attribute instance-attribute
serial_number: str | None = ...

The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/-

user_name class-attribute instance-attribute
user_name: str | None = ...

The name of the IAM user for whom you want to enable the MFA device.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Output

EnableMFADeviceOutput dataclass

Bases: _SerdeShape

Dataclass for EnableMFADeviceOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.