aws-region-utils
is a utility library for working with AWS regions. It provides functions to calculate distances, sort regions by proximity, and more. This package is designed to help developers easily work with AWS region data in geospatial contexts.
Demo playground - https://pritamrungta.github.io/aws-region-utils
- Sort AWS Regions by Distance: Calculate and sort AWS regions based on their distance from the user's current GeoLocation (needs user consent for location access).
- Extensible and Modular: More utility functions will be added in future updates.
- TypeScript Support: Fully typed with TypeScript for better developer experience and safety.
Install the package via npm:
npm install aws-region-utils
import { awsRegions } from 'aws-region-utils';
const regions = awsRegions();
console.log(regions);
You can use the awsRegionsByDistance function to sort AWS regions by their distance from the user's location:
import { awsRegionsByDistance } from 'aws-region-utils';
awsRegionsByDistance()
.then((regions) => {
console.log(regions);
})
.catch((error) => {
console.error(error);
});
All contributions are welcome.