Maksim Romanenko
Maksim Romanenko

Reputation: 365

CDK ClientVpnEndpoint. Would like to understand to get DnsName of created VpnEndpoint

I'm creating ClientVpnEndpoint using @aws-cdk/aws-ec2

 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,
  })

I would like to read property DnsName that I see in console in summary section, I as well can see it when I run cli command aws ec2 describe-client-vpn-endpoints.

My best attempt, that doesn't work:

  const cfnVpnEndpoint = vpnEndpoint.node.defaultChild as CfnClientVpnEndpoint;

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

I'm getting error:

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

I actually cannot make getAtt, to work for me with any other props. How to use it?

Could you help me to find out to reach read props of DnsName of ClientVpnEndpoint

Upvotes: 0

Views: 355

Answers (1)

stijndepestel
stijndepestel

Reputation: 3564

The CDK/CloudFormation simply doesn't support this attribute for the ClientVPNEndpoint. It can neither be found in the CDK documentation nor in the CloudFormation documentation. If you really need this value as the output of the stack, you should have a look at using a custom resource.

Upvotes: 2

Related Questions