Use PutBucketVersioning
with an AWS SDK or CLI
The following code examples show how to use PutBucketVersioning
.
- AWS CLI
-
The following command enables versioning on a bucket named
amzn-s3-demo-bucket
:aws s3api put-bucket-versioning --bucket
amzn-s3-demo-bucket
--versioning-configurationStatus=Enabled
The following command enables versioning, and uses an mfa code
aws s3api put-bucket-versioning --bucket
amzn-s3-demo-bucket
--versioning-configurationStatus=Enabled
--mfa"SERIAL 123456"
-
For API details, see PutBucketVersioning
in AWS CLI Command Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Developing with Amazon S3 using the AWS SDKs. This topic also includes information about getting started and details about previous SDK versions.