AWS Messaging Blog

Build a Secure One-Time Password Architecture with AWS

November 2026: This post was reviewed and updated for accuracy.

As cyberattacks grow more sophisticated, strong security measures to protect user accounts matter more than ever. One-time passwords (OTPs) have long been an important component of multi-factor authentication. They provide an additional layer of security to protect user accounts from unauthorized access.

OTP delivery is evolving rapidly. Although organizations increasingly favor more secure, phishing-resistant methods like passwordless solutions and hardware security keys, many still rely on SMS-based OTPs or require time to transition to newer technologies.

For organizations already using Okta as their identity provider, AWS offers guidance on implementing phone-based multi-factor authentication. The “AWS Guidance for Okta Phone-Based Multi-Factor Authentication on AWS” provides a detailed reference architecture and implementation steps for integrating Okta with AWS services to deliver OTPs by SMS or voice calls.

This post offers a comprehensive guide for implementing a reliable, multi-channel OTP solution using AWS services including Amazon DynamoDB, Amazon Simple Email Service (Amazon SES), and AWS End User Messaging.

By the end of this post, you’ll understand how to generate, store, and deliver OTPs by email, SMS, and voice. You’ll also learn best practices for secure OTP implementation. This solution serves organizations that need email OTPs, their own storage and lockout rules, or that must keep a custom SMS-based OTP flow.

Let’s explore how to build a secure, multi-channel OTP solution on AWS.

AWS End User Messaging is the new name for the SMS, MMS, push, WhatsApp, and text-to-voice messaging capabilities of Amazon Pinpoint. Support for Amazon Pinpoint ended on October 30, 2026.

If you only need OTPs by SMS, voice or WhatsApp, consider the managed option first. Since October 2026, AWS End User Messaging Notify can generate the code, deliver it, and verify the code the user enters, with the code length, validity period, and maximum attempts set in a notify code configuration (see Send a message). The architecture in this post is for cases the managed option does not cover, such as email OTPs sent with Amazon SES, or your own storage and lockout rules.

The authentication flow

Let’s imagine a hypothetical scenario where a bank customer wants to access their online account:

Alex, a customer of the XYZ financial institution, needed to access their online account. Alex initiated the login process and requested an OTP from the mobile or web application provided by the bank. Upon receiving the request, the bank’s server created a user-specific session to handle the OTP generation and verification. A unique one-time password was then generated and sent to Alex’s registered mobile number by SMS. Alex received the OTP on their phone and had three attempts to enter the correct code within a 10-minute timeframe. This security measure prevented unauthorized access to Alex’s account. If Alex couldn’t receive the SMS, they had another option. They could request the bank to send the same OTP to their registered email address, if they had one on file. If Alex entered the correct OTP, the login process would be successful, and they would be granted access to their online banking services. However, if they exceeded the three attempts in the 10-minute time limit, their ability to log in to the account would be temporarily suspended for security reasons and Alex would need to call the bank to lift the suspension or wait 2 hours to retry again. The bank implements this multi-factor authentication process with an alternative email-based OTP delivery. This approach safeguards Alex’s sensitive financial information and enhances the security of digital banking services. It also provides a backup option if the primary SMS channel is unavailable.

OTP authentication flow from the user’s login request through SMS or email delivery to verification

Figure 1: Authentication flow for the bank login scenario, from OTP request to verification

Prerequisites

