Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@res0nat0r
Last active July 15, 2020 01:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save res0nat0r/76d4b5434ba225a6916ac65fcf39bc8d to your computer and use it in GitHub Desktop.
Save res0nat0r/76d4b5434ba225a6916ac65fcf39bc8d to your computer and use it in GitHub Desktop.
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