AWS S3: how do I see how much disk space is using

前端 未结 18 1369
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 10:33

I have AWS account. I\'m using S3 to store backups from different servers. The question is there any information in the AWS console about how much disk space is in use in my

18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 10:44

    See https://serverfault.com/questions/84815/how-can-i-get-the-size-of-an-amazon-s3-bucket

    Answered by Vic...

    ' . print_r($s3->listBuckets(), 1). '
    '; $totalSize = 0; $objects = $s3->getBucket('name-of-your-bucket'); foreach ($objects as $name => $val) { // If you want to get the size of a particular directory, you can do // only that. // if (strpos($name, 'directory/sub-directory') !== false) $totalSize += $val['size']; } echo ($totalSize / 1024 / 1024 / 1024) . ' GB'; ?>

提交回复
热议问题