To use the code examples provided in this blog post, you’ll need to have the following AWS resources and permissions in place:

  1. AWS account: Sign up for an AWS account at AWS website if you don’t have one.
  2. Verified email address in Amazon SES: Enable email delivery of OTPs by verifying an email address in Amazon SES service.
  3. AWS End User Messaging configuration: You’ll need to configure the necessary origination identity in the AWS End User Messaging service to deliver the OTPs by SMS or voice.
  4. Amazon DynamoDB table: A table named otp_main with the partition key user_id (String), with Time to Live (TTL) enabled on the ttl attribute.
  5. AWS Key Management Service (AWS KMS) key: A symmetric encryption key. Set its key ID or alias in the OTP_KMS_KEY_ID environment variable of the AWS Lambda functions.
  6. IAM permissions: The function that sends OTPs needs dynamodb:PutItem on the table, kms:Encrypt on the key, sms-voice:SendTextMessage (and sms-voice:SendVoiceMessage for voice) and ses:SendEmail. The function that verifies OTPs needs dynamodb:GetItem, dynamodb:UpdateItem and dynamodb:DeleteItem on the table and kms:Decrypt on the key.
  7. PyOTP: Package the pyotp library with the Lambda function that generates OTPs.

New accounts are in the Amazon SES sandbox and the AWS End User Messaging SMS sandbox. To test, verify the recipient email address and add the destination phone number as a verified destination number, or request production access for both.

With these prerequisites in place, you’ll be ready to use the code examples provided in the following sections to implement your secure OTP solution.

Architecture

Architecture of the OTP solution using API Gateway, AWS Lambda, AWS KMS, Amazon DynamoDB, AWS End User Messaging, and Amazon SES

Figure 2: Architecture of the multi-channel OTP solution on AWS

Flow explained

  1. The user initiates the process by requesting an OTP.
  2. The request is sent through Amazon API Gateway.
  3. AWS Lambda receives the request and processes it.
  4. AWS KMS is used to encrypt the OTP for secure storage.
  5. The encrypted OTP and related information are stored in Amazon DynamoDB.
  6. AWS End User Messaging sends the OTP to the user by SMS or voice, and Amazon SES sends it by email.
  7. When the user receives the OTP, they enter it in the portal for verification, and the code travels over HTTPS through the same flow (API Gateway to Lambda).
  8. The Lambda function decrypts the stored OTP with AWS KMS and compares it with the code the user entered.

Typical architecture for a secure one-time password (OTP) solution would involve the following components:

  1. Front-end application: The OTP functionality is typically exposed through a web or mobile application, which serves as the user-facing interface.
  2. API Gateway: The front-end application interacts with the OTP solution through an API Gateway. This gateway serves as the entry point, providing scalable and secure access to underlying services.
  3. AWS Lambda: The business logic for generating, storing, and verifying the OTPs is handled by one or more AWS Lambda functions. These serverless functions are responsible for the core OTP-related operations.
  4. AWS KMS: Encrypts the OTP before AWS Lambda stores it in Amazon DynamoDB, and decrypts it when Lambda verifies the code the user entered.
  5. Amazon DynamoDB: The generated OTP encrypted and associated metadata, such as creation timestamp and expiration, are securely stored in an Amazon DynamoDB table.
  6. AWS End User Messaging: Used to deliver the OTPs to the users through various communication channels, such as SMS, and voice.
  7. Amazon SES: Deliver the OTPs to the users by email.

In a production environment, it’s also important to consider the following security measures:

  • AWS WAF (Web Application Firewall): To protect the API Gateway from common web-based attacks, such as SQL injection and cross-site scripting (XSS).
  • Authentication and authorization services: Ensuring that the front-end application and users are properly authenticated and authorized before accessing the OTP-related functionality. Visit Control and manage access to REST APIs in API Gateway to view the available methods of managing access to Amazon API Gateway.
  • Destination lookup: The Lambda function reads the user’s phone number and email address from your user store by user_id. Do not accept a destination from the request, or anyone can have another user’s OTP sent to their own phone or address.

With this architecture, you can build a comprehensive and secure one-time password solution. It protects users’ sensitive information and offers a straightforward authentication experience.

Generating OTPs

To generate the OTPs, the server uses the PyOTP library in Python. Its random_base32() function creates the secret from a cryptographically secure random source, and the code is derived from that secret.

The server generates a 6-digit numeric OTP (000000 to 999999), which gives 1M possible values. Because that space is small, the solution relies on a short validity period, a limit on verification attempts and a limit on OTP requests. After generation, the server encrypts and stores the OTP and sends it to the user through the chosen delivery channel (SMS, email, or voice).

Sample Code:

import secrets
import pyotp

def generate_otp():
    """
    Generates a secure one-time password using the pyotp library.

    Returns:
        str: The generated one-time password.
    """
    # Generate a random base32 secret - https://pyauth.github.io/pyotp/
    totp = pyotp.TOTP(pyotp.random_base32())

    # Use the Time-based One-Time Password (TOTP) algorithm to generate a 6-digit OTP
    return totp.now()

The Lambda function encrypts each OTP with an AWS KMS key before storing it. The user receives the code in the message and sends it back over HTTPS, so the user never handles the encrypted value.

By encrypting the OTP values before storing them in the DynamoDB table, you can further enhance the security of the solution and protect against potential data breaches. With encrypted values, even if the database is compromised, the raw OTP values are not directly accessible.

The otp_code attribute holds the OTP encrypted by encrypt_otp(), which calls the AWS KMS Encrypt API with the user ID as the encryption context. Reading the table is not enough to recover an OTP because decryption needs permission to use the key and the matching user ID.

Securely storing OTPs

Once generated, the OTPs are stored in an Amazon DynamoDB table. DynamoDB, a fully managed NoSQL database service, provides reliable, high-performance data storage and retrieval, making it ideal for our secure OTP solution.

To store the OTPs, create a DynamoDB table with the user_id as the primary key. This approach allows for efficient retrieval of a user’s current OTP. When storing a new OTP for a user:

  1. If no existing entry is found for the user_id, a new item is created.
  2. If an entry already exists, it’s updated with the new OTP, effectively overwriting the old one, unless the user is locked out.

This method ensures that each user has only one active OTP at a time, while still allowing users to request new OTPs when needed (for example, if the previous one expired).

Depending on your use case, you can modify the primary key to be a random id or a concatenation of the user id and a random id for additional security.

In addition to the user_id and otp_code, we’ll also include the following attributes:

  • creation_timestamp: The Unix time in seconds when the OTP was generated. Verification compares it with the current time and rejects a code after 10 minutes.
    • ttl: The Unix time in seconds after which DynamoDB can delete the item. The sample sets it to 10 minutes after creation, or to the end of a lockout. Enable TTL on the table for this attribute. DynamoDB deletes expired items typically within a few days, so verification still checks creation_timestamp.
    • attempts: The number of remaining verification attempts for the OTP.
    • locked_until: The Unix time until which the user cannot verify a code or request a new one. It is set when no attempts remain.

Sample Code:

import base64
import os
import time
import boto3

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('otp_main')
kms = boto3.client('kms')

# Key ID, key ARN or alias of the KMS key that encrypts the OTPs
KMS_KEY_ID = os.environ['OTP_KMS_KEY_ID']
OTP_VALIDITY_SECONDS = 600  # 10 minutes
MAX_ATTEMPTS = 3

def encrypt_otp(otp_code, user_id):
    """
    Encrypts the OTP with AWS KMS. The user ID is the encryption context,
    so the ciphertext can only be decrypted for the same user.
    """
    response = kms.encrypt(
        KeyId=KMS_KEY_ID,
        Plaintext=otp_code.encode('utf-8'),
        EncryptionContext={'user_id': user_id}
    )
    return base64.b64encode(response['CiphertextBlob']).decode('ascii')

def store_otp(user_id, otp_code):
    """
    Encrypts the one-time password and stores it in the DynamoDB table with a
    creation timestamp, TTL and remaining attempts.

    Args:
        user_id (str): The unique identifier for the user.
        otp_code (str): The generated one-time password.

    Returns:
        dict: The response from the DynamoDB put_item operation.

    A ConditionalCheckFailedException error means the user is locked out.
    """
    now = int(time.time())
    return table.put_item(
        Item={
            'user_id': user_id,
            'otp_code': encrypt_otp(otp_code, user_id),
            'creation_timestamp': now,
            'ttl': now + OTP_VALIDITY_SECONDS,
            'attempts': MAX_ATTEMPTS,
            'locked_until': 0
        },
        # Do not replace the item while a lockout is in force
        ConditionExpression='attribute_not_exists(user_id) OR locked_until <= :now',
        ExpressionAttributeValues={':now': now}
    )

