aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js (In Maintenance Mode, End-of-Life on 09/08/2025). The AWS SDK for JavaScript v3 in the browser and Node.js is available here: https://github.com/aws/aws-sdk-js-v3
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.6k stars 1.55k forks source link

fix: add global hostnames for additional regions #4675

Closed kuhe closed 2 months ago

kuhe commented 2 months ago

This configures a partition global endpoint for two partitions of Route53.

Test code:

var AWS = require("../../lib/aws");

process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = 1;

const regions = [
  "us-east-1",
  "us-west-2",
  "il-central-1",
  "us-isof-south-1",
  "eu-isoe-west-1",
];

for (const region of regions) {
  const r53 = new AWS.Route53({
    region,
  });
  const req = r53.listCidrBlocks({});
  console.log(req.httpRequest.endpoint.href);
}

for (const region of regions) {
  const cf = new AWS.CloudFront({
    region,
  });
  const req = cf.listDistributions({});
  console.log(req.httpRequest.endpoint.href);
}

output:

https://route53.amazonaws.com/
https://route53.amazonaws.com/
https://route53.amazonaws.com/
https://route53.csp.hci.ic.gov/
https://route53.cloud.adc-e.uk/
https://cloudfront.amazonaws.com/
https://cloudfront.amazonaws.com/
https://cloudfront.amazonaws.com/
https://cloudfront.us-isof-south-1.csp.hci.ic.gov/
https://cloudfront.eu-isoe-west-1.cloud.adc-e.uk/