AWS CloudFront提供了一种解决方法来降低SSL握手的出口成本。这种方法称为SNI扩展并利用基于主机的路由解决方法,可以在单个IP地址上托管和服务多个SSL/TLS证书。这意味着您可以使用SNI扩展将多个域名绑定到同一IP地址,并减少SSL握手所需的出口数据传输成本。
使用下面的CloudFormation模板创建CloudFront分布式API,并启用SNI扩展:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
CloudFrontDistribution:
Type: 'AWS::CloudFront::Distribution'
Properties:
DistributionConfig:
CallerReference: !Ref 'AWS::Region'
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
- OPTIONS
Compress: true
DefaultTTL: 3600
ForwardedValues:
Cookies:
Forward: none
Headers:
- Host
QueryString: false
MaxTTL: 86400
MinTTL: 0
TargetOriginId: !Ref 'apiOrigin'
ViewerProtocolPolicy: redirect-to-https
DefaultRootObject: index.html
Enabled: true
ViewerCertificate:
CloudFrontDefaultCertificate: true
Origins:
- DomainName: !Sub '${apiId}.execute-api.${AWS::Region}.amazonaws.com'
Id: !Ref 'apiOrigin'
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
PriceClass: PriceClass_100
# SNI扩展
Aliases:
- example.com
ViewerCertificate:
AcmCertificateArn:
- arn:aws:acm:us-east-1:GOOGLE:certificate/GOOGLE
MinimumProtocolVersion: TLSv1.2_2018
SslSupportMethod: sni-only
注意:这是一个简
上一篇:AWS中SQS事件的重复