将 AttachInstances 与 CLI 配合使用 - AWS SDK 代码示例

AWS 文档 SDK 示例 GitHub 存储库中还有更多 AWS SDK 示例。

AttachInstances 与 CLI 配合使用

以下代码示例演示如何使用 AttachInstances

CLI
AWS CLI

将实例附加到自动扩缩组

此示例将指定的实例附加到指定的自动扩缩组。

aws autoscaling attach-instances \ --instance-ids i-061c63c5eb45f0416 \ --auto-scaling-group-name my-asg

此命令不生成任何输出。

  • 有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 AttachInstances

PowerShell
Tools for PowerShell V4

示例 1:此示例将指定的实例附加到指定的自动扩缩组。Auto Scaling 会自动增加自动扩缩组的所需容量。

Mount-ASInstance -InstanceId i-93633f9b -AutoScalingGroupName my-asg
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 AttachInstances

Tools for PowerShell V5

示例 1:此示例将指定的实例附加到指定的自动扩缩组。Auto Scaling 会自动增加自动扩缩组的所需容量。

Mount-ASInstance -InstanceId i-93633f9b -AutoScalingGroupName my-asg
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 AttachInstances