Last active
August 4, 2020 06:27
-
-
Save giseongeom/a94eeba8f9d522fab7592786740b9331 to your computer and use it in GitHub Desktop.
Retrieve AWS EC2 instance types (Scope: region)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -version 5.1 | |
Param ([string]$region = 'ap-northeast-2') | |
Import-Module AWS.Tools.Common | |
Import-Module aws.tools.ec2 | |
Param ([string]$region = 'ap-northeast-2') | |
Set-AWSCredential -ProfileName default | |
Set-DefaultAWSRegion -Region $region | |
Write-Host -NoNewline '01: Region: ' | |
Write-Host $region | |
$ec2_offer = Get-EC2InstanceTypeOffering -LocationType availability-zone | Sort-Object InstanceType | |
Write-Host -NoNewline '02: Exporting to ec2-list.csv: ' | |
$ec2_offer | | |
Select-Object InstanceType,Location | | |
export-CSV ec2-list.csv -ErrorAction SilentlyContinue -Force | |
if ($?) { Write-Host 'Done.'} | |
Write-Host '03: Instance types per availability-zone ' | |
$ec2_offer | Sort-Object location,InstanceType | ft -GroupBy location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.