Using the S3 Compatible API

Infinite Uploads cloud storage has an API and credentials that are compatible with the S3 API protocol. This means it is often possible to configure many apps designed for managing files in S3 to use your Infinite Uploads cloud storage buckets. This can be a great way to manage your files in our cloud and use your storage for files outside of the normal WordPress media library! Note not all apps have a flexible enough configuration ability to be compatible with this, so your results may vary. We give a few examples in this document for some popular apps. Others will be configured in a similar manner.

If you have a business level plan, you can access your S3 compatible credentials for each site via the Sites dashboard page when logged in to our site. It appears like this:

Notes:

  • Important - Infinite Upload cloud storage is designed only for hosting public files as its main use case is for your website media. Any files in your cloud storage can be accessed via our CDN if the url is known or guessed.

  • Your API key is restricted to the specific path in your bucket. You can only perform S3 commands List/Put/Get/Copy inside that path or you will get a permissions error. You cannot manage buckets.
  • Our S3 Compatibility API only supports the most recent version of authentication known as the v4, or version 4. If your integration asks you to specify which version (typically v2 or v4), make sure you select v4 as the option. 

  • If your plan expires due to payment issues or is canceled your credentials for all sites will be reset and your will need to reconfigure any apps after enabling again. When you cancel, credentials will be read-only until your scheduled data deletion takes place.

The following examples assume you have these connection details:

  • Endpoint URL: s3.us-west-000.backblazeb2.com
  • Bucket: iup-usa/123/xxxxxxxx/

S3 Browser

S3 Browser is a freeware Windows Client for any S3 compatible cloud services.

S3 Browser can be configured with the Infinite Uploads S3 Compatible API by following the steps below.

Step 1:

On the Add New Accounts tab select the provider as S3 compatible Storage from the drop down menu. Provide all the necessary credentials such as Key ID, Application key, and the S3 endpoint.

Step 2:

Click the "Advanced S3-Compatible storage settings" link at the bottom of the window and change the Signature Version to Signature V4.

Close the window and proceed with adding the account. 

Step 3:

As your access keys do not have permission to list all files in the root of the bucket you have to manually add your bucket by clicking "Buckets->Add External bucket":


WinSCP

WinSCP is a free open source Windows tool that is a file transfer client for SFTP, FTP, WebDAV, SCP and S3. It allows users to transfer files between a local and a remote computer, including S3 compatible storage like Infinite Uploads.

WinSCP can be configured with Infinite Uploads Cloud Storage by following the steps below.

Step 1:

Start WinSCP and you are automatically taken to the connection manager page. Click on New Site and then under File Protocol, select Amazon S3. Enter the S3 Endpoint URL without the "https://", your Key as Access Key ID and Secret as Secret Access Key into the appropriate fields.

Step 2:

You do not have permissions to browse the entire bucket so you will need to define your cloud storage directory as default. Under the Advanced popup, choose "Environment->Directories", then paste your bucket path as provided starting with "/", like "/iup-usa/123/xxxxxxxx/". Click ok to save then you can Login!.


CyberDuck

Cyberduck is a freeware software that has compatibility with Infinite Uploads cloud storage. You can download Cyberduck from their webpage here: https://cyberduck.io/

Step 1:

Open Cyberduck and then click the open connection icon.

Click the drop-down field that reads, "FTP (File Transfer Protocol)" and select "Amazon S3".

Enter the Endpoint without the "https://" in the "Server" field, your Key as Access Key ID and Secret as Secret Access Key into the appropriate fields.

Step 2:

By default it will list the buckets, but you do not have permissions to browse the entire bucket so you will need to jump to your cloud storage directory directly. Choose the "Go->Go to directory..." menu command, then paste your bucket path as provided starting with "/", like "/iup-usa/123/xxxxxxxx/". Then click Go to load your cloud storage directory.


AWS CLI

Start by installing AWS CLI. You can do this by following the instructions here.

Confirm that it is installed by using   aws --version.

Configuring AWS CLI to interface with your Infinite Uploads account:

Step 1:

Use the command   aws configure to start the configuration process.

You will be prompted with the following.

AWS Access Key ID [None]:   Key

AWS Secret Access Key [None]:   Secret

Default region name [None]:   leave blank

Default output format [None]:   leave blank

Step 2:

Configuration should be set now. You should be able to test the integration by attempting to list files your site bucket.

aws s3 ls s3://iup-usa/123/xxxxxxxx/ --endpoint-url=https://s3.us-west-000.backblazeb2.com

Using AWS CLI to transfer data to/from Infinite Uploads

Copy local directory to Infinite Uploads:

aws s3 cp local_directory/ s3://iup-usa/123/xxxxxxxx/ --recursive --endpoint-url=https://s3.us-west-000.backblazeb2.com

Download files from Infinite Uploads:

aws s3 cp s3://iup-usa/123/xxxxxxxx/ local_directory --recursive --endpoint-url=https://s3.us-west-000.backblazeb2.com

Creating pre-signed URLs from AWS CLI

Generating a pre-signed URL on a bucket that expires in 3600 seconds (default)

aws s3 presign s3://iup-usa/123/xxxxxxxx/ --endpoint-url=https://s3.us-west-000.backblazeb2.com

Generating a pre-signed URL on a folder in a bucket, that expires in 360 seconds

aws s3 presign s3://iup-usa/123/xxxxxxxx/folder/filename.png --expires-in 300 --endpoint-url=https://s3.us-west-000.backblazeb2.com

Note: Depending on how you are using the pre-signed URL, you may need to enclose it in quotes.


s5cmd

s5cmd is a free open source tool that supports a wide range of object management tasks both for cloud storage services, and local filesystems. It also supports parallel tasking and multiple threads for very fast throughput.

s5cmd can be configured with Infinite Uploads Cloud Storage by following the steps below.

Step 1:

Create a directory that will contain your credentials file.

mkdir ~/.aws

Step 2:

Create your credentials file, and enter your Key and Secret in the format shown below.

vi ~/.aws/credentials

Enter the following information and then save and exit.

[default] aws_access_key_id = 9xxxxxxxxxxx00000000003 aws_secret_access_key = Kyyyyyyyyyyy00000g

Step 3:

Example usage.

Note: The endpoint URL must be specified on each command, or you can set up a system alias that includes it automatically.

List contents of your bucket.

s5cmd -endpoint-url https://s3.us-west-000.backblazeb2.com ls s3://iup-usa/123/xxxxxxxx/

Copy a local file into a bucket.

s5cmd -endpoint-url https://s3.us-west-000.backblazeb2.com cp my-pets2020.jpg s3://iup-usa/123/xxxxxxxx/

AWS PHP SDK

You can use the AWS SDK for powerful interaction with our storage. Remember any *Bucket methods will not work, but most *Object methods will be compatible as long as it's limited to your assigned bucket path.

// Include the SDK using the Composer autoloader
require '<path for>/vendor/autoload.php';

use Aws\S3\S3Client;

//init client
$s3Client = new S3Client([
    'version'     => 'latest',
    'region'      => 'us-west-000', //use provided region
    'endpoint' => 'https://s3.us-west-000.backblazeb2.com', //use provided endpoint
    'credentials' => [ //use provided creds
        'key'    => 'your-access-key',
        'secret' => 'your-secret-key',
    ],
]);

//put an object
try {
    $result = $s3Client->putObject([
        'Bucket' => 'iup-usa/123/xxxxxxxx/',
        'Key' => 'new/bucket-relative/filename.png,
        'SourceFile' => '/local/file/path',
    ]);
} catch (S3Exception $e) {
    echo $e->getMessage() . "\n";
}

Still need help? Contact Us Contact Us