Skip to content

Instantly share code, notes, and snippets.

Last active April 12, 2022 15:58
What would you like to do?
Sample PowerShell function to identify the closest AWS Region using AWS Service Endpoints.
function Get-AWSRegionLatency {
param (
[String] $ServiceForMeasurement = 'dynamodb'
$endpoints = [System.Collections.ArrayList]::new()
$regions = (Get-AWSRegion | Where-Object {$_.Region -notlike 'us-iso*'}).Region
foreach ($region in $regions) {
$null = $endpoints.Add(('{0}.{1}' -f $ServiceForMeasurement, $region))
Invoke-FastPing -HostName $endpoints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment