Open In App

Configuring MFA Delete On S3 Buckets

The AWS Simple Storage Service (S3) is a cloud service provided by Amazon Web Services (AWS) to store your data securely. You can access this service through your IAM role or root user account. In this article, we’ll see how to secure your S3 data in addition to the IAM policies through the MFA assignment. Furthermore, we’ll cover how to set up MFA Delete for your AWS S3 bucket and its usage while deleting an object from the S3.

What is MFA?

Multi-factor Authentication (MFA) is an extra layer of protection on top of your username and password. MFA in AWS (Amazon Web Services) is an IAM best practice that helps you to secure services that require a second authentication in addition to the username and password credentials.



When will be MFA Delete required on the AWS S3?

When do we not require an MFA Delete on the AWS S3?

Prerequisites

  1. Create and set up an AWS Account.
  2. Versioning must be enabled on the S3 bucket.
  3. Only the bucket owner (root owner) can enable/disable MFA Delete.

Step-by-Step Guide to Register MFA Delete on AWS S3

Step 1: Create S3 Bucket



Step 2: Set up MFA on the root account

Step 3: Check MFA Delete Configuration

Step 4: Configure AWS CLI for the root user

aws configure --profile <any_profile_name>

aws s3 ls

Step 5: Enable MFA Delete using AWS CLI

aws s3api put-bucket-versioning --bucket <bucket_name> --versioning-configuration Status=Enabled,MFADelete=Enabled
--mfa <arn-of-mfa-device mfa-code> --profile <profile_name>


Step 6: Verify if MFA Delete is enabled

Step 7: Try deleting a file from the S3 bucket

Step 8: Disable MFA Delete using AWS CLI

aws s3api put-bucket-versioning --bucket <bucket_name> --versioning-configuration Status=Enabled,MFADelete=Disabled
--mfa <arn-of-mfa-device mfa-code> --profile <profile_name>


Step 9: Verify if MFA Delete is enabled

Step 10: Delete the Root User’s Access Key

In this way you can add an additional layer of security on top of your password to restrict unauthorised member to delete objects from your AWS S3 Bucket.

Benefits of enabling MFA on the AWS

Configuring MFA Delete on S3 Buckets – FAQ’s

What if an MFA device is lost or has stopped working?

  1. Select any other MFA device while signing the account.
  2. In case there was only one MFA device available, verify your account through email and phone number.
  3. Select the Troubleshoot MFA option when asked to enter the verification code.
  4. Verify your identity through email verification and then verify your phone number.
  5. Once you’ve signed in successfully, delete the lost MFA device from your MFA settings.

What devices can be set up as an MFA device?

  1. Virtual MFA Device: Using a mobile device as we saw in the above guide.
  2. FIDO security key: Hardware security keys are provided by Third Parties. Read more about FIDO in this article.
  3. Hardware TOTP token: A physical device which generates a six-digit numeric code based upon a time-based one-time password (TOTP) algorithm.

How many MFA devices can be set up at a time?

You can register up to 8 devices from the combination supported by AWS.


Article Tags :