【发布时间】:2020-05-30 06:31:30
【问题描述】:
可以使用 !Ref 到 S3 存储桶以在 ResponseParameter 中使用。例如:
IntegrationResponses:
- ResponseParameters:
method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
method.response.header.Access-Control-Allow-Origin: "'https://dynamicbucketname.s3-us-west-2.amazonaws.com'"
method.response.header.Access-Control-Allow-Credentials: "'true'"
S3Bucket:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: true
IgnorePublicAcls: false
BlockPublicPolicy: true
RestrictPublicBuckets: true
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
所以基本上我使用的是资源 AWS::S3::Bucket,它允许模板创建存储桶。因此,名称将是动态的。我希望能够 !Ref S3Bucket 在 Origin 内。这甚至可能吗?我知道它可以是静态的,例如 "'https://www.example.com'"
【问题讨论】:
标签: amazon-cloudformation aws-api-gateway