Creare CloudFrontWebDistribution con viewerCertificate, come configurare

0

Domanda

Io sono la distribuzione mia pagina singola app ad un S3 secchio via AWS-CDK.

Stack corrente codice è:

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'
        }
      ]
    });

Tuttavia, in AWS-CDK 1.133 ho ricevuto il messaggio che aliasConfiguration è deprecato. Così sto cercando di viewerCertificate: ViewerCertificate.fromAcmCertificate() ma io non sono sicuro di come usarlo.

Prima che io potessi vedere il ARN del Certificato che ho già creato in Gestione Certificati. Posso usare il Certificate classe per ottenere un riferimento esistente ACM di risorse e l'uso che con il ViewerCertificate?

AWS è docs non sono molto chiare in esempi, a tutti i riferimenti.

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

Migliore risposta

0

Sì, è possibile utilizzare il Certificate costruire per ottenere un riferimento a un certificato esistente. Utilizzare Certificate.fromCertificateArn()

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

In altre lingue

Questa pagina è in altre lingue

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