We use the user_id as the primary key and store creation timestamp, TTL, remaining attempts, and the time until which the user is locked out (locked_until). This approach ensures a secure and efficient OTP storage and retrieval process. This approach also allows for precise management of OTP expiration and account locking, as demonstrated in the Verifying OTPs section.

The encrypted OTP values are stored in the otp_code attribute. Encryption is performed on the client-side using a secure key management solution, like the AWS KMS client-side library. This ensures that the raw OTP values are never transmitted or stored in plain text, further enhancing the security of the solution.

Note: As an optional enhancement, you can delete the item when the OTP expires instead of waiting for DynamoDB TTL. Send an Amazon Simple Queue Service (Amazon SQS) message containing the user_id and creation_timestamp with DelaySeconds set to the OTP validity period (up to 900 seconds). When the delay ends, a Lambda function receives the message and deletes the item only if creation_timestamp still matches and no lockout is in force, so a newer OTP or a lockout is not deleted. This adds complexity, and the verification step already rejects expired codes by comparing the creation timestamp with the current time.

Delivering OTPs across multiple channels

Now that we have a secure way to generate and store the OTPs, it’s time to focus on delivering them to your users. Our solution uses the AWS End User Messaging capabilities to provide a redundant OTP delivery experience across multiple communication channels.

Sending OTPs by SMS and voice

AWS End User Messaging SMS delivers OTPs by SMS and voice, and also supports MMS and RCS. AWS End User Messaging also offers push notifications (AWS End User Messaging Push) and WhatsApp (AWS End User Messaging Social), which use separate APIs. A WhatsApp OTP needs an approved authentication template. Email OTPs are sent with Amazon SES. The following sample sends the OTP by SMS. This provides a redundant and convenient authentication experience for your users, so they can receive their one-time passwords through their preferred method.

Sample Code:

import boto3
from botocore.exceptions import ClientError

def send_otp_sms(mobile_number, otp_code, user_id, region_name):
    """
    Sends an OTP code to the user's mobile number using AWS End User Messaging SMS.

    Args:
        mobile_number (str): The destination phone number in E.164 format, for example +14255550168.
        otp_code (str): The one-time password to be sent.
        user_id (str): The unique identifier for the user.
        region_name (str): The AWS Region of your origination identity.

    Returns:
        dict: The status code and the message ID, or the error message.
    """
    # Construct the SMS message with the OTP code
    message = f"Your Example Corp one-time password is {otp_code}. It expires in 10 minutes. Do not share this code with anyone."

    try:
        # Create an AWS End User Messaging SMS client (SMS and Voice v2 API)
        aws_sms = boto3.client('pinpoint-sms-voice-v2', region_name=region_name)
        response = aws_sms.send_text_message(
            DestinationPhoneNumber=mobile_number,
            OriginationIdentity='+12065550100',  # replace with your phone number, sender ID or pool ID
            MessageBody=message,
            MessageType='TRANSACTIONAL'
        )
        return {'StatusCode': 200, 'Response': response['MessageId']}
    except ClientError as e:
        error_message = e.response['Error']['Message']
        return {'StatusCode': 500, 'Response': error_message}

To deliver the OTP by voice, call send_voice_message on a pinpoint-sms-voice-v2 client. Its OriginationIdentity parameter is required and must be a voice-capable phone number or a pool that contains one. Set MessageBodyTextType='SSML' and wrap the code in say-as inside a speak element, for example <speak>Your code is <say-as interpret-as="digits">123456</say-as>.</speak>, so that it is read digit by digit.

Sending OTPs by email

To deliver OTPs by email, we’ll use the Amazon SES (Simple Email Service) SendEmail API. SES is a highly scalable and cost-effective email service. It can send notifications, alerts, and in our case, one-time passwords to users.

Sample Code:

import boto3
from botocore.exceptions import ClientError

def send_otp_email(user_id, email_address, otp_code, region_name):
    """
    Sends an OTP code to the user's email address using Amazon SESv2.

    Args:
        user_id (str): The unique identifier for the user.
        email_address (str): The email address to send the OTP to.
        otp_code (str): The one-time password to be sent.
        region_name (str): The AWS region to use for the SESv2 client.

    Returns:
        dict: The response from the SESv2 send_email operation.
    """
    try:
        # Create a new SESv2 client
        ses = boto3.client('sesv2', region_name=region_name)

        # Construct the email message with the OTP code
        message = "<p>Your one-time password is: </p> {otp_code}"
        html_body = message.format(otp_code=otp_code)

        # Use the SESv2 client to send the email
        response = ses.send_email(
            FromEmailAddress='otp@example.com',  # an address on your verified SES identity
            Destination={
                'ToAddresses': [
                    email_address,
                ]
            },
            Content={
                'Simple': {
                    'Subject': {
                        'Charset': 'UTF-8',
                        'Data': 'Your AWS OTP code'
                    },
                    'Body': {
                        'Html': {
                            'Charset': 'UTF-8',
                            'Data': html_body
                        }
                    }
                }
            }
        )
        return {'StatusCode': 200, 'Response': response['MessageId']}
    except ClientError as e:
        error_message = e.response['Error']['Message']
        return {'StatusCode': 500, 'Response': error_message}

Verifying OTPs

The final piece of our secure OTP solution is the process of verifying the one-time passwords entered by your users. This is an important step in the authentication flow, because it confirms that only legitimate users are granted access to your applications or services.

The OTP verification logic is handled by a Lambda function that interacts directly with the DynamoDB table where the OTPs are stored. This Lambda function performs the following steps:

  1. Read the user’s item from the DynamoDB table with a strongly consistent read. Reject the request if the user is locked out or has no attempts left.
  2. Decrypt the stored OTP with the AWS KMS Decrypt API.
  3. Compare the decrypted OTP with the one the user entered, using a constant-time comparison.
  4. Check that the OTP has not expired by comparing the creation timestamp with the current time.
  5. If the OTP matches and has not expired, delete the item so that the code cannot be used again.
  6. If the OTP is wrong or expired, deduct one attempt from the remaining attempts count.
  7. If no attempts remain, lock the user out for 2 hours.

Sample Code:

import base64
import hmac
import time
import boto3
from botocore.exceptions import ClientError

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('otp_main')
kms = boto3.client('kms')

OTP_VALIDITY_SECONDS = 600  # 10 minutes
LOCKOUT_SECONDS = 7200      # 2 hours

def decrypt_otp(encrypted_otp, user_id):
    """
    Decrypts the stored OTP with AWS KMS. The encryption context must match
    the one used by encrypt_otp().
    """
    response = kms.decrypt(
        CiphertextBlob=base64.b64decode(encrypted_otp),
        EncryptionContext={'user_id': user_id}
    )
    return response['Plaintext'].decode('utf-8')

