Recent Post»

Recent Comment»

« 2024/5 »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
05-09 14:32

 

'S3'에 해당되는 글 1

  1. 2016.10.09 aws s3 cli 이용하여 버킷 사용량 구하기
 

aws s3 cli 이용하여 버킷 사용량 구하기

Tip | 2016. 10. 9. 11:06 | Posted by 짱아
반응형

aws s3 cli를 이용하여 버킷 사용량 구하기

[​환경]
* CentOS

​​​​​[aws cli install]
1. python 2.6.5 이상

2. pip 설치
$ yum install python-pip

​3. aws cli 설치
$ pip install awscli

​4. aws cli 환경설정
$ aws configure
AWS Access Key ID : access key 입력 (관련 값은 Security Credentials>Users 에서 확인 가능)

AWS Secret Access Key : secret access key ( Security Access Key 입력)

Default region name : ap-northeast-2 (seoul region을 이용하는 경우)

Default output format : json

5. 대상 버킷에 대한 사용량 구하기 위한 스크립트
$ aws s3 ls s3://<bucketname> --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}'

<bucketname>에 사용량 확인을 원하는 bucket명을 입력

반응형
: