AWS CLI - S3 and Alibaba Object Storage Service
A Laravel Forge customer recently reached out to us asking whether the Database Backup feature supported Alibiba OSS (Object Storage Service).
Since OSS is S3 compatible, the answer is happily "yes" however, in this case the S3 compatibility requires a custom configuration change which we can make very quickly. Without the below change, you'll get this error:
upload failed: - to s3://bucket/directory/file An error occured (SecondLevelDomainForbidden) when calling the PutObject operation: Please use virtual hosted style to access.
When Forge configures database backups, it creates a
/root/.aws/config file that is used by
awscli to configure how S3 settings. For OSS to work, I had to make the following one-line adjustment:
[profile backup-xxxx] output=text region= s3 = signature_version = s3v4 + addressing_style = virtual
The backup can now finish successfully.