简体   繁体   中英

Does anyone have a PowerShell script that starts and stops aws ec2 instances

Does anyone have a PowerShell script that starts and stops aws ec2 instances?

param ( [string] $Filter = "xxxxx*" )

$CurrentDate = (Get-Date -Format "yyyyMMdd.0.0")

$instances = Get-EC2Instance -Filter @(@{name = 'tag:Name'; values = "xxxx"}) Start-EC2Instance $_.instances.instanceid

Check out this cmdlet by AWS: "Start-EC2Instance Cmdlet", https://docs.aws.amazon.com/powershell/latest/reference/items/Start-EC2Instance.html

And in extension, have a look at the PowerShell Gallery to understand the AWS tools for PowerShell: https://www.powershellgallery.com/packages/AWSPowerShell.NetCore/4.1.11.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM