Skip to content
Snippets Groups Projects
Commit c70ca73d authored by Milan's avatar Milan
Browse files

s3 versioning fix code

parent 8483e15c
No related branches found
No related tags found
No related merge requests found
......@@ -68,14 +68,21 @@ For non versioned bucket, if an object with the same key is uploaded it overwrit
???+ note "Bucket name restrictions"
The bucket name must be unique within tenant and should contain only uppercase and lowercase letters, numbers, and dashes and periods. The bucket name must only start with a letter or number and must not contain periods next to dashes or multiple periods. We also recommend **NOT using** `/` and `_` in the name, as this would make it impossible to use it via the API.
aws s3api create-bucket --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
aws s3api get-bucket-versioning --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
aws s3api put-bucket-versioning --bucket "bucket name" --versioning-configuration Status=Enabled --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
aws s3api get-bucket-versioning --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"Status": "Enabled",
"MFADelete": "Disabled"
......@@ -90,6 +97,7 @@ For non versioned bucket, if an object with the same key is uploaded it overwrit
"VersionId": "KdS5Yl0d06bBSYriIddtVb0h5gofiNX"
}
aws s3api put-object --key "file name" --body "file path 2" --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
......@@ -98,6 +106,7 @@ For non versioned bucket, if an object with the same key is uploaded it overwrit
"VersionId": "xNQC4pIgMYx59digj5.gk15WC4efOOa"
}
aws s3api list-object-versions --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
......@@ -136,6 +145,7 @@ For non versioned bucket, if an object with the same key is uploaded it overwrit
For a versionless bucket with object lookup, it always returns a single available object. For a bucket with versioning, the search returns the current object:
aws s3api list-object-versions --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"Versions": [
{
......@@ -167,7 +177,10 @@ For a versionless bucket with object lookup, it always returns a single availabl
]
}
aws s3api get-object --key "file name" "file name.out" --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"AcceptRanges": "bytes",
"LastModified": "Mon, 18 May 2020 10:34:05 GMT",
......@@ -212,7 +225,10 @@ For a versioned bucket, inactive objects can be retrieved by specifying the Vers
]
}
aws s3api list-object-versions --bucket "bucket name" --version-id KdS5Yl0d06bBSYriIddtVb0h5gofiNX --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"AcceptRanges": "bytes",
"LastModified": "Mon, 18 May 2020 10:33:53 GMT",
......@@ -243,7 +259,10 @@ For a versionless bucket, the object is permanently deleted and cannot be recove
}
},
aws s3api list-object-versions --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"Versions": [
{
......@@ -277,6 +296,7 @@ For a versionless bucket, the object is permanently deleted and cannot be recove
In the case of a versioned bucket, if an object with a specific VersionID is deleted, it is permanently deleted:
aws s3api delete-object --key "file name" --version-id KdS5Yl0d06bBSYriIddtVb0h5gofiNX --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"VersionId": "KdS5Yl0d06bBSYriIddtVb0h5gofiNX"
}
......@@ -301,6 +321,7 @@ In the case of a versioned bucket, if an object with a specific VersionID is del
To restore an object, the recommended approach is to copy the previous version of the object to the same bucket. The copied object becomes the current version of the object and all versions of the object are preserved:
aws s3api list-object-versions --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"Versions": [
{
......@@ -331,6 +352,8 @@ To restore an object, the recommended approach is to copy the previous version o
]
}
aws s3api copy-object --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz --copy-source "bucket name"/"file name"?versionId=xNQC4pIgMYx59digj5.gk15WC4efOOa --key "file name"
{
......@@ -340,6 +363,8 @@ To restore an object, the recommended approach is to copy the previous version o
}
}
aws s3api list-object-versions --bucket "bucket name" --profile "profil name" --endpoint-url=https://s3.cl2.du.cesnet.cz
{
"Versions": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment