gpt4 book ai didi

amazon-web-services - 如何在 cloudformation yaml 中配置路由规则?

转载 作者:行者123 更新时间:2023-12-04 08:18:13 25 4
gpt4 key购买 nike

我正在尝试使用使用 cloudformation 的无服务器 yaml 为我的静态 s3 存储桶网站配置此网站路由规则。

<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals/>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<HostName>foo.amazonaws.com</HostName>
<ReplaceKeyPrefixWith>prod/photos/resize?key=</ReplaceKeyPrefixWith>
<HttpRedirectCode>307</HttpRedirectCode>
</Redirect>
</RoutingRule>
</RoutingRules>

如何将其转换为下面的 yaml?

resources:
Resources:
UploadBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${file(./serverless.env.yml):${opt:stage}.BucketName}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
RoutingRule: //What's the format that goes here?

最佳答案

RoutingRulesAmazon S3 Website Configuration Routing Rules Property 的列表.

例如

RoutingRules:
- RedirectRule:
HostName: foo.amazonaws.com
HttpRedirectCode: "307"
Protocol: https
ReplaceKeyPrefixWith: prod/photos/resize?key=
RoutingRuleCondition:
HttpErrorCodeReturnedEquals: "404"

关于amazon-web-services - 如何在 cloudformation yaml 中配置路由规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42953937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com