简体   繁体   English

有没有人有启动和停止 aws ec2 实例的 PowerShell 脚本

[英]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?有没有人有启动和停止 aws ec2 实例的 PowerShell 脚本?

param ( [string] $Filter = "xxxxx*" )参数 ( [字符串] $Filter = "xxxxx*" )

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

$instances = Get-EC2Instance -Filter @(@{name = 'tag:Name'; values = "xxxx"}) Start-EC2Instance $_.instances.instanceid $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查看 AWS 提供的此 cmdlet:“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此外,请查看 PowerShell Gallery 以了解 PowerShell 的 AWS 工具: https://www.powershellgallery.com/packages/AWS.NetCore/。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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