Skip to content

Commit 3456384

Browse files
committed
Add get-instance.eip.ps1
1 parent 09763c2 commit 3456384

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

route53/get-instance-eip.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#Import AWS credentials
2+
. ./credentials.ps1
3+
4+
Set-AWSCredential -AccessKey $AWSAccessKey -SecretKey $AWSSecretKey
5+
6+
#$regions = @("us-east-1","us-west-1")
7+
$regions = @((Get-AWSRegion).Region)
8+
$urlprefix = "http://"
9+
10+
$instances = @()
11+
12+
$regions | ForEach-Object {
13+
$regioninstances = (Get-EC2Instance -Region $_).Instances
14+
if ($regioninstances -ne $null) {
15+
$instances += (Get-EC2Instance -Region $_).Instances
16+
}
17+
}
18+
19+
$sessions = @()
20+
$instances | ForEach-Object {
21+
$sessions += New-Object PSObject -Property @{
22+
'Name'=$_.Tags.Value;
23+
'IP'=$_.PublicIpAddress;
24+
'URL'="$($urlprefix)$($_.PublicIpAddress)";
25+
}
26+
}
27+
28+
$sessions | Sort-Object -Property IP | Select-Object -Property Name,IP,URL

0 commit comments

Comments
 (0)