【问题标题】:CDK ClientVpnEndpoint. Would like to understand to get DnsName of created VpnEndpointCDK ClientVpnEndpoint。想了解获取创建的 VpnEndpoint 的 DnsName
【发布时间】:2021-12-27 03:31:37
【问题描述】:

我正在使用@aws-cdk/aws-ec2 创建ClientVpnEndpoint

 const clientVpnEndpoint = new ClientVpnEndpoint(stack, "vpn-enpoint", {
    vpc: vpc,
    cidr: "10.16.0.0/22",
    clientCertificateArn: config.clientCertificateArn,
    serverCertificateArn: config.serverCertificateArn,
    dnsServers: ["8.8.8.8", "4.4.4.4"],
    logging: false,
  })

我想阅读我在控制台的摘要部分看到的属性 DnsName,我也可以在运行 cli 命令aws ec2 describe-client-vpn-endpoints 时看到它。

我的最佳尝试,但不起作用:

  const cfnVpnEndpoint = vpnEndpoint.node.defaultChild as CfnClientVpnEndpoint;

  new CfnOutput(stack, "vpn-enpoint-output", {
    value: cfnVpnEndpoint.getAtt("DnsName").toString(),
  });

我收到错误:

.../Value/Fn::GetAtt: Resource type AWS::EC2::ClientVpnEndpoint does not support attribute {DnsName}

我实际上无法让getAtt 为我使用任何其他道具。怎么用?

你能帮我找出读取 ClientVpnEndpoint 的 DnsName 的道具吗

【问题讨论】:

    标签: amazon-web-services amazon-ec2 amazon-cloudformation aws-cdk


    【解决方案1】:

    CDK/CloudFormation 根本不支持 ClientVPNEndpoint 的此属性。在CDK documentationCloudFormation documentation 中都找不到它。如果你真的需要这个值作为堆栈的输出,你应该看看使用custom resource

    【讨论】:

      猜你喜欢
      • 2021-11-27
      • 2018-12-23
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 2023-02-14
      • 1970-01-01
      • 2020-03-07
      相关资源
      最近更新 更多