aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.34k stars 3.76k forks source link

aws-amplify-alpha: Add support for custom ACM cert #30594

Open thedevopsguyblog opened 1 week ago

thedevopsguyblog commented 1 week ago

Describe the feature

Hello,

In the UI their is an option to specify a custom SSL cert that is provisioned via ACM.

Screenshot 2024-06-20 at 9 59 48 am

Using the aws-amplify-alpha construct it would be handy if i could specify a SSL cert I would like to use.

Use Case

I know Specifically in the case when i want to provision my own cert for a custom domain name in cognito and use the same cert for my frontend.

Proposed Solution

  1. Provision the ACM managed cert in a separate stack
      new cdk.aws_certificatemanager.Certificate(this, 'Certificate', {
        domainName: props!.envVars.FQDN,
        validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(importedHostedZone),
        subjectAlternativeNames:[
            `*.${props!.envVars.FQDN}`,
            `*.api.${props!.envVars.FQDN}`,
            `*.auth.${props!.envVars.FQDN}`,
        ]
      });
    }
  2. In the stack where we define the FE app
    new amplifyAlpha.App(this, 'mySubAmpHosting', {
    ...
    acmCert:{
    fromCertificateArn:`xxx`
    }
    })

Other Information

No response

Acknowledgements

CDK version used

2.143.0 (build 9f2bdf7)

Environment details (OS name and version, etc.)

macOS Ventura - 13.6.3

khushail commented 1 week ago

Hi @thedevopsguyblog , thanks for reaching out.

I see that CertificateSettings prop is supported by the cloudformation, and is missing from the alpha module. This prop support providing AWS managed or Custom certificates, hence is suitable for your usecase. However I am marking this issue as P3, requesting contributions from the community in this regard.