สร้าง CloudFrontWebDistribution กับ viewerCertificate ยังต้องปรับแต่ง

0

คำถาม

ฉัน deploying ของฉันยังโสดหน้าแอพต้องเป็น 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-CDK 1.133 ฉันได้ข้อความนั่น aliasConfiguration คือ deprecated. ดังนั้นฉันกำลังมองอยู่ viewerCertificate: ViewerCertificate.fromAcmCertificate() แต่ฉันไม่แน่ใจว่ามันใช้ยังไง?

ก่อนที่ผมจะอ้างอิง ARN ของใบรับรองว่าฉันจองแล้วสร้างขึ้นมาในกองใบรับรองที่ผู้จัดการ สามารถฉันใช้ Certificate ชั้นเรียนจะได้รับการอ้างอิงของที่มีอยู่ ACM องทรัพยากรและใช้มันกับ ViewerCertificate?

AWS น docs ไม่ใช่สุดยอดชัดเจนในตัวอย่างทั้งหมอ้างอิง

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ý
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่