为什么 S3 上的活动存储需要“区域”字段?

Why is `region` field needed for active storage on S3?

今天我试了 rails 5.2.0.

它在 rails new编辑时生成了以下文件模板。

# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
#   service: S3
#   access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
#   secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
#   region: us-east-1
#   bucket: your_own_bucket

问题:

"there is no region in S3 service",这是不正确的。

摘自Working with Amazon S3 Buckets,官方文档。

Amazon S3 creates buckets in a region you specify. You can choose any AWS Region that is geographically close to you to optimize latency, minimize costs, or address regulatory requirements. For example, if you reside in Europe, you might find it advantageous to create buckets in the EU (Ireland) or EU (Frankfurt) regions. For a list of Amazon S3 regions, see Regions and Endpoints in the AWS General Reference.