How to open the S3 interface of RADOS¶
The S3 interface is already configured and active.
In order to use it do as follows:
openstack --os-interface public ec2 credentials create
and take note of the access and secret keys.
When configuring the environment, the following informations are also needed:
name of the radosgw instance: http://swift.cloud.garr.it
port: 80
At this page:
there are some simple PHP scripts to verify basic functionality, also Ruby examples are available.
PHP scripts¶
conn.php¶
<?php
define('AWS_KEY', '<this_is_the_Access_string>');
define('AWS_SECRET_KEY', '<this_is_the_Secret_string>');
define('HOST', 'http://swift.cloud.garr.it');
define('PORT', '80');
// require the AWS SDK for php library
require '/home/galeazzi/phpScript/aws-autoloader.php';
use Aws\S3\S3Client;
// Establish connection with host using S3 Client
$client = S3Client::factory(array(
'base_url' => HOST,
'port' => PORT,
'key' => AWS_KEY,
'secret' => AWS_SECRET_KEY
));
?>
list_owned_buckets.php¶
<?php
include 'conn.php';
$blist = $client->listBuckets();
echo " Buckets belonging to " . $blist['Owner']['ID'] . ":\n";
foreach ($blist['Buckets'] as $b) {
echo "{$b['Name']}\t{$b['CreationDate']}\n";
}
?>
example¶
$ php -f list_owned_buckets.php
Buckets belonging to 27da191b736c4e33b170a72c8732482a:
test 2017-03-23T16:52:22.692Z
test3 2020-06-18T10:20:27.841Z
testContCsdPrj2 2020-07-23T08:37:04.015Z
testrclone 2020-06-19T09:09:24.507Z