을 만들 CloudFrontWebDistribution 와 viewerCertificate,을 구성하는 방법

0

질문

나 배포하는 내 하나의 페이지를 S3 을 통해 AWS-CDK.

현재택 코드:

this.distribution = new CloudFrontWebDistribution(this, `${this.props.applicationName}Distribution`, {
      originConfigs: [
        {
          s3OriginSource: {
            s3BucketSource: this.dashboardBucket,
            originAccessIdentity: dashboardIdentity
          },
          behaviors: [{
            isDefaultBehavior: true
          }],
        },
      ],
      aliasConfiguration: {
        acmCertRef: awsConfig.acm_arn,
        names: [url]
      },
      errorConfigurations: [
        {
          errorCode: 403,
          responseCode: 200,
          responsePagePath: '/'
        },
        {
          errorCode: 404,
          responseCode: 200,
          responsePagePath: '/index.html'
        }
      ]
    });

그러나,AWS-CDK1.133 나는 메시지 aliasConfiguration 은 사용되지 않습니다. 그래서 내가 찾는 것에 viewerCertificate: ViewerCertificate.fromAcmCertificate() 하지만 내가 사용하는 방법을 확실하지 않습니다.

기 전에 내가 참조할 수 있 ARN 인증서의 이미 만들어진 인증서 관리자입니다. 사용할 수 있습니까 Certificate 클래스에 대한 참조를 가져오기 위해 기존의 ACM 자원과 사용으로 ViewerCertificate?

AWS 의 문서지 않는 슈퍼 취소 예에서,단지에 모든 참조가 있습니다.

amazon-cloudfront aws-cdk
2021-11-23 11:38:14
1

최고의 응답

0

그렇다,사용할 수 있습니다 Certificate 건설에 대한 참조를 가져 기존 인증서입니다. 사 Certificate.fromCertificateArn()

viewerCertificate: ViewerCertificate.fromAcmCertificate(
    Certificate.fromCertificateArn(this, "my_cert", awsConfig.acm_arn)
)
2021-11-23 13:37:06

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................