Skip to content

How to create AWS S3 versioning buckets

Estimated time to read: 2 minutes

In this tutorial, you're going to learn how to setup S3 versioning in OpenStack with Fuga Cloud

Prerequisites:

  • Log in to the Dashboard
  • Dashboard -> Access -> Credentials
  • Open the tab: “EC2 / S3 Credentials”
  • Request new ones or use one you already have

How to install AWS CLI

Using pip3 to install AWS CLI

$ pip3 install awscli
Configure the AWS CLI

The next step is to create a profile that communicates with de S3 API. You can give the profile any name you like. In this example, 'Fuga' is used.

$ aws configure --profile=fuga

AWS Access Key ID     [None]: <access id>
AWS Secret Access     [None]: <secret>
Default region name   [None]: <press enter>
Default output format [None]: <press enter>

Create a bucket

With the following command you create a bucket:

$ aws --profile=fuga --endpoint=https://core.fuga.cloud:8080 s3api create-bucket --bucket versioned

List your buckets

To list all your buckets, just use:

$ aws --profile=fuga --endpoint=https://core.fuga.cloud:8080 s3api list-buckets
{
    "Buckets": [
        {
            "Name": "test",
            "CreationDate": "2021-10-20T12:34:37.650Z"
        },
        {
            "Name": "versioned",
            "CreationDate": "2021-11-30T09:15:20.298Z"
        }
    ],
    "Owner": {
        "DisplayName": "owner name",
        "ID": "owner ID."
    }
}
In the example shown above, you see the new bucket, you just created. There is another bucket, named test, that was already present.

Enable versioning for the S3 bucket:

$ aws --profile=fuga --endpoint=https://core.fuga.cloud:8080 s3api put-bucket-versioning --bucket versioned --versioning-configuration Status=Enabled
Check that versioning is enabled:
$ aws --profile=fuga --endpoint=https://core.fuga.cloud:8080 s3api get-bucket-versioning --bucket versioned
{
    "Status": "Enabled",
    "MFADelete": "Disabled"
}
In the example above, you see that versioning is enabled. It also shows that Multi-Factor Authentication (MFA) on deletion is disabled.

Conclusion

In this tutorial, you learned how to set up an AWS S3 bucket with versioning enabled. In the next tutorial, you're going to learn how to create an AWS S3 versioning object.