def verify_otp(otp_entered, user_id):
    """
    Verifies the one-time password entered by the user. Every wrong or expired
    code uses up an attempt, and the user is locked out for LOCKOUT_SECONDS
    when no attempts remain.

    Args:
        otp_entered (str): The one-time password entered by the user.
        user_id (str): The unique identifier for the user.

    Returns:
        dict: {'result': True} if the code is valid, otherwise {'result': False}.
    """
    now = int(time.time())
    item = table.get_item(Key={'user_id': user_id}, ConsistentRead=True).get('Item')
    if not item or item['locked_until'] > now or item['attempts'] <= 0:
        return {'result': False}

    expired = now - item['creation_timestamp'] >= OTP_VALIDITY_SECONDS
    matches = hmac.compare_digest(
        str(otp_entered).encode('utf-8'),
        decrypt_otp(item['otp_code'], user_id).encode('utf-8')
    )

    try:
        if matches and not expired:
            # Delete the item that was read, so the same code cannot be used twice
            table.delete_item(
                Key={'user_id': user_id},
                ConditionExpression='creation_timestamp = :created AND attempts > :zero',
                ExpressionAttributeValues={':created': item['creation_timestamp'], ':zero': 0}
            )
            return {'result': True}

        # Wrong or expired code: use up one attempt
        updated = table.update_item(
            Key={'user_id': user_id},
            UpdateExpression='SET attempts = attempts - :one',
            ConditionExpression='attempts > :zero',
            ExpressionAttributeValues={':one': 1, ':zero': 0},
            ReturnValues='UPDATED_NEW'
        )
        if updated['Attributes']['attempts'] <= 0:
            lock_until = now + LOCKOUT_SECONDS
            # Move the TTL to the end of the lockout, so DynamoDB does not delete the lock early
            table.update_item(
                Key={'user_id': user_id},
                UpdateExpression='SET locked_until = :lock, #ttl = :lock',
                ConditionExpression='attribute_exists(user_id)',
                ExpressionAttributeNames={'#ttl': 'ttl'},
                ExpressionAttributeValues={':lock': lock_until}
            )
    except ClientError as e:
        # Another request changed the item first; treat this one as failed
        if e.response['Error']['Code'] != 'ConditionalCheckFailedException':
            raise
    return {'result': False}

In this implementation, a Lambda function handles the OTP verification logic. This ensures sensitive operations like OTP decryption and managing expiration and attempt counts occur in a secure, serverless environment. To lift a lockout early, for example after the customer calls your support team, delete the user’s item from the table.

Best practices

As you implement a secure one-time password solution, it’s important to consider the following best practices:

OTP message best practices

When delivering OTPs by email, SMS, or voice, clearly specify the sender and the content of the message. For example, the email subject and body, as well as the SMS or voice message, should include information like:

“This is a one-time password from [Company Name] for payment confirmation of your flight ABC123.”

Security reminder in OTP messages

Include a security reminder in the OTP message to encourage users to report any unauthorized access attempts. For example:

“If you did not request this OTP, please call [phone number] to report it.”

This helps raise user awareness and provides a clear course of action if they suspect their account has been compromised.

Configuration set / originating identity

Include a configuration set, and Context or EmailTags, when you send OTPs, so that you can record delivery events and trace them to a user. AWS End User Messaging SMS and Amazon SES each need their own configuration set, and each set records events only after you add an event destination to it. The example uses otp-config-set for both. Create it in each service first. Read more about Amazon SES configuration sets and AWS End User Messaging configuration sets. Use an opaque ID such as a UUID as user_id: SES tag values can contain only letters, numbers, underscores and dashes. For example, in the send_otp_sms() and send_otp_email() functions, you should include the following parameters:

response = aws_sms.send_text_message(
    DestinationPhoneNumber=mobile_number,
    MessageBody=message,
    MessageType='TRANSACTIONAL',
    ConfigurationSetName='otp-config-set',
    OriginationIdentity='+12345678901', # the same origination identity as in send_otp_sms()
    Context={
        'user_id': user_id
    }
)
response = ses.send_email(
    FromEmailAddress='otp@example.com',
    Destination={'ToAddresses': [email_address]},
    Content={
        # ...
    },
    ConfigurationSetName='otp-config-set',
    EmailTags=[
        {
            'Name': 'user_id',
            'Value': user_id
        }
    ]
)

Limit SMS pumping and OTP requests

An endpoint that sends an SMS before the user has signed in is a target for SMS pumping (artificially inflated traffic), which raises your messaging costs. Create an AWS End User Messaging SMS protect configuration and block the countries you do not send to. Limit how often an OTP can be requested for one user and from one source, for example with an AWS WAF rate-based rule and API Gateway throttling. Each new OTP starts with three attempts, so without a request limit an attacker can keep requesting codes and guessing.

