S3 CLI 중에서 aws s3 에는 S3의 Region 정보를 가져오는 것은 없다.

 이로 인해, 리스트 산출할 때 어려움을 겪을 수 있는데,

 aws s3api 로 Region 정보를 가져올 수 있다.

 

 다음의 bash 쉘 스크립트는 s3.txt 에 나의 s3 bucket 이름을 각 라인별로 입력해 놓았다.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#!/bin/bash
for S3 in `cat s3.txt | awk {'print $1'}`
do
        aws s3api get-bucket-location --bucket ${S3} | grep LocationConstraint
done
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
위의 출력 내용은 다음과 같이 나타난다.
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
LocationConstraint: "{Region이름}"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
한개의 bucket 정보만 가져오려면 다음과 같이하면 된다.
 
aws s3api get-bucket-location --bucket {bucket이름}