Skip to content

Instantly share code, notes, and snippets.

View fndiaz's full-sized avatar
:octocat:

Fernando fndiaz

:octocat:
  • São Paulo
View GitHub Profile
@jicowan
jicowan / enable-mfa-delete.py
Created July 14, 2017 05:26
enable mfa-delete on a bucket
import boto3
from botocore.exceptions import ClientError
s3_client = boto3.client('s3')
s3_bucket = boto3.resource('s3')
bucket_name = raw_input('Enter the name of the bucket that you want to enable MFA-delete on: ')
mfa_token = raw_input('Enter your MFA serial number and token code, e.g. <deviceSerialNumber> <tokenCode>: ')
try:
s3_bucket.meta.client.head_bucket(Bucket=bucket_name)