There are published API docs available for SDK 2. The API docs for the GlacierClient lists the parameters for each operation if you click on the little hash symbols on the right.
EDIT: A recent post on the AWS PHP Development Blog shows how to upload archives to Amazon Glacier using both the single and multipart upload options.
There is also the Amazon Glacier Developer Guide that is published by AWS. It's not specific to PHP, but it does talk more about how to use the service and what the parameters mean.
Though not documented in the API docs, the PHP SDK does some work in the background to help you with uploads for Glacier. In most cases the accountId
parameter should be set to "-"
, so the SDK will default to this if you don't set one. Also, the SDK calculates the SHA hashes for you if not provided.
So, simple UploadArchive
example (building off what was provided in the question) could be:
<?php
require 'vendor/autoload.php'; // Include Composer autoloader
use Aws\Glacier\GlacierClient;
use Aws\Common\Enum\Region;
$glacier = GlacierClient::factory(array(
'key' => 'key',
'secret' => 'secret',
'region' => Region::US_WEST_2
));
$glacier->createVault(array('vaultName' => 'new-vault'));
$result = $glacier->uploadArchive(array(
'vaultName' => 'new-vault',
'archiveDescription' => 'This is my new archive',
'body' => 'the contents of the archive',
));
$archiveId = $result->get('archiveId');
There is still a lack of examples available, but I'd expect that to improve over time. Also, the AWS SDK for PHP forum is a good place to post questions specifically about the SDK since the SDK team is constantly monitoring the posts there.