Skip to content

How to create versioning buckets

Estimated time to read: 2 minutes

In this tutorial, you're going to learn how to set up versioning in OpenStack with Cyso 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 the API. You can give the profile any name you like. In this example, 'cyso-cloud' is used.

$ aws configure --profile=cyso-cloud

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=cyso-cloud --endpoint=https://core.fuga.cloud:8080 s3api create-bucket --bucket versioned

List your buckets

To list all your buckets, just use:

$ aws --profile=cyso-cloud --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 bucket:

$ aws --profile=cyso-cloud --endpoint=https://core.fuga.cloud:8080 s3api put-bucket-versioning --bucket versioned --versioning-configuration Status=Enabled
Check that versioning is enabled:
$ aws --profile=cyso-cloud --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 a bucket with versioning enabled. In the next tutorial, you're going to learn how to create a versioning object.