The "Object Storage" offer from OVH is indicated as being S3 compatible, but the identifiers provided by OVH do not allow us to connect directly via the AWS S3 libraries.
You must therefore retrieve a token from OVH KeyStone, then use it to obtain the accesses that can be used by S3.
- Create a user account on OVH for Object Storage (with "Object Store" rights) and keep the username and password.
- Retrieve the projectName by clicking on "View Credentials" from the OVH Horizon interface.
- Enter these values in the PHP file and run it.
- It should return the values of UserID, AccessKey and Secret.
- It then becomes possible to use them with an AWS S3 library, with the following client options:
$ options = [
'version' => 'latest',
'region' => 'GRA',
'credentials' => [
'key' => $key,
'secret' => $secret
],
'endpoint' => 'https://s3.gra.cloud.ovh.net' // https://s3.{region}.cloud.ovh.net
];