Deleting OTPs after verification

After a successful OTP verification, it’s recommended to delete the corresponding DynamoDB item. This helps maintain a clean and up-to-date database, reducing the risk of unauthorized access or potential data breaches.

Tracking verification attempts

Consider adding a column in the DynamoDB table to track the number of verification attempts for each OTP. This can help you implement rate-limiting and other security measures to prevent brute-force attacks.

Limiting who can decrypt OTPs

Encrypt the OTP with AWS KMS in the Lambda function before you store it, and give only the function that verifies OTPs permission to decrypt. To encrypt and sign many attributes of DynamoDB items, consider the AWS Database Encryption SDK.

Following these best practices ensures your one-time password solution is secure and user-friendly. It also maintains necessary controls and traceability for production use cases.

Conclusion

In this guide, we’ve demonstrated a secure, multi-channel one-time password (OTP) solution using AWS services. You can now generate, store, and deliver OTPs by email, SMS, and voice channels using Amazon DynamoDB, Amazon SES, and AWS End User Messaging.

We’ve covered several important points throughout this process. We discussed using a secure random number generator and encrypting algorithms to generate and store OTPs. This ensures strong protection for your users’ sensitive information. By integrating with Amazon SES and AWS End User Messaging, you provide users with a convenient, redundant authentication experience through multiple channels.

This guide equips you with tools to build a custom OTP flow when the managed options do not fit. However, it’s important to note the industry’s shift towards more secure, phishing-resistant authentication methods. These include passwordless solutions and hardware security keys. We encourage you to explore and implement these newer technologies as you develop your OTP solution.

If you use Amazon Cognito user pools, passwordless sign-in with one-time passwords from email or SMS and with WebAuthn passkeys is available on the Essentials and Plus feature plans. Cognito then generates, sends and checks the code. Cognito OTP sign-in is not compatible with required multi-factor authentication in the user pool. See Passwordless sign-in with one-time passwords. Also, consider incorporating a mechanism to escalate users to live support for authentication issues.

Implement the secure OTP solution outlined in this guide and continuously update your authentication strategies. This approach ensures your organization remains equipped to protect users and assets from evolving digital threats.


About the authors

Guy Bachar

Guy Bachar

Guy is a Senior Solutions Architect at AWS. He specializes in assisting Capital Markets and FinTech users with their cloud transformation journeys. His expertise encompasses Identity management, security, and unified communication

Bruno Giorgini

Bruno Giorgini

Bruno is a Sr Solutions Architect specialized in AWS Communication Developer Services. When he is not crafting innovative solutions for clients, Bruno enjoys spending quality time with his family, exploring the scenic hiking trails. His passion for technology and its potential to drive business transformation keeps him motivated to deliver impactful solutions for organizations around the world.

Pavlos Ioannou Katidis

Pavlos Ioannou Katidis

Pavlos Ioannou Katidis is a Senior Specialist Solutions Architect at AWS, specializing in Amazon Simple Email Service (SES) and AWS End User Messaging. With deep expertise in designing scalable and resilient solutions, Pavlos focuses on designing and building mass communication systems and omnichannel frameworks. He has authored widely adopted AWS workshops, blogs, and technical solutions, and developed internal tools leveraging Generative AI to streamline processes and boost productivity. Pavlos has represented AWS at re:Invent, speaking on topics such as resilient notification systems, one-time password setups, and high-volume messaging best practices. In his spare time, he enjoys playing tennis, walking, and working on personal coding projects.

Prashubh Kapoor

Prashubh Kapoor

Prashubh is a Senior Applied AI Solutions Architect specialized in AWS Communication Developer Services. With a background in software engineering he helps customers design scalable messaging and email solutions with Amazon SES and AWS End User Messaging. Outside of work, he enjoys cooking, brewing specialty coffee, and he is currently learning Luxembourgish.