通过 powershell 查找正在运行的 spotfleet 实例的 IP

通过 powershell 查找正在运行的 spotfleet 实例的 IP

我正在尝试从 Spot 队列启动 Spot 实例:

aws ec2 request-spot-fleet --spot-fleet-request-config file://aws-spot6.json
below is json content
{
  "SpotPrice": "0.06",
  "TargetCapacity": 1,
  "IamFleetRole": "arn:aws:iam::614786711942:role/aws-ec2-spot-fleet-tagging-role",
      "LaunchSpecifications": [
      {
          "ImageId": "ami-0b86323be1672551f",
          "KeyName": "amitpoc",
          "SecurityGroups": [
              {
                  "GroupId": "sg-0069a6368b0260ca9"
              }
          ],
          "InstanceType": "t2.large",
          "SubnetId": "subnet-03c112988598e6e7c",     
          "TagSpecifications": [
        {
          "ResourceType": "instance",
          "Tags": [
            {
              "Key": "Type",
              "Value": "poc"
            }
          ]
        }
      ]

     }

  ],
 "Type": "maintain"
}

一切正常。
现在我想在一个文件中查找所有已启动的竞价实例及其私有和公共 IP。这需要在 Windows 中通过 PowerShell 进行。

答案1

您需要使用以下describe-spot-fleet-instances命令:

aws ec2 describe-spot-fleet-instances --spot-fleet-request-id <value>

有关更多信息,请阅读 aws-cli 帮助:

aws ec2 describe-spot-fleet-instances help

相关内容