Jorge Tovar
Jorge Tovar

Reputation: 1869

How to solve : "Received response status [FAILED] from custom resource. Message returned: Resource is not in the state certificateValidated"? CDK

I have the following error trying to create a static website inspired by https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/static-site/static-site.ts

 const certificateArn = new acm.DnsValidatedCertificate(
          this,
          "SiteCertificateR53",
          {
              domainName: props.siteDomain,
              hostedZone: props.zone,
              region: "us-east-1", // Cloudfront only checks this region for certificates.
            }
        ).certificateArn;
 
new cdk.CfnOutput(this, "CertificateR53", {value: certificateArn});

Error:

Received response status [FAILED] from custom resource. Message returned: Resource is not in the state certificateValidated

Upvotes: 8

Views: 14640

Answers (1)

Trayson Keli'i
Trayson Keli'i

Reputation: 378

If you don't need to do cross region stuff (e.g. us-east-1 needs a resource from us-west-2) using the following method provides the same benefit as DnsValidatedCertificate

const certificate = new acm.Certificate(this, `SiteCertificateR53`, {
            domainName: props.siteDomain,
            validation: acm.CertificateValidation.fromDns(props.zone)});

If you still gotta do cross-region stuff, then you should create and deploy your zone via AWS console first. That won't guarantee a fix though, this page can help if you're still stuck: https://docs.aws.amazon.com/acm/latest/userguide/troubleshooting-DNS-validation.html

Upvotes: 2

Related Questions