start cluster:
MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d
start HTTP endpoint:
wget https://gist.githubusercontent.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7/raw/a6a1d090ac8549dac8f2bd607bd64925de997d40/server.py
python server.py 10900
configure the RGW:
aws --endpoint-url http://localhost:8000 sns create-topic --name=fishtopic \
--attributes='{"push-endpoint": "http://localhost:10900"}'
aws --endpoint-url http://localhost:8000 s3 mb s3://fish
aws --region=default --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration --bucket fish \
--notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": []}]}'
add versioning to the bucket:
aws --endpoint-url http://localhost:8000 s3api put-bucket-versioning --bucket fish --versioning-configuration Status=Enabled
create a file and upload 3 versions of it:
head -c 512 </dev/urandom > myfile
aws --endpoint-url http://localhost:8000 s3 cp myfile s3://fish
head -c 512 </dev/urandom > myfile
aws --endpoint-url http://localhost:8000 s3 cp myfile s3://fish
head -c 512 </dev/urandom > myfile
aws --endpoint-url http://localhost:8000 s3 cp myfile s3://fish
create a delete marker:
aws --endpoint-url http://localhost:8000 s3api delete-object --bucket fish --key myfile
delete the delete marker according to the reply from the delete marker creation:
aws --endpoint-url http://localhost:8000 s3api delete-object --bucket fish --key myfile --version-id <version id>
delete a specific version is done similarly based on the object's version id. the version id could be taken from the notification.
To test in combination of multipart upload just use a 10MB file:
head -c 10485760 </dev/urandom > myfile
aws --endpoint-url http://localhost:8000 s3 cp myfile s3://fish
To get the list of version of an object, use:
aws --endpoint-url http://localhost:8000 s3api list-object-versions --bucket fish --prefix myfile
To delete multiple versions using multi-delete:
aws --endpoint-url http://localhost:8000 s3api delete-objects --bucket fish \
--delete '{"Objects": [{"Key": "myfile", "VersionId": "<version id>"}, {"Key": "myfile", "VersionId": "<version id>"}]}'
To create a delete marker using multi-delete:
aws --endpoint-url http://localhost:8000 s3api delete-objects --bucket fish \
--delete '{"Objects": [{"Key": "myfile", "VersionId": ""}]}'