Currently there is no documented way to create public buckets in Strato HiDrive S3. But it can be done very easily using the AWS CLI. To set up the CLI just follow my post here.
Let’s assume you already have a bucket called demobucket and you can access it using the AWS CLI. Now we upload a basic html page (or any other file):
% cat index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
Hello World!
</body>
</html>
% strato s3 cp index.html s3://demobucket
upload: ./index.html to s3://demobucket/index.html
The next step needs to be done only once for each bucket you want to make public. Please make sure you adjust the bucket name (in bold):
% strato s3api put-bucket-policy --bucket demobucket --policy "{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Sid\": \"PublicReadGetObject\",
\"Effect\": \"Allow\",
\"Principal\": \"*\",
\"Action\": \"s3:GetObject\",
\"Resource\": \"arn:aws:s3:::demobucket/*\"
}
]
}"
Now you can reach your file publicly using the URLs https://s3.hidrive.strato.com/demobucket/index.html or https://demobucket.s3.hidrive.strato.com/index.html:
If you want to make your bucket privat again, just delete the policy:
% strato s3api delete-bucket-policy --bucket demobucket
Schreibe einen Kommentar