Quantcast
Channel: efexare.com
Viewing all articles
Browse latest Browse all 10

displaying amazon route 53 health check status and configuration in powershell

$
0
0

If you need to display the configuration and status of your route 53 health checks in amazon you can use this powershell.

you will need to

1. install the aws tools for powershell – https://aws.amazon.com/powershell/ into a location, and then set your execution policy as minimum remote signed – Set-ExecutionPolicy RemoteSigned.
2. setup an api key in amazon.
3. set the region id in the script.
4. set a proxy if required.

$healthcheckarray = @()

#change this location to where you installed the amazon powershell modules into.
Import-Module C:\apps\awspowershell\AWSPowerShell.psd1

#set api credentials here.
Set-AWSCredentials -AccessKey xxx -SecretKey xxx

Set-DefaultAWSRegion -region ap-southeast-2

#if proxy required.
#Set-AWSProxy -hostname proxy.internal -port 8080 -username usernamehere -Password passwordhere

$healthchecks = Get-R53HealthChecks
foreach ($healthcheck in $healthchecks)
{

$healthcheckinfo = Get-R53HealthCheck -HealthCheckId $healthcheck.Id
#[string]$name, [string]$ip, [string]$url, [int]$port, [string] path, [int]$status

$ip = $healthcheckinfo.HealthCheckConfig.IPAddress
$url = $healthcheckinfo.HealthCheckConfig.FullyQualifiedDomainName
$port = $healthcheckinfo.HealthCheckConfig.Port
$name = (Get-R53TagsForResource -ResourceId $healthcheck.Id -ResourceType healthcheck).Tags.value
$path = $healthcheckinfo.HealthCheckConfig.ResourcePath

$name

$status = (Get-R53HealthCheckStatus -HealthCheckId $healthcheck.Id).StatusReport.Status

#AddR53Healthcheck($name, $ip, $url, $port, $path, $status)
$myObject = New-Object System.Object
$myObject | Add-Member -type NoteProperty -name Name -Value $name
$myObject | Add-Member -type NoteProperty -name Ip -Value $ip
$myObject | Add-Member -type NoteProperty -name Url -Value $url
$myObject | Add-Member -type NoteProperty -name Path -Value $path
$myObject | Add-Member -type NoteProperty -name Status -Value $status[0]

#$myObject

$healthcheckarray += $myObject

#echo $name
}

$healthcheckarray | ft -AutoSize -Property *


Viewing all articles
Browse latest Browse all 10

Trending Articles