Skip to content

Instantly share code, notes, and snippets.

Last active Jul 15, 2020
What would you like to do?
Enable MFA for s3 bucket
aws s3api put-bucket-versioning \
	--bucket bucket \
	--versioning-configuration '{"MFADelete":"Enabled","Status":"Enabled"}' \
	--mfa 'arn:aws:iam::aws_account_id:mfa/root-account-mfa-device passcode'
aws s3api get-bucket-versioning --bucket bucket
aws s3api list-object-versions \
	--bucket bucket \
	--key file.pdf
aws s3api delete-object \
	--bucket bucket
	--version-id 'ubErddyQBw1v7y68Z42UBSEWZodwGQLD'
	--key file.pdf
aws aws s3api delete-object \
	--bucket bucket \
	--mfa 'arn:aws:iam::aws_account_id:mfa/root-account-mfa-device passcode' \
	--version-id 'ubErddyQBw1v7y68Z42UBSEWZodwGQLD' \
	--key file.pdf
aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code code-from-token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment