かべぎわブログ

ブログです

S3バケットの中のオブジェクトを数えてくれるPythonをかきました

概要

S3バケットの中にあるオブジェクトを数えてくれるPythonをかきました。

これです

これです
値はCloudWatchメトリクスから持ってきています。
github.com

つかいかた

こうやってつかうのだ

$ python get_object_count.py --help
usage: get_object_count.py [-h] --bucket BUCKET [--profile [PROFILE]]

optional arguments:
  -h, --help           show this help message and exit
  --profile [PROFILE]  Use a specific profile from your credential file.

required arguments:
  --bucket BUCKET      The name of the bucket name.
$ python ./get_object_count.py --bucket mybucket
12 Count

おわりに

aws s3 ls s3://mybucket --recursive --human --sumとかやらなくていいです。

Amazon Web Servicesインフラサービス活用大全 システム構築/自動化、データストア、高信頼化 (impress top gear)

Amazon Web Servicesインフラサービス活用大全 システム構築/自動化、データストア、高信頼化 (impress top gear)

  • 作者: Michael Wittig,Andreas Wittig,株式会社クイープ
  • 出版社/メーカー: インプレス
  • 発売日: 2019/09/05
  • メディア: 単行本(ソフトカバー)
  • この商品を含むブログを見る