AWS 的官方公告在「Amazon S3 introduces account regional namespaces for general purpose buckets」,以及「Introducing account regional namespaces for Amazon S3 general purpose buckets」,不過在「Bucketsquatting is (Finally) Dead」這邊早一些看到。這個功能要解決 Amazon S3 的 bucket name 會遇到的撞名問題。
以往在 Amazon S3 上的 bucket name 都是先搶先贏,而且刪除掉的 bucket name 是可以重複利用的,所以會遇到幾種問題:
- 人家看你的 bucket name 叫做 foo-production,那他就故意試著註冊掉 foo-testing 與 foo-dev 與 foo-develop 與 foo-development。
- 或是人家看你的 bucket name 叫做 foo-2026,他就故意註冊掉 foo-2027~foo-2100。
在「General purpose bucket naming rules」這邊的文件說明裡面有提到有些規則的 bucket name 是有限制的,這次提到的 account regional namespace 就是新增加的規則,-an 結尾的 bucket name 會受到額外的權限檢查限制:
Bucket names can only end with the suffix
-anwhen you are creating buckets in your account regional namespace.
不過 bucket name 已經不長了,上限 63 個字:
Bucket names must be between 3 (min) and 63 (max) characters long.
而像是 -123456789012-ap-northeast-1-an 這樣的 suffix 就吃了 31 chars,即使是最短的也是 26 chars 的 -123456789012-us-east-1-an,考慮到 project + type + environment 的字串長度 (像是 foobar-assets-production),有點微妙,但至少是給了個解法,在官方文件「Namespaces for general purpose buckets」中也提到了這點:(這邊注意到範例是 012345678910 而不是 012345678901)
Your account regional suffix counts towards the maximum number of 63-characters allowed in general purpose bucket names. So if your account regional suffix is -012345678910-us-east-1-an, then you have 37-characters available for your bucket name prefix.
另外文件上提到了個特別的限制,目前中東區還沒 deploy 這個功能,不確定是什麼原因,我猜有可能是某些 compliance 的關係,新功能上線會需要有足夠權限的人在現場 approve?然後考慮到現在中東的情況...:
You can create buckets in your account regional namespace in all AWS Regions except Middle East (Bahrain) and Middle East (UAE).

