LogoLogo
cegedim.cloudITCareAPIPrivacy
English
English
  • Documentation
  • ITCare
    • What is ITCare ?
      • Get started with ITCare
      • Demos
    • Enercare
      • Carbon footprint
    • Release notes
  • ITCare API
    • Overview
    • Authentication
    • Errors
    • Pagination
    • API Reference
      • Quick start
      • Analytics
        • Matomo
      • Changes
        • Changes
      • Compute
        • Application Servers
        • Backup Policies
        • Containers
        • Environments
        • Instances
        • Platform
        • Resource Filters
        • Resource Types
        • Resources
        • Services
        • Statuses
        • Tag Keys
        • Tag Values
        • Types
      • Databases
        • Databases
        • MariaDB
        • OpenSearch
        • PostgreSQL
        • Redis
        • SQL Server
      • Hardwares
        • Hardwares
      • Messaging
        • Apache Kafka
        • Message Brokers
        • RabbitMQ
      • Networking
        • Domains
        • Load Balancers
        • Network Clusters
        • Networks
      • Operations
        • Actions
        • Operations
      • Storage
        • Glusterfs
        • Overdrive
      • Topology
        • Topology
  • Services
    • Products
    • Support policy
    • Patch policy
    • RACI
  • Analytics
    • Matomo
      • Matomo - Features
      • Matomo - Get started
  • Compute
    • Virtual instances
      • Virtual instances - Features
        • Linux - Hardening
      • Virtual instances - Get started
    • Containers (K8s)
      • K8s - Features
        • Hardening
        • Persistent Storage
      • K8s - Get started
        • High Availability
  • Databases
    • MariaDB
      • MariaDB - Features
      • MariaDB - Get started
    • OpenSearch
      • OpenSearch - Features
        • v2 - Breaking changes
      • OpenSearch - Get started
    • PostgreSQL
      • PostgreSQL - Features
      • PostgreSQL - Get started
      • PostgreSQL - Upgrade
    • Redis
      • Redis - Features
      • Redis - Get started
      • Redis - Upgrade
    • SQL Server
      • SQL Server - Features
      • SQL Server - Get started
  • Messaging
    • Apache Kafka
      • Apache Kafka - Features
      • Apache Kafka - Get started
      • Apache Kafka - Upgrade
    • RabbitMQ
      • RabbitMQ - Features
      • RabbitMQ - Get started
    • SMS
      • SMS - Get started
  • Monitoring
    • ExtraHop
  • Security
    • Advanced Vulnerability Assessment
    • Bot Defense
      • Bot Defense - Features
    • Data Masking
      • Data Masking - Get started
    • Phishing Campaign
  • Storage
    • GlusterFS
      • GlusterFS - Features
      • GlusterFS - Get started
    • Object Storage
      • Object Storage - Features
        • S3 API compatibility
        • Limitation and Best Practices
        • Presigned URL
        • Bucket Policies
        • Bucket Lifecycle
        • Object Lock
      • Object Storage - Get started
        • Manage Object Users
        • Manage versioning in Bucket
        • Manage Bucket access
    • OverDrive
      • OverDrive - Features
      • OverDrive - Get started
Powered by GitBook
On this page
  • Billing
  • Limitation
  • Get current versioning state of a bucket
  • Enable versioning on buckets
  • Suspend versioning on buckets
  • Manage Objects versions
  • List Objects versions
  • Delete an Object in a versioning Bucket
  • Restore Objects
  • Delete a specific version of an Object
Export as PDF
  1. Storage
  2. Object Storage
  3. Object Storage - Get started

Manage versioning in Bucket

By default, Object Storage Service does not provide backup capabilities. That means that if you delete an object incidentally, it is not possible to restore it.

Versioning means of keeping multiple variants of an object in the same Bucket. You can use the S3 Versioning feature to preserve, retrieve, and restore every version of every object stored in your Bucket.

With versioning you can recover more easily from both unintended user actions and application failures.

Versioning-enabled Buckets can help you recover objects from accidental deletion or overwrite. For example, if you delete an object, a delete marker is created instead of removing the object permanently.

The delete marker becomes the current object version. If you overwrite an object, it results in a new object version in the Bucket.

By default, S3 Versioning is disabled on buckets, and you must explicitly enable it. To manage Bucket and Object versioning, you can you can use the AWS CLI or any compatible tools or SDK.

Billing

You will be charged of space being used by older versions of your objects.

Limitation

We suggest keep the object version less than 50k. You can use a lifecycle configuration to delete versions of your objects.

Get current versioning state of a bucket

We use aws s3 and aws s3api command line tools from AWSCLIv2 on Linux.

${S3_ENDPOINT} and ${S3_PROFILE} are environment variables

If the versioning state has never been set on a Bucket, it has no versioning state. Using aws s3api AWS CLI, get-bucket-versioning, will return nothing:

aws s3api --endpoint-url=${S3_ENDPOINT} get-bucket-versioning --bucket my-bucket --profile ${S3_PROFILE}

For a Bucket with versioning enabled:

aws s3api --endpoint-url=${S3_ENDPOINT} get-bucket-versioning --bucket my-bucket --profile ${S3_PROFILE}
Output
{
    "Status": "Enabled"
}

For a Bucket with versioning suspended:

aws s3api --endpoint-url=${S3_ENDPOINT} get-bucket-versioning --bucket my-bucket --profile ${S3_PROFILE}
Output
{
    "Status": "Suspended"
}

Enable versioning on buckets

aws s3api --endpoint-url=${S3_ENDPOINT} put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled --profile ${S3_PROFILE}

Suspend versioning on buckets

Once versioning enable on a bucket it can't be remove. But you have the possibility to suspend it.

aws s3api --endpoint-url=${S3_ENDPOINT} put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Suspended --profile ${S3_PROFILE}

Manage Objects versions

List Objects versions

You can use the list-object-versions from s3 api from AWSCLI:

aws --profile=${PROFILE} --endpoint ${S3_ENDPOINT} s3api list-object-versions --bucket my-bucket --prefix feather.ttf
Output
{
    "Versions": [
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427517621",
            "IsLatest": true,
            "LastModified": "2022-10-22T08:31:57.621Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        },
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427487088",
            "IsLatest": false,
            "LastModified": "2022-10-22T08:31:27.088Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        }
    ]
}

To get a specific version of an object using get-object and --version-id <Version ID>

aws --profile=${PROFILE} --endpoint ${S3_ENDPOINT} s3api get-object --bucket my-bucket --key feather.ttf --version-id 1666427487088 feather_1666427487088.ttf
Output
{
    "LastModified": "Sat, 22 Oct 2022 08:31:27 GMT",
    "ContentLength": 81512,
    "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
    "VersionId": "1666427487088",
    "ContentType": "font/ttf",
    "Metadata": {}
}

Delete an Object in a versioning Bucket

When you delete an object in a versioning Bucket, a delete marker is created and become the current version of the object:

aws --profile=${S3_PROFILE} --endpoint ${S3_ENDPOINT} s3api delete-object --bucket my-bucket --key feather.ttf
Output
{
    "DeleteMarker": true,
    "VersionId": "1666428023859"
}
aws --profile=${PROFILE} --endpoint ${S3_ENDPOINT} s3api list-object-versions --bucket my-bucket --prefix feather.ttf
Output
{
    "Versions": [
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427517621",
            "IsLatest": false,
            "LastModified": "2022-10-22T08:31:57.621Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        },
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427487088",
            "IsLatest": false,
            "LastModified": "2022-10-22T08:31:27.088Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        }
    ],
    "DeleteMarkers": [
        {
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            },
            "Key": "feather.ttf",
            "VersionId": "1666428023859",
            "IsLatest": true,
            "LastModified": "2022-10-22T08:40:23.859Z"
        }
    ]
}

Restore Objects

The delete marker has a version id too, you can delete it using its version ID in order to restore your object.

aws --profile=${S3_PROFILE} --endpoint ${S3_ENDPOINT} s3api delete-object --bucket my-bucket --key feather.ttf --version-id 1666428023859
Output
{
    "DeleteMarker": true,
    "VersionId": "1666428023859"
}
aws --profile=${PROFILE} --endpoint ${S3_ENDPOINT} s3api list-object-versions --bucket my-bucket --prefix feather.ttf
Output
{
    "Versions": [
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427517621",
            "IsLatest": true,
            "LastModified": "2022-10-22T08:31:57.621Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        },
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427487088",
            "IsLatest": false,
            "LastModified": "2022-10-22T08:31:27.088Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        }
    ]
}

Delete a specific version of an Object

You can delete a specific version on an object. If the specified version is not the current version, the object version is deleted and no delete marker is created.

aws --profile=${S3_PROFILE} --endpoint ${S3_ENDPOINT} s3api delete-object --bucket my-bucket --key feather.ttf --version-id 1666427487088
Output
{
    "VersionId": "1666427487088"
}
aws --profile=${PROFILE} --endpoint ${S3_ENDPOINT} s3api list-object-versions --bucket my-bucket --prefix feather.ttf
Output
{
    "Versions": [
        {
            "ETag": "\"2232dadea2f05fa28e3f08b5b3346df9\"",
            "Size": 81512,
            "StorageClass": "STANDARD",
            "Key": "feather.ttf",
            "VersionId": "1666427517621",
            "IsLatest": true,
            "LastModified": "2022-10-22T08:31:57.621Z",
            "Owner": {
                "DisplayName": "fwd37xbv8237hyhx2wkm",
                "ID": "fwd37xbv8237hyhx2wkm"
            }
        }
    ]
}
PreviousManage Object UsersNextManage Bucket access

Last updated 1 year ago