Search code examples
phpamazon-web-servicesamazon-glacier

I cannot find uploaded archive to amazon s3 glacier using php


I have uploaded files to Amazon S3 Glacier using PHP as per code below. Am sure that the file is uploaded to my free Glacier S3 Account as I can print uploaded files details, archiveId etc.

Here is my problem: I cannot access the uploaded file in my Glacier S3 vault. My Vault is empty. Please where can I find my uploaded files. Is there something like permission needed on my own end. am using free account

Here is the code:

require 'vendor/autoload.php';
use Aws\Glacier\GlacierClient;
use Aws\Glacier\TreeHash;

$client = new GlacierClient([
    'version' => 'latest',
    'region' => 'my region here',
    'credentials' => [
        'key'    => 'my key here',
        'secret' => 'my secret here'
    ]
]);

$filename ='test.txt';
$result = $client->uploadArchive([
    'accountId' => 'my accountid here',
    'archiveDescription' => 'my first desc',
     'body' => fopen($filename, 'r'),
    'checksum' => '',
    'contentSHA256' => '',
    'sourceFile' => 'test.txt',
    'vaultName' => 'my-vaultname-here',
]);

echo "success uploaded;
echo $archiveId = $result->get('archiveId');

Solution

  • The code above works fine as I stated earlier in the post. I finally read amazon glacier documentations and I found out the any uploaded files can show up within 1 to 48 hours depending on the archived region. The archieved has been showed. it seems to take us-east region to archive the inventory after 8-9 hours since uploads. Thanks