I've got a series of s3 buckets with content split between Glacier and Infrequent access storage. I'd like to use cloudwatch via the PHP SDK to monitor the amount of data in different types of storage.
I can monitor the amount Infrequent Access storage using:
$cloudwatch->getMetricStatistics(
array(
'Namespace' => 'AWS/S3',
'MetricName' => 'BucketSizeBytes',
'StartTime' => $start,
'EndTime' => $end,
'Period' => 86400,
'Unit' => 'Gigabytes',
'Statistics' => array('Average'),
'Dimensions' => array(
array(
'Name' => 'BucketName',
'Value' => $BucketName
),
array(
'Name' => 'StorageType',
'Value' => 'StandardIAStorage'
)
)
)
);
Where $cloudwatch
is an aws cloudwatch client
From what I've read the documentation, I can't see a clear way of measuring the amount of data in glacier storage.
Has anyone found a way of doing this? Ideally, explicitly from cloudwatch but if not implicitly from the figures that are available.
Yes, you can turn on Amazon S3 Storage Inventory and configure it for your bucket.
This will store a daily inventory file in Amazon S3 that includes filesize and storage class. Here's a sample from one of my buckets:
"my-bucket","Cat-Teacup+kitten.jpg","15091","GLACIER"
"my-bucket","Cheese-Challerhocker.jpg","40147","GLACIER"
"my-bucket","Cheese-Grevenbroeker.jpg","29228","GLACIER"
"my-bucket","Cheese-Leyden.jpg","83056","GLACIER"