微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 CDK / Cloudformation 中获取 API Gateway 客户端证书?

如何解决如何在 CDK / Cloudformation 中获取 API Gateway 客户端证书?

是否可以检索 API Gateway 生成的自签名客户端证书,然后用于与 HTTP 代理集成进行通信?我希望能够将证书存储在 Parameter Store 或 Secrets Manager 中。

例如:

const clientCertificate = new CfnClientCertificate(this,"ApigClientCertificate",{
  description: "Client certificate presented by APIG when calling HTTPS backend services",});

this.restApi = new SpecRestApi(this,'OpenapiRestApi',{
  restApiName: 'My Api',apiDeFinition: ApiDeFinition.fromInline(...some OpenApi API defined here...),deploy: true,deployOptions: {
    stageName: 'api',clientCertificateId: clientCertificate.ref,},});

在这里,我通过 OpenAPI 规范定义了一个 APIGateway,我们假设其中有一个 HTTP 代理,用户在其中调用 APIG 端点,并且该调用被转发到 HTTPS 端点,并使用由生成的自签名客户端证书APIG。

是否可以从 APIG 获取 PEM 证书?

解决方法

目前还不可能,因为 AWS::ApiGateway::ClientCertificate 不返回它。

您必须为 custom resource 开发一个 lambda 函数,该函数将使用 AWS API get-client-certificates 来获取证书的正文并返回到您的堆栈。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。