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

route53: support IP-based routing #28801

Open
1 of 2 tasks
badmintoncryer opened this issue Jan 21, 2024 · 1 comment
Open
1 of 2 tasks

route53: support IP-based routing #28801

badmintoncryer opened this issue Jan 21, 2024 · 1 comment
Labels
@aws-cdk/aws-route53 Related to Amazon Route 53 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p3

Comments

@badmintoncryer
Copy link
Contributor

badmintoncryer commented Jan 21, 2024

Describe the feature

I want to enable the configuration of IP-based routing in Route 53 through the L2 construct.

Use Case

Currently, to configure IP-based routing in Route 53, it is necessary to use L1 constructs.

    const locationName = 'myLocation'
    // Create a CIDR collection
    const cidrCollection = new route53.CfnCidrCollection(this, 'MyCidrCollection', {
      name: 'MyCidrCollection',
      locations: [
        {
          cidrList: ['192.168.1.0/24', '192.168.2.0/24'],
          locationName,
        }
      ]
    });

    // Create a RecordSet that uses the CIDR collection
    new route53.CfnRecordSet(this, 'MyRecordSet', {
      // ... other properties ...
      // Reference the CIDR collection
      cidrRoutingConfig: {
        collectionId: cidrCollection.ref,
        locationName,
      },
    });

Proposed Solution

I believe that generating CfnCidrCollection within the recordSet constructor allows for intuitive configuration.
However, additional handling is required when sharing the same collection across different RecordSets.

IP-based routing resource record sets reference a location in a collection, and all resource record sets for the same record set name and type must reference the same collection. For example, if you create websites in two Regions and want to direct DNS queries from two different CIDR locations to a specific website based on the originating IP addresses, then both of those locations must be listed in the same CIDR collection.

interface CidrRoutingConfig {
  collectionName?: string;
  locations: Location[];
  // Define only if sharing the same collection with other RecordSets
  collection?: CfnCidrCollection:
}

interface Location {
  cidrList: string[];
  locationName?: string;
}

const record1 = new route53.RecordSet(this, 'IPBasedRoutingRecordSet1', {
  // ... other properties ...
  cidrRoutingConfig: {
    collectionName: 'MyCollection', // optional
    locations: [
      {
        locationName: 'Location1', // optional
        cidrList: ['192.168.1.0/24', '192.168.2.0/24'],
      },
    ],
  },
});

// By adding Location2 to the CfnCidrCollection created in record1, the same CidrCollection can be shared.
const record2 = new route53.RecordSet(this, 'IPBasedRoutingRecordSet2', {
  // ... other properties ...
  cidrRoutingConfig: {
    collection: record1.cidrCollection,
    locations: [
      {
        locationName: 'Location2', // optional
        cidrList: ['192.168.3.0/24', '192.168.4.0/24'],
      },
    ],
  },
});

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.116.0

Environment details (OS name and version, etc.)

irrelevant

@badmintoncryer badmintoncryer added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 21, 2024
@github-actions github-actions bot added the @aws-cdk/aws-route53 Related to Amazon Route 53 label Jan 21, 2024
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 22, 2024
@pahud
Copy link
Contributor

pahud commented Jan 22, 2024

Yeah we need to explore a little bit on that. Feel free to submit your PR when it's ready. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-route53 Related to Amazon Route 53 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants