Skip to content

IAM  >  Operations  >  create_virtual_mfa_device

create_virtual_mfa_device

Operation

create_virtual_mfa_device async

create_virtual_mfa_device(input: CreateVirtualMFADeviceInput, plugins: list[Plugin] | None = None) -> CreateVirtualMFADeviceOutput

Creates a new virtual MFA device for the Amazon Web Services account. After creating the virtual MFA, use EnableMFADevice to attach the MFA device to an IAM user. For more information about creating and working with virtual MFA devices, see Using a virtual MFA device in the IAM User Guide.

For information about the maximum number of MFA devices you can create, see IAM and STS quotas in the IAM User Guide.

Warning

The seed information contained in the QR code and the Base32 string should be treated like any other secret access information. In other words, protect the seed information as you would your Amazon Web Services access keys or your passwords. After you provision your virtual device, you should ensure that the information is destroyed following secure procedures.

Parameters:

Name Type Description Default
input CreateVirtualMFADeviceInput

An instance of CreateVirtualMFADeviceInput.

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
CreateVirtualMFADeviceOutput

An instance of CreateVirtualMFADeviceOutput.

Input

CreateVirtualMFADeviceInput dataclass

Bases: _SerdeShape

Dataclass for CreateVirtualMFADeviceInput structure.

Attributes

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

The path for the virtual MFA device. For more information about paths, see IAM identifiers in the IAM User Guide.

This parameter is optional. If it is not included, it defaults to a slash (/).

This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (!) through the DEL character (), including most punctuation characters, digits, and upper and lowercased letters.

tags class-attribute instance-attribute
tags: list[Tag] | None = ...

A list of tags that you want to attach to the new IAM virtual MFA device. Each tag consists of a key name and an associated value. For more information about tagging, see Tagging IAM resources in the IAM User Guide.

Note

If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.

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

The name of the virtual MFA device, which must be unique. Use with path to uniquely identify a virtual 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

CreateVirtualMFADeviceOutput dataclass

Bases: _SerdeShape

Contains the response to a successful CreateVirtualMFADevice request.

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.

virtual_mfa_device instance-attribute
virtual_mfa_device: VirtualMFADevice

A structure containing details about the new virtual MFA device.