2,187
edits
(→Setup Credentials: Added Linux unencrypted noye) |
(Added "Get Instances") |
||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
|} | |} | ||
== Set Default Region == | |||
Most commands need to be run against a specific region. You can either specify this each time you run CmdLet, or if you predominantly run in one region, its more convenient to set a default region | |||
<source lang="PowerShell"> | |||
Set-DefaultAWSRegion -Region eu-west-1 | |||
</source> | |||
Other useful region commands... | |||
<source lang="PowerShell"> | |||
Clear-DefaultAWSRegion # Clear default region | |||
Get-AWSRegion # Get list of regions, including what is default | |||
</source> | |||
== Get Instances == | |||
Example commands to get instances.. | |||
<source lang="PowerShell"> | |||
# Get running instances with Production tag | |||
$instances = Get-EC2Instance -Filter @(@{Name="tag:Function";Values="Production"};@{Name="instance-state-name";Values="running"}) | Select-Object -ExpandProperty instances | |||
# Get specific instance | |||
$instance = Get-EC2Instance -Filter @(@{Name="instance-id";Values="i-012345678abcdef01"}) | Select-Object -ExpandProperty instances | |||
</source> | |||
[[Category: AWS PowerShell]] | [[Category: AWS PowerShell]] |