【发布时间】:2019-11-23 19:34:05
【问题描述】:
我正在创建一个完全无服务器的解决方案,该解决方案也将创建一个 s3 存储桶和 CloudFront。使用来自 bitbucket 管道的云形成模板
我还想为 CloudFront 创建无效。
1) 是否可以在云形成中创建失效?
2) 如果不是,那么我如何从我的云形成中获取分发 ID,然后使用 aws cli 创建失效
CFDistribution:
Type: 'AWS::CloudFront::Distribution'
DependsOn: UIBucket
Properties:
DistributionConfig:
Aliases:
- !Sub "${AppSubDomain}.${SSMDomain}"
Origins:
- DomainName: !GetAtt UIBucket.DomainName
Id: S3BucketOrigin
S3OriginConfig:
OriginAccessIdentity: !Join
- ''
- - 'origin-access-identity/cloudfront/'
- !Ref CFOriginAccessIdentity
Comment: !Sub 'CloudFront origin for ${AppSubDomain}.${SSMDomain}'
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
- OPTIONS
TargetOriginId: S3BucketOrigin
ForwardedValues:
QueryString: 'false'
Cookies:
Forward: none
ViewerProtocolPolicy: redirect-to-https
DefaultRootObject: index.html
Enabled: 'true'
HttpVersion: http2
PriceClass: PriceClass_All
ViewerCertificate:
AcmCertificateArn: !Ref SSMWildcardCertificateARN
SslSupportMethod: sni-only
Tags:
- Key: "Type"
Value: "Host"
- Key: "Product"
Value: !Ref Product
- Key: "Environment"
Value: !Ref SSMEnvironment
【问题讨论】:
标签: amazon-web-services amazon-cloudformation