Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDKで「カスタムドメイン」を作る際「証明書のオーナーではない」と言われエラー #15

Open
kazuhito-m opened this issue Jun 3, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kazuhito-m
Copy link
Owner

kazuhito-m commented Jun 3, 2023

現象

add-dns-and-certificate-to-apigateway ブランチのお試しコードにて。

CDKにて、本来の用途と思える apigateway.DomainName を使っての「カスタムドメインの作成」したい。

const certificateArn = StringParameter.valueFromLookup(this, settings.certArnPraStoreName());
const certificate = Certificate.fromCertificateArn(this, 'LookUpCertification', certificateArn);

const fqdn = settings.currentStage().apiFqdn;

console.log("ドメイン名: " + fqdn);
console.log("現在のリージョン:" + this.region);

// カスタムドメインの設定
const domainName = new apigateway.DomainName(this, 'domain-name', {
    domainName: fqdn,
    certificate: certificate,
    endpointType: apigateway.EndpointType.REGIONAL,
    securityPolicy: apigateway.SecurityPolicy.TLS_1_2,
});

上記コードにてCDK実行した場合、以下のエラーが発生する。

Invalid request provided: 
The certificate provided must be owned by the account creating the domain.

また、バグではないが、 endpointType: apigateway.EndpointType.EDGE, に変更した場合は、

Invalid request provided: Invalid certificate ARN: arn:aws:acm:xxx. ... 
Certificate must be in 'us-east-1'.

となり、こちらもエラーとなり、結局生成出来ない。(EDGEでは証明書を北米に作らなくてはならない)

考察

類似の事例もあるにはあるが…

見る限りは「違うリージョンに証明書を作ってしまった場合に出るメッセージ」という程度である。

可能性として考えられるのは、

  • 証明書を作ったのと使っているのが「違うStack」だから
  • 証明書を作った後、cdk bootstrap を行ってしまい、別のアカウント扱い(CDKToolkit スタックが別物)

だが、後者をやった記憶はないし、前者であれば「2つ以上のStackで制御できない」となり、少し現実味にかける。

解決

未、解決出来ず、ブロック

@kazuhito-m kazuhito-m added the bug Something isn't working label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant