托管静态网站时如何将AWS S3存储桶长URL更改为短S3 URL?

时间:2020-09-18 03:30:37

标签: html amazon-web-services amazon-s3 web-hosting

团队,

我需要将AWS S3 URL更改为较短的URL版本,例如:

当前: https://trabajos-costa-rica.s3.us-east-2.amazonaws.com/index.html

需要更改为: https://s3.amazonaws.com/trabajos-costa-rica/index.html

这正在数千个网站/存储桶上运行,但是我找不到正确的配置,我在Amazon S3上托管了一个静态HTML网站。

这是一个实际的工作示例:

https://s3.amazonaws.com/walgreens-photo-coupon/walgreens/index.html

https://s3.amazonaws.com/orlando-cremation-services/average-cost-of-cremation-in-orlando-florida-call-us-at-407-250-9846-2.html

https://s3.amazonaws.com/dfc_attachments/public/documents/3260209/Dental_Plan_Overview_2019.pdf

这是怎么做到的?

我遇到以下错误:

<Error>
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>trabajos-costa-rica.s3.amazonaws.com</Endpoint>
<Bucket>trabajos-costa-rica</Bucket>
<RequestId>C8632DF84734CE4A</RequestId>
<HostId>KyFNBQtuz2pwDPBMquz72kvozKWHOB3uN1ctiSKtuxvBqSvh9AaRISIQlqelOelLlQITGQCAwBs=</HostId>
</Error>

但我不知道这是否是一般性错误消息。

1 个答案:

答案 0 :(得分:2)

您可以使用:

https://s3-us-east-2.amazonaws.com/trabajos-costa-rica/index.html

请注意,它包含区域名称

但是,请注意,将关闭新存储桶的这种访问Amazon S3存储桶的样式。 2020年9月30日之后,将仅提供虚拟主机命名方式:

https://trabajos-costa-rica.s3.amazonaws.com/index.html

请参阅:Amazon S3 Path Deprecation Plan – The Rest of the Story | AWS News Blog

您还可以在Amazon S3存储桶上使用您自己的域名。参见:Configuring a static website using a custom domain registered with Route 53 - Amazon Simple Storage Service