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

AWS::Route53Resolver::ResolverEndpoint GetAtt for resolver ip-addresses #172

Open
markymarkus opened this issue Sep 12, 2019 · 7 comments
Open
Labels
networking & content deliv VPC, CloudFront, Route 53, API Gateway, Direct Connect, AWS App Mesh, etc.

Comments

@markymarkus
Copy link

Title -> AWS::Route53Resolver::ResolverEndpoint GetAtt for resolver ip-addresses
Scope of request -> Make the ip-addresses available via GetAtt on AWS::Route53Resolver::ResolverEndpoint resource.
Expected behavior -> !GetAtt InboundResolver.IpAddress
Test case recommendation (optional) ->
Links to existing API doc (optional) ->
Category tag (optional) -> Networking & Content
Any additional context (optional)

Please add a new attribute to ResolverEndpoint for ip-addresses. When resolver endpoint is created to subnets, resolver selects available ip-address from a subnet. There is no way to get those selected ip-address from a resolver. At least for INBOUND endpoint it would be really helpful to get ip-addresses via GetAtt.

@TheDanBlanco TheDanBlanco added the networking & content deliv VPC, CloudFront, Route 53, API Gateway, Direct Connect, AWS App Mesh, etc. label Sep 17, 2019
@PatMyron
Copy link
Contributor

#68 (comment)

@chrisdag
Copy link

Bump. When creating inbound endpoints it would be nice to be able to get back the assigned IPs so they can be exported or used to update an SSM Parameter Store value

@acesir
Copy link

acesir commented Nov 14, 2021

Any update on this? Given the rule associated with outbound endpoints requires target IP address it makes it impossible to chain creation of inbound/outbound/rule combination with CloudFormation.

@Izaya-San
Copy link

Same issue for DnsServers property of AWS::EC2::ClientVpnEndpoint resource. Resolver Inbound IP Addresses can't be extracted from AWS::Route53Resolver::ResolverEndpoint.

@gtskaushik
Copy link

We have a usecase to create Inbound & outbound resolvers and then create the Rules. Since we are not able to get the ip-addresses, we cannot wire the whole flow in CDK

@gtskaushik
Copy link

Is there any workaround to get the ip-address?

@gtskaushik
Copy link

gtskaushik commented May 16, 2023

Used this workaround to solve this via AwsCustomResource

const privateSubnets = vpc
      .selectSubnets({ subnetType: SubnetType.PRIVATE_WITH_EGRESS })
      .subnetIds.map((subnetIdStr) => ({ subnetId: subnetIdStr }));
    const inboundResolver = new route53resolver.CfnResolverEndpoint(
      this,
      "inboundResolver",
      {
        direction: "INBOUND",
        name: `${route53ResolverName}-inbound`,
        ipAddresses: privateSubnets,
        resolverEndpointType: "IPV4",
        securityGroupIds: [inboundResolverSecurityGroup.securityGroupId],
      }
    );
    const inboundIpAddresses = this.getIpAddressesFromResolver(
      inboundResolver,
      "GetInboundResolverIpAddress",
      privateSubnets.length
    );

private getIpAddressesFromResolver(
    resolver: route53resolver.CfnResolverEndpoint,
    id: string,
    ipsCount: number
  ) {
    let ipAddresses: string[] = [];
    const ipAddressesRes = new AwsCustomResource(this, id, {
      onUpdate: {
        service: "Route53Resolver",
        action: "listResolverEndpointIpAddresses",
        parameters: {
          ResolverEndpointId: resolver.attrResolverEndpointId,
        },
        physicalResourceId: PhysicalResourceId.of(Date.now().toString()),
      },
      policy: AwsCustomResourcePolicy.fromSdkCalls({
        resources: AwsCustomResourcePolicy.ANY_RESOURCE,
      }),
    });
    for (let i = 0; i < ipsCount; i++) {
      ipAddresses.push(
        ipAddressesRes
          .getResponseFieldReference(`IpAddresses.${i}.Ip`)
          .toString()
      );
    }

    return ipAddresses.join(",");
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking & content deliv VPC, CloudFront, Route 53, API Gateway, Direct Connect, AWS App Mesh, etc.
Projects
Status: Researching
Development

No branches or pull requests

7 participants