

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# を使用した Auto Scaling の例 AWS CLI
<a name="cli_2_auto-scaling_code_examples"></a>

次のコード例は、Auto Scaling AWS Command Line Interface で を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

### `attach-instances`
<a name="auto-scaling_AttachInstances_cli_2_topic"></a>

次のコード例では、`attach-instances` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループにインスタンスをアタッチする方法**  
この例では、指定されたインスタンスを、指定された Auto Scaling グループにアタッチします。  

```
aws autoscaling attach-instances \
    --instance-ids i-061c63c5eb45f0416 \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[AttachInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/attach-instances.html)」を参照してください。

### `attach-load-balancer-target-groups`
<a name="auto-scaling_AttachLoadBalancerTargetGroups_cli_2_topic"></a>

次のコード例では、`attach-load-balancer-target-groups` を使用する方法を示しています。

**AWS CLI**  
**ターゲットグループを Auto Scaling グループにアタッチする方法**  
この例では、指定されたターゲットグループを、指定された Auto Scaling グループにアタッチします。  

```
aws autoscaling attach-load-balancer-target-groups \
    --auto-scaling-group-name my-asg \
    --target-group-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Elastic Load Balancing を使用して Auto Scaling グループ内のインスタンス全体にトラフィックを分散させる](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[AttachLoadBalancerTargetGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/attach-load-balancer-target-groups.html)」を参照してください。

### `attach-load-balancers`
<a name="auto-scaling_AttachLoadBalancers_cli_2_topic"></a>

次のコード例では、`attach-load-balancers` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループに Classic Load Balancer をアタッチする方法**  
この例では、指定された Classic Load Balancer を、指定された Auto Scaling グループにアタッチします。  

```
aws autoscaling attach-load-balancers \
    --load-balancer-names my-load-balancer \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Elastic Load Balancing を使用して Auto Scaling グループ内のインスタンス全体にトラフィックを分散させる](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[AttachLoadBalancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/attach-load-balancers.html)」を参照してください。

### `cancel-instance-refresh`
<a name="auto-scaling_CancelInstanceRefresh_cli_2_topic"></a>

次のコード例では、`cancel-instance-refresh` を使用する方法を示しています。

**AWS CLI**  
**インスタンスの更新をキャンセルする方法**  
次の `cancel-instance-refresh` 例のは、指定された Auto Scaling グループの進行中のインスタンスの更新をキャンセルします。  

```
aws autoscaling cancel-instance-refresh \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の[インスタンスの更新のキャンセル](https://docs.aws.amazon.com/autoscaling/ec2/userguide/cancel-instance-refresh.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CancelInstanceRefresh](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/cancel-instance-refresh.html)」を参照してください。

### `complete-lifecycle-action`
<a name="auto-scaling_CompleteLifecycleAction_cli_2_topic"></a>

次のコード例では、`complete-lifecycle-action` を使用する方法を示しています。

**AWS CLI**  
**ライフサイクルアクションを完了する方法**  
この例では、インスタンスの起動または終了を完了できるように、指定されたライフサイクルアクションが完了したことを Amazon EC2 Auto Scaling に通知します。  

```
aws autoscaling complete-lifecycle-action \
    --lifecycle-hook-name my-launch-hook \
    --auto-scaling-group-name my-asg \
    --lifecycle-action-result CONTINUE \
    --lifecycle-action-token bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CompleteLifecycleAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/complete-lifecycle-action.html)」を参照してください。

### `create-auto-scaling-group`
<a name="auto-scaling_CreateAutoScalingGroup_cli_2_topic"></a>

次のコード例では、`create-auto-scaling-group` を使用する方法を示しています。

**AWS CLI**  
**例 1: Auto Scaling グループを作成する方法**  
次の `create-auto-scaling-group` の例では、リージョン内の複数のアベイラビリティーゾーンのサブネット内に Auto Scaling グループを作成します。インスタンスは、指定された起動テンプレートのデフォルトバージョンで起動されます。終了ポリシーやヘルスチェック構成など、他のほとんどの構成にはデフォルトが使用されることに注意してください。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-template LaunchTemplateId=lt-1234567890abcde12 \
    --min-size 1 \
    --max-size 5 \
    --vpc-zone-identifier "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling groups](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html)」を参照してください。  
**例 2: Application Load Balancer、Network Load Balancer、または Gateway Load Balancer をアタッチする方法**  
この例では、予想されるトラフィックをサポートするロードバランサーのターゲットグループの ARN を指定します。ヘルスチェックタイプは、Elastic Load Balancing がインスタンスを異常として報告したときに、Auto Scaling グループがそのインスタンスを置き換えるよう `ELB` を指定します。このコマンドは、ヘルスチェックの猶予期間 (`600` 秒) も定義します。猶予期間は、新しく起動したインスタンスが早期に終了するのを防ぐのに役立ちます。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-template LaunchTemplateId=lt-1234567890abcde12 \
    --target-group-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/943f017f100becff \
    --health-check-type ELB \
    --health-check-grace-period 600 \
    --min-size 1 \
    --max-size 5 \
    --vpc-zone-identifier "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Elastic Load Balancing を使用して Auto Scaling グループ内のインスタンス全体にトラフィックを分散させる](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html)」を参照してください。**  
**例 3: プレイスメントグループを指定し、起動テンプレートの最新バージョンを使用する方法**  
この例では、単一のアベイラビリティーゾーン内のプレイスメントグループ内でインスタンスを起動します。これは、HPC ワークロードを使用する低レイテンシーのグループに役立ちます。この例では、グループの最小サイズ、最大サイズ、希望する容量も指定しています。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-template LaunchTemplateId=lt-1234567890abcde12,Version='$Latest' \
    --min-size 1 \
    --max-size 5 \
    --desired-capacity 3 \
    --placement-group my-placement-group \
    --vpc-zone-identifier "subnet-6194ea3b"
```
このコマンドでは何も出力されません。  
詳細については、「*Linux インスタンス用 Amazon EC2 ユーザーガイド*」の「[プレイスメントグループ](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html)」を参照してください。  
**例 4: 単一のインスタンスの Auto Scaling グループを指定し、特定のバージョンの起動テンプレートを使用する方法**  
この例では、単一のインスタンスが強制的に実行されるように、最小容量と最大容量を `1` に設定した Auto Scaling グループを作成します。このコマンドは、既存の ENI の ID が指定されている起動テンプレートの v1 も指定します。eth0 の既存の ENI を指定する起動テンプレートを使用する際は、リクエストにサブネット ID を指定せずに、ネットワークインターフェイスと一致する Auto Scaling グループのアベイラビリティーゾーンを指定する必要があります。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg-single-instance \
    --launch-template LaunchTemplateName=my-template-for-auto-scaling,Version='1' \
    --min-size 1 \
    --max-size 1 \
    --availability-zones us-west-2a
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling groups](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html)」を参照してください。  
**例 5: 別の終了ポリシーを指定する方法**  
この例では、起動構成を使用して Auto Scaling グループを作成し、最も古いインスタンスを最初に終了するように終了ポリシーを構成します。またこのコマンドは、`Role` キーと `WebServer` 値を使用して、グループとインスタンスにタグを適用します。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-configuration-name my-lc \
    --min-size 1 \
    --max-size 5 \
    --termination-policies "OldestInstance" \
    --tags "ResourceId=my-asg,ResourceType=auto-scaling-group,Key=Role,Value=WebServer,PropagateAtLaunch=true" \
    --vpc-zone-identifier "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling 終了ポリシーを使用する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html)」を参照してください。**  
**例 6: 起動ライフサイクルフックを指定する方法**  
この例では、インスタンス起動時のカスタムアクションをサポートするライフサイクルフックで Auto Scaling グループを設定します。  

```
aws autoscaling create-auto-scaling-group \
    --cli-input-json file://~/config.json
```
`config.json` ファイルの内容。  

```
{
    "AutoScalingGroupName": "my-asg",
    "LaunchTemplate": {
        "LaunchTemplateId": "lt-1234567890abcde12"
    },
    "LifecycleHookSpecificationList": [{
        "LifecycleHookName": "my-launch-hook",
        "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING",
        "NotificationTargetARN": "arn:aws:sqs:us-west-2:123456789012:my-sqs-queue",
        "RoleARN": "arn:aws:iam::123456789012:role/my-notification-role",
        "NotificationMetadata": "SQS message metadata",
        "HeartbeatTimeout": 4800,
        "DefaultResult": "ABANDON"
    }],
    "MinSize": 1,
    "MaxSize": 5,
    "VPCZoneIdentifier": "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782",
    "Tags": [{
        "ResourceType": "auto-scaling-group",
        "ResourceId": "my-asg",
        "PropagateAtLaunch": true,
        "Value": "test",
        "Key": "environment"
    }]
}
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
**例 7: 終了ライフサイクルフックを指定する方法**  
次の例では、インスタンス終了時のカスタムアクションをサポートするライフサイクルフックで Auto Scaling グループを設定します。  

```
aws autoscaling create-auto-scaling-group \
    --cli-input-json file://~/config.json
```
`config.json` の内容:  

```
{
    "AutoScalingGroupName": "my-asg",
    "LaunchTemplate": {
        "LaunchTemplateId": "lt-1234567890abcde12"
    },
    "LifecycleHookSpecificationList": [{
        "LifecycleHookName": "my-termination-hook",
        "LifecycleTransition": "autoscaling:EC2_INSTANCE_TERMINATING",
        "HeartbeatTimeout": 120,
        "DefaultResult": "CONTINUE"
    }],
    "MinSize": 1,
    "MaxSize": 5,
    "TargetGroupARNs": [
        "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
    ],
    "VPCZoneIdentifier": "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
}
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
**例 8: カスタム終了ポリシーを指定する方法**  
この例では、スケールイン時にどのインスタンスを安全に終了できるかを Amazon EC2 Auto Scaling に指示するカスタム Lambda 関数終了ポリシーを指定する Auto Scaling グループを作成します。  

```
aws autoscaling create-auto-scaling-group \
    --auto-scaling-group-name my-asg-single-instance \
    --launch-template LaunchTemplateName=my-template-for-auto-scaling \
    --min-size 1 \
    --max-size 5 \
    --termination-policies "arn:aws:lambda:us-west-2:123456789012:function:HelloFunction:prod" \
    --vpc-zone-identifier "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Lambda を使用したカスタム終了ポリシーを作成する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lambda-custom-termination-policy.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス」の「[CreateAutoScalingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/create-auto-scaling-group.html)」を参照してください。*

### `create-launch-configuration`
<a name="auto-scaling_CreateLaunchConfiguration_cli_2_topic"></a>

次のコード例では、`create-launch-configuration` を使用する方法を示しています。

**AWS CLI**  
**例 1: 起動構成を作成する方法**  
この例では、シンプルな起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[起動構成の作成](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html)」を参照してください。  
**例 2: セキュリティグループ、キーペア、ブートストラッピングスクリプトを使用して起動構成を作成する方法**  
この例では、セキュリティグループ、キーペア、ユーザーデータに含まれるブートストラッピングスクリプトを使用して起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --security-groups sg-eb2af88example \
    --key-name my-key-pair \
    --user-data file://myuserdata.txt
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[起動構成の作成](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html)」を参照してください。  
**例 3: IAM ロールを使用して起動構成を作成する方法**  
この例では、IAM ロールのインスタンスプロファイル名を使用して起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --iam-instance-profile my-autoscaling-role
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 インスタンスで実行されるアプリケーションに対する IAM ロール](https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html)」を参照してください。  
**例 4: 起動構成で詳細モニタリングを有効にする方法**  
この例では、EC2 詳細モニタリングを有効にして起動構成を作成し、EC2 メトリクスを 1 分間隔で CloudWatch に送信します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --instance-monitoring Enabled=true
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling インスタンスのモニタリング設定](https://docs.aws.amazon.com/autoscaling/ec2/userguide/enable-as-instance-metrics.html)」をご参照ください。  
**例 5: スポットインスタンスを起動する起動構成を作成する方法**  
この例では、スポットインスタンスを唯一の購入オプションとして使用する起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --spot-price "0.50"
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[スポットインスタンスのリクエスト](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-launch-spot-instances.html)」を参照してください。  
**例 6: EC2 インスタンスを使用した起動構成を作成する方法**  
この例では、既存のインスタンスの属性に基づいて起動構成を作成します。これにより、プレイスメントテナンシーと、`--placement-tenancy` オプションと `--no-associate-public-ip-address`オプションを含めることでパブリック IP アドレスが設定されるかどうかが上書きされます。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc-from-instance \
    --instance-id i-0123a456700123456 \
    --instance-type m5.large \
    --no-associate-public-ip-address \
    --placement-tenancy dedicated
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[EC2 インスタンスを使用して起動構成を作成する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-lc-with-instanceID.html)」を参照してください。  
**例 7: Amazon EBS ボリュームのブロックデバイスマッピングを使用して起動構成を作成する方法**  
この例では、デバイス名「`/dev/sdh`」とボリュームサイズが 20 の Amazon EBS `gp3` ボリュームのブロックデバイスマッピングを使用して起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --block-device-mappings '[{"DeviceName":"/dev/sdh","Ebs":{"VolumeSize":20,"VolumeType":"gp3"}}]'
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling API リファレンス*」の「[EBS](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Ebs.html)」を参照してください。  
JSON 形式のパラメータ値を引用するための構文については、*AWS 「 コマンドラインインターフェイスユーザーガイド*」の[「CLI AWS での文字列での引用符の使用](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html)」を参照してください。  
**例 8: インスタンスストアボリュームのブロックデバイスマッピングを使用して起動構成を作成する方法**  
この例では、デバイス名「`/dev/sdc`」のインスタンスストアボリュームとして `ephemeral1` で起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --block-device-mappings '[{"DeviceName":"/dev/sdc","VirtualName":"ephemeral1"}]'
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling API リファレンス*」の「[BlockDeviceMapping](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_BlockDeviceMapping.html)」を参照してください。  
JSON 形式のパラメータ値を引用するための構文については、*AWS 「 コマンドラインインターフェイスユーザーガイド*」の[「CLI AWS での文字列での引用符の使用](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html)」を参照してください。  
**例 9: 起動構成を作成し、起動時にブロックデバイスがアタッチされないようにする方法**  
この例では、AMI のブロックデバイスマッピング（`/dev/sdf` など）で指定されたブロックデバイスを抑制する起動構成を作成します。  

```
aws autoscaling create-launch-configuration \
    --launch-configuration-name my-lc \
    --image-id ami-04d5cc9b88example \
    --instance-type m5.large \
    --block-device-mappings '[{"DeviceName":"/dev/sdf","NoDevice":""}]'
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling API リファレンス*」の「[BlockDeviceMapping](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_BlockDeviceMapping.html)」を参照してください。  
JSON 形式のパラメータ値を引用するための構文については、*AWS 「 コマンドラインインターフェイスユーザーガイド*」の[「CLI AWS での文字列での引用符の使用](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html)」を参照してください。  
+  API の詳細については、「AWS CLI コマンドリファレンス」の「[CreateLaunchConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/create-launch-configuration.html)」を参照してください。

### `create-or-update-tags`
<a name="auto-scaling_CreateOrUpdateTags_cli_2_topic"></a>

次のコード例では、`create-or-update-tags` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループのタグを作成または変更する方法**  
この例では、指定された Auto Scaling グループに 2 つのタグを追加します。  

```
aws autoscaling create-or-update-tags \
    --tags ResourceId=my-asg,ResourceType=auto-scaling-group,Key=Role,Value=WebServer,PropagateAtLaunch=true ResourceId=my-asg,ResourceType=auto-scaling-group,Key=Dept,Value=Research,PropagateAtLaunch=true
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスのタグ付け](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateOrUpdateTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/create-or-update-tags.html)」を参照してください。

### `delete-auto-scaling-group`
<a name="auto-scaling_DeleteAutoScalingGroup_cli_2_topic"></a>

次のコード例では、`delete-auto-scaling-group` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定された Auto Scaling グループを削除する方法**  
この例では、指定された Auto Scaling グループを削除します。  

```
aws autoscaling delete-auto-scaling-group \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling インフラストラクチャを削除する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html)」を参照してください。  
**例 2: 指定された Auto Scaling グループを強制的に削除する方法**  
グループ内のインスタンスが終了するのを待たずに Auto Scaling グループを削除するには、`--force-delete` オプションを使用します。  

```
aws autoscaling delete-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --force-delete
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling インフラストラクチャを削除する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteAutoScalingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-auto-scaling-group.html)」を参照してください。

### `delete-launch-configuration`
<a name="auto-scaling_DeleteLaunchConfiguration_cli_2_topic"></a>

次のコード例では、`delete-launch-configuration` を使用する方法を示しています。

**AWS CLI**  
**起動構成を削除する方法**  
この例では、指定された起動構成を削除します。  

```
aws autoscaling delete-launch-configuration \
    --launch-configuration-name my-launch-config
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling インフラストラクチャを削除する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteLaunchConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-launch-configuration.html)」を参照してください。

### `delete-lifecycle-hook`
<a name="auto-scaling_DeleteLifecycleHook_cli_2_topic"></a>

次のコード例では、`delete-lifecycle-hook` を使用する方法を示しています。

**AWS CLI**  
**ライフサイクルフックを削除する方法**  
指定されたライフサイクルフックを削除します。  

```
aws autoscaling delete-lifecycle-hook \
    --lifecycle-hook-name my-lifecycle-hook \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteLifecycleHook](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-lifecycle-hook.html)」を参照してください。

### `delete-notification-configuration`
<a name="auto-scaling_DeleteNotificationConfiguration_cli_2_topic"></a>

次のコード例では、`delete-notification-configuration` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling 通知を削除する方法**  
この例では、指定された Auto Scaling グループから指定された通知を削除します。  

```
aws autoscaling delete-notification-configuration \
    --auto-scaling-group-name my-asg \
    --topic-arn arn:aws:sns:us-west-2:123456789012:my-sns-topic
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[通知設定を削除する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html#delete-settingupnotifications)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteNotificationConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-notification-configuration.html)」を参照してください。

### `delete-policy`
<a name="auto-scaling_DeletePolicy_cli_2_topic"></a>

次のコード例では、`delete-policy` を使用する方法を示しています。

**AWS CLI**  
**スケーリングポリシーを削除する方法**  
この例では、指定されたスケーリングポリシーを削除します。  

```
aws autoscaling delete-policy \
    --auto-scaling-group-name my-asg \
    --policy-name alb1000-target-tracking-scaling-policy
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeletePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-policy.html)」を参照してください。

### `delete-scheduled-action`
<a name="auto-scaling_DeleteScheduledAction_cli_2_topic"></a>

次のコード例では、`delete-scheduled-action` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループ用のスケジュール済みのアクションを削除する方法**  
この例では、指定された Auto Scaling グループから指定されたスケジュール済みの通知を削除します。  

```
aws autoscaling delete-scheduled-action \
    --auto-scaling-group-name my-asg \
    --scheduled-action-name my-scheduled-action
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteScheduledAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-scheduled-action.html)」を参照してください。

### `delete-tags`
<a name="auto-scaling_DeleteTags_cli_2_topic"></a>

次のコード例では、`delete-tags` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループからタグを削除する方法**  
この例では、指定された Auto Scaling グループから指定されたタグを削除します。  

```
aws autoscaling delete-tags \
    --tags ResourceId=my-asg,ResourceType=auto-scaling-group,Key=Dept,Value=Research
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスのタグ付け](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-tags.html)」を参照してください。

### `delete-warm-pool`
<a name="auto-scaling_DeleteWarmPool_cli_2_topic"></a>

次のコード例では、`delete-warm-pool` を使用する方法を示しています。

**AWS CLI**  
**例 1: ウォームプールを削除する方法**  
次の例では、指定された Auto Scaling グループのウォームプールを削除します。  

```
aws autoscaling delete-warm-pool \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Warm pools for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html)」を参照してください。  
**例 2: ウォームプールを強制的に削除する方法**  
インスタンスが終了するのを待たずにウォームプールを削除するには、`--force-delete` オプションを使用します。  

```
aws autoscaling delete-warm-pool \
    --auto-scaling-group-name my-asg \
    --force-delete
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Warm pools for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteWarmPool](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/delete-warm-pool.html)」を参照してください。

### `describe-account-limits`
<a name="auto-scaling_DescribeAccountLimits_cli_2_topic"></a>

次のコード例では、`describe-account-limits` を使用する方法を示しています。

**AWS CLI**  
**Amazon EC2 Auto Scaling アカウントの制限を記述する方法**  
この例では、 AWS アカウントの Amazon EC2 Auto Scaling の制限について説明します。  

```
aws autoscaling describe-account-limits
```
出力:  

```
{
    "NumberOfLaunchConfigurations": 5,
    "MaxNumberOfLaunchConfigurations": 100,
    "NumberOfAutoScalingGroups": 3,
    "MaxNumberOfAutoScalingGroups": 20
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Amazon EC2 Auto Scaling Service Quotas](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeAccountLimits](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-account-limits.html)」を参照してください。

### `describe-adjustment-types`
<a name="auto-scaling_DescribeAdjustmentTypes_cli_2_topic"></a>

次のコード例では、`describe-adjustment-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能なスケーリング調整タイプを記述する方法**  
この例では、使用可能な調整タイプについて記述します。  

```
aws autoscaling describe-adjustment-types
```
出力:  

```
{
    "AdjustmentTypes": [
        {
            "AdjustmentType": "ChangeInCapacity"
        },
        {
            "AdjustmentType": "ExactCapacity"
        },
        {
            "AdjustmentType": "PercentChangeInCapacity"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[スケーリング調整タイプ](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeAdjustmentTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-adjustment-types.html)」を参照してください。

### `describe-auto-scaling-groups`
<a name="auto-scaling_DescribeAutoScalingGroups_cli_2_topic"></a>

次のコード例では、`describe-auto-scaling-groups` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定された Auto Scaling グループを記述する方法**  
この例では、指定された Auto Scaling グループを記述します。  

```
aws autoscaling describe-auto-scaling-groups \
    --auto-scaling-group-names my-asg
```
出力:  

```
{
    "AutoScalingGroups": [
        {
            "AutoScalingGroupName": "my-asg",
            "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:930d940e-891e-4781-a11a-7b0acd480f03:autoScalingGroupName/my-asg",
            "LaunchTemplate": {
                "LaunchTemplateName": "my-launch-template",
                "Version": "1",
                "LaunchTemplateId": "lt-1234567890abcde12"
            },
            "MinSize": 0,
            "MaxSize": 1,
            "DesiredCapacity": 1,
            "DefaultCooldown": 300,
            "AvailabilityZones": [
                "us-west-2a",
                "us-west-2b",
                "us-west-2c"
            ],
            "LoadBalancerNames": [],
            "TargetGroupARNs": [],
            "HealthCheckType": "EC2",
            "HealthCheckGracePeriod": 0,
            "Instances": [
                {
                    "InstanceId": "i-06905f55584de02da",
                    "InstanceType": "t2.micro",
                    "AvailabilityZone": "us-west-2a",
                    "HealthStatus": "Healthy",
                    "LifecycleState": "InService",
                    "ProtectedFromScaleIn": false,
                    "LaunchTemplate": {
                        "LaunchTemplateName": "my-launch-template",
                        "Version": "1",
                        "LaunchTemplateId": "lt-1234567890abcde12"
                    }
                }
            ],
            "CreatedTime": "2023-10-28T02:39:22.152Z",
            "SuspendedProcesses": [],
            "VPCZoneIdentifier": "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782",
            "EnabledMetrics": [],
            "Tags": [],
            "TerminationPolicies": [
                "Default"
            ],
            "NewInstancesProtectedFromScaleIn": false,
            "ServiceLinkedRoleARN":"arn",
            "TrafficSources": []
        }
    ]
}
```
**例 2: 指定された最初の 100 個の Auto Scaling グループを記述する方法**  
この例では、指定された複数の Auto Scaling グループを記述します。最大 100 個のグループ名を指定できます。  

```
aws autoscaling describe-auto-scaling-groups \
    --max-items 100 \
    --auto-scaling-group-names "group1" "group2" "group3" "group4"
```
出力例については、例 1 を参照してください。  
**例 3: 指定されたリージョンの Auto Scaling グループを記述する方法**  
この例では、指定されたリージョンの Auto Scaling グループを最大 75 グループまで記述します。  

```
aws autoscaling describe-auto-scaling-groups \
    --max-items 75 \
    --region us-east-1
```
出力例については、例 1 を参照してください。  
**例 4: 指定された数の Auto Scaling グループを記述する方法**  
特定の数の Auto Scaling グループを返すには、`--max-items` オプションを使用します。  

```
aws autoscaling describe-auto-scaling-groups \
    --max-items 1
```
出力例については、例 1 を参照してください。  
出力に `NextToken` フィールドが含まれている場合は、さらに多くのグループがあることを示しています。追加のグループを取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-auto-scaling-groups \
    --starting-token Z3M3LMPEXAMPLE
```
出力例については、例 1 を参照してください。  
**例 5: 起動構成を使用している Auto Scaling グループを記述する方法**  
この例では、 `--query` オプションを使用して、起動構成を使用する Auto Scaling グループを記述します。  

```
aws autoscaling describe-auto-scaling-groups \
    --query 'AutoScalingGroups[?LaunchConfigurationName!=`null`]'
```
出力:  

```
[
    {
        "AutoScalingGroupName": "my-asg",
        "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:930d940e-891e-4781-a11a-7b0acd480f03:autoScalingGroupName/my-asg",
        "LaunchConfigurationName": "my-lc",
        "MinSize": 0,
        "MaxSize": 1,
        "DesiredCapacity": 1,
        "DefaultCooldown": 300,
        "AvailabilityZones": [
            "us-west-2a",
            "us-west-2b",
            "us-west-2c"
        ],
        "LoadBalancerNames": [],
        "TargetGroupARNs": [],
        "HealthCheckType": "EC2",
        "HealthCheckGracePeriod": 0,
        "Instances": [
            {
                "InstanceId": "i-088c57934a6449037",
                "InstanceType": "t2.micro",
                "AvailabilityZone": "us-west-2c",
                "HealthStatus": "Healthy",
                "LifecycleState": "InService",
                "LaunchConfigurationName": "my-lc",
                "ProtectedFromScaleIn": false
            }
        ],
        "CreatedTime": "2023-10-28T02:39:22.152Z",
        "SuspendedProcesses": [],
        "VPCZoneIdentifier": "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782",
        "EnabledMetrics": [],
        "Tags": [],
        "TerminationPolicies": [
            "Default"
        ],
        "NewInstancesProtectedFromScaleIn": false,
        "ServiceLinkedRoleARN":"arn",
        "TrafficSources": []
    }
]
```
詳細については、*AWS 「 コマンドラインインターフェイスユーザーガイド」の*[「フィルタ AWS CLI 出力](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html)」を参照してください。  
+  API の詳細については、AWS CLI コマンドリファレンスの「[DescribeAutoScalingGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-auto-scaling-groups.html)」を参照してください。**

### `describe-auto-scaling-instances`
<a name="auto-scaling_DescribeAutoScalingInstances_cli_2_topic"></a>

次のコード例では、`describe-auto-scaling-instances` を使用する方法を示しています。

**AWS CLI**  
**例 1: 1 つまたは複数のインスタンスを記述する方法**  
この例では、指定されたインスタンスを記述します。  

```
aws autoscaling describe-auto-scaling-instances \
    --instance-ids i-06905f55584de02da
```
出力:  

```
{
    "AutoScalingInstances": [
        {
            "InstanceId": "i-06905f55584de02da",
            "InstanceType": "t2.micro",
            "AutoScalingGroupName": "my-asg",
            "AvailabilityZone": "us-west-2b",
            "LifecycleState": "InService",
            "HealthStatus": "HEALTHY",
            "ProtectedFromScaleIn": false,
            "LaunchTemplate": {
                "LaunchTemplateId": "lt-1234567890abcde12",
                "LaunchTemplateName": "my-launch-template",
                "Version": "1"
            }
        }
    ]
}
```
**例 2: 1 つまたは複数のインスタンスを記述する方法**  
この例では、`--max-items` オプションを使用して、この呼び出しで返されるインスタンスの数を指定します。  

```
aws autoscaling describe-auto-scaling-instances \
    --max-items 1
```
出力に `NextToken` フィールドが含まれている場合は、さらに多くのインスタンスがあることを示しています。追加のインスタンスを取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-auto-scaling-instances \
    --starting-token Z3M3LMPEXAMPLE
```
出力例については、例 1 を参照してください。  
**例 3: 起動構成を使用するインスタンスを記述する方法**  
この例では、 `--query` オプションを使用して、起動構成を使用するインスタンスを記述します。  

```
aws autoscaling describe-auto-scaling-instances \
    --query 'AutoScalingInstances[?LaunchConfigurationName!=`null`]'
```
出力:  

```
[
    {
        "InstanceId": "i-088c57934a6449037",
        "InstanceType": "t2.micro",
        "AutoScalingGroupName": "my-asg",
        "AvailabilityZone": "us-west-2c",
        "LifecycleState": "InService",
        "HealthStatus": "HEALTHY",
        "LaunchConfigurationName": "my-lc",
        "ProtectedFromScaleIn": false
    }
]
```
詳細については、*AWS 「 コマンドラインインターフェイスユーザーガイド」の*[「フィルタ AWS CLI 出力](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html)」を参照してください。  
+  API の詳細については、AWS CLI コマンドリファレンスの「[DescribeAutoScalingInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-auto-scaling-instances.html)」を参照してください。**

### `describe-auto-scaling-notification-types`
<a name="auto-scaling_DescribeAutoScalingNotificationTypes_cli_2_topic"></a>

次のコード例では、`describe-auto-scaling-notification-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能な通知タイプを記述する方法**  
この例では、使用可能な通知タイプについて記述します。  

```
aws autoscaling describe-auto-scaling-notification-types
```
出力:  

```
{
    "AutoScalingNotificationTypes": [
        "autoscaling:EC2_INSTANCE_LAUNCH",
        "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
        "autoscaling:EC2_INSTANCE_TERMINATE",
        "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
        "autoscaling:TEST_NOTIFICATION"
    ]
}
```
詳細については、『*Amazon EC2 Auto Scaling ユーザーガイド*』の「[Auto Scaling グループのスケーリング時の Amazon SNS 通知の取得](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeAutoScalingNotificationTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-auto-scaling-notification-types.html)」を参照してください。

### `describe-instance-refreshes`
<a name="auto-scaling_DescribeInstanceRefreshes_cli_2_topic"></a>

次のコード例では、`describe-instance-refreshes` を使用する方法を示しています。

**AWS CLI**  
**インスタンスの更新を記述する方法**  
次の `describe-instance-refreshes` の例では、ステータスメッセージ (利用可能な場合) やステータス理由など、指定された Auto Scaling グループのすべてのインスタンス更新リクエストの記述を返します。  

```
aws autoscaling describe-instance-refreshes \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "InstanceRefreshes": [
        {
            "InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b",
            "AutoScalingGroupName": "my-asg",
            "Status": "InProgress",
            "StatusReason": "Waiting for instances to warm up before continuing. For example: 0e69cc3f05f825f4f is warming up.",
            "EndTime": "2023-03-23T16:42:55Z",
            "PercentageComplete": 0,
            "InstancesToUpdate": 0,
    "Preferences": {
                "MinHealthyPercentage": 100,
                "InstanceWarmup": 300,
                "CheckpointPercentages": [
                    50
                ],
                "CheckpointDelay": 3600,
                "SkipMatching": false,
                "AutoRollback": true,
                "ScaleInProtectedInstances": "Ignore",
                "StandbyInstances": "Ignore"
            }
        },
        {
            "InstanceRefreshId": "dd7728d0-5bc4-4575-96a3-1b2c52bf8bb1",
            "AutoScalingGroupName": "my-asg",
            "Status": "Successful",
            "EndTime": "2022-06-02T16:53:37Z",
            "PercentageComplete": 100,
            "InstancesToUpdate": 0,
    "Preferences": {
                "MinHealthyPercentage": 90,
                "InstanceWarmup": 300,
                "SkipMatching": true,
                "AutoRollback": true,
                "ScaleInProtectedInstances": "Ignore",
                "StandbyInstances": "Ignore"
            }
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[インスタンスの更新のステータスを確認](https://docs.aws.amazon.com/en_us/autoscaling/ec2/userguide/check-status-instance-refresh.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeInstanceRefreshes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-instance-refreshes.html)」を参照してください。

### `describe-launch-configurations`
<a name="auto-scaling_DescribeLaunchConfigurations_cli_2_topic"></a>

次のコード例では、`describe-launch-configurations` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定された起動構成を記述する方法**  
この例では、指定された起動構成について記述します。  

```
aws autoscaling describe-launch-configurations \
    --launch-configuration-names my-launch-config
```
出力:  

```
{
    "LaunchConfigurations": [
        {
            "LaunchConfigurationName": "my-launch-config",
            "LaunchConfigurationARN": "arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config",
            "ImageId": "ami-0528a5175983e7f28",
            "KeyName": "my-key-pair-uswest2",
            "SecurityGroups": [
                "sg-05eaec502fcdadc2e"
            ],
            "ClassicLinkVPCSecurityGroups": [],
            "UserData": "",
            "InstanceType": "t2.micro",
            "KernelId": "",
            "RamdiskId": "",
            "BlockDeviceMappings": [
                {
                    "DeviceName": "/dev/xvda",
                    "Ebs": {
                        "SnapshotId": "snap-06c1606ba5ca274b1",
                        "VolumeSize": 8,
                        "VolumeType": "gp2",
                        "DeleteOnTermination": true,
                        "Encrypted": false
                    }
                }
            ],
            "InstanceMonitoring": {
                "Enabled": true
            },
            "CreatedTime": "2020-10-28T02:39:22.321Z",
            "EbsOptimized": false,
            "AssociatePublicIpAddress": true,
            "MetadataOptions": {
                "HttpTokens": "required",
                "HttpPutResponseHopLimit": 1,
                "HttpEndpoint": "disabled"
            }
        }
    ]
}
```
**例 2: 指定された数の起動構成を記述する方法**  
特定の数の起動構成を返すには、 `--max-items` オプションを使用します。  

```
aws autoscaling describe-launch-configurations \
    --max-items 1
```
出力に `NextToken` フィールドが含まれている場合、起動構成がさらに増えます。追加の起動構成を取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-launch-configurations \
    --starting-token Z3M3LMPEXAMPLE
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeLaunchConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-launch-configurations.html)」を参照してください。

### `describe-lifecycle-hook-types`
<a name="auto-scaling_DescribeLifecycleHookTypes_cli_2_topic"></a>

次のコード例では、`describe-lifecycle-hook-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能なライフサイクルフックのタイプを記述します。**  
この例では、使用可能なライフサイクルフックのタイプを記述します。  

```
aws autoscaling describe-lifecycle-hook-types
```
出力:  

```
{
    "LifecycleHookTypes": [
        "autoscaling:EC2_INSTANCE_LAUNCHING",
        "autoscaling:EC2_INSTANCE_TERMINATING"
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeLifecycleHookTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-lifecycle-hook-types.html)」を参照してください。

### `describe-lifecycle-hooks`
<a name="auto-scaling_DescribeLifecycleHooks_cli_2_topic"></a>

次のコード例では、`describe-lifecycle-hooks` を使用する方法を示しています。

**AWS CLI**  
**ライフサイクルフックを記述する方法**  
指定された Auto Scaling グループのライフサイクルフックを記述します。  

```
aws autoscaling describe-lifecycle-hooks \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "LifecycleHooks": [
        {
            "GlobalTimeout": 3000,
            "HeartbeatTimeout": 30,
            "AutoScalingGroupName": "my-asg",
            "LifecycleHookName": "my-launch-hook",
            "DefaultResult": "ABANDON",
            "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING"
        },
        {
            "GlobalTimeout": 6000,
            "HeartbeatTimeout": 60,
            "AutoScalingGroupName": "my-asg",
            "LifecycleHookName": "my-termination-hook",
            "DefaultResult": "CONTINUE",
            "LifecycleTransition": "autoscaling:EC2_INSTANCE_TERMINATING"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeLifecycleHooks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-lifecycle-hooks.html)」を参照してください。

### `describe-load-balancer-target-groups`
<a name="auto-scaling_DescribeLoadBalancerTargetGroups_cli_2_topic"></a>

次のコード例では、`describe-load-balancer-target-groups` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループのロードバランサーターゲットグループを記述する方法**  
この例では、指定された Auto Scaling グループにアタッチされたロードバランサーターゲットグループを記述します。  

```
aws autoscaling describe-load-balancer-target-groups \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "LoadBalancerTargetGroups": [
        {
            "LoadBalancerTargetGroupARN": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
            "State": "Added"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeLoadBalancerTargetGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-load-balancer-target-groups.html)」を参照してください。

### `describe-load-balancers`
<a name="auto-scaling_DescribeLoadBalancers_cli_2_topic"></a>

次のコード例では、`describe-load-balancers` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループのClassic Load Balancerを記述する方法**  
指定された Auto Scaling グループの Classic Load Balancer を記述します。  

```
aws autoscaling describe-load-balancers \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "LoadBalancers": [
        {
            "State": "Added",
            "LoadBalancerName": "my-load-balancer"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeLoadBalancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-load-balancers.html)」を参照してください。

### `describe-metric-collection-types`
<a name="auto-scaling_DescribeMetricCollectionTypes_cli_2_topic"></a>

次のコード例では、`describe-metric-collection-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能なメトリクスコレクションタイプを記述する方法**  
この例では、使用可能なメトリクスコレクションタイプについて記述します。  

```
aws autoscaling describe-metric-collection-types
```
出力:  

```
{
    "Metrics": [
        {
            "Metric": "GroupMinSize"
        },
        {
            "Metric": "GroupMaxSize"
        },
        {
            "Metric": "GroupDesiredCapacity"
        },
        {
            "Metric": "GroupInServiceInstances"
        },
        {
            "Metric": "GroupInServiceCapacity"
        },
        {
            "Metric": "GroupPendingInstances"
        },
        {
            "Metric": "GroupPendingCapacity"
        },
        {
            "Metric": "GroupTerminatingInstances"
        },
        {
            "Metric": "GroupTerminatingCapacity"
        },
        {
            "Metric": "GroupStandbyInstances"
        },
        {
            "Metric": "GroupStandbyCapacity"
        },
        {
            "Metric": "GroupTotalInstances"
        },
        {
            "Metric": "GroupTotalCapacity"
        }
    ],
    "Granularities": [
        {
            "Granularity": "1Minute"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling group metrics](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html#as-group-metrics)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeMetricCollectionTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-metric-collection-types.html)」を参照してください。

### `describe-notification-configurations`
<a name="auto-scaling_DescribeNotificationConfigurations_cli_2_topic"></a>

次のコード例では、`describe-notification-configurations` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定されたグループの通知構成を記述する方法**  
この例では、指定された Auto Scaling グループの通知構成を記述します。  

```
aws autoscaling describe-notification-configurations \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "NotificationConfigurations": [
        {
            "AutoScalingGroupName": "my-asg",
            "NotificationType": "autoscaling:TEST_NOTIFICATION",
            "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic-2"
        },
        {
            "AutoScalingGroupName": "my-asg",
            "NotificationType": "autoscaling:TEST_NOTIFICATION",
            "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic"
        }
    ]
}
```
詳細については、『*Amazon EC2 Auto Scaling ユーザーガイド*』の「[Auto Scaling グループのスケーリング時の Amazon SNS 通知の取得](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html)」を参照してください。  
**例 1: 指定された数の通知構成を記述する方法**  
特定の数の通知構成を返すには、 `max-items` パラメータを使用します。  

```
aws autoscaling describe-notification-configurations \
    --auto-scaling-group-name my-auto-scaling-group \
    --max-items 1
```
出力:  

```
{
    "NotificationConfigurations": [
        {
            "AutoScalingGroupName": "my-asg",
            "NotificationType": "autoscaling:TEST_NOTIFICATION",
            "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic-2"
        },
        {
            "AutoScalingGroupName": "my-asg",
            "NotificationType": "autoscaling:TEST_NOTIFICATION",
            "TopicARN": "arn:aws:sns:us-west-2:123456789012:my-sns-topic"
        }
    ]
}
```
出力に `NextToken` フィールドが含まれている場合、通知構成がさらに増えます。追加の通知構成を取得するには、次のように、以降の呼び出しで `starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-notification-configurations \
    --auto-scaling-group-name my-asg \
    --starting-token Z3M3LMPEXAMPLE
```
詳細については、『*Amazon EC2 Auto Scaling ユーザーガイド*』の「[Auto Scaling グループのスケーリング時の Amazon SNS 通知の取得](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeNotificationConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-notification-configurations.html)」を参照してください。

### `describe-policies`
<a name="auto-scaling_DescribePolicies_cli_2_topic"></a>

次のコード例では、`describe-policies` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定されたグループのスケーリングポリシーを記述する方法**  
この例では、指定された Auto Scaling グループのスケーリングポリシーを記述します。  

```
aws autoscaling describe-policies \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "ScalingPolicies": [
        {
            "AutoScalingGroupName": "my-asg",
            "PolicyName": "alb1000-target-tracking-scaling-policy",
            "PolicyARN": "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:3065d9c8-9969-4bec-bb6a-3fbe5550fde6:autoScalingGroupName/my-asg:policyName/alb1000-target-tracking-scaling-policy",
            "PolicyType": "TargetTrackingScaling",
            "StepAdjustments": [],
            "Alarms": [
                {
                    "AlarmName": "TargetTracking-my-asg-AlarmHigh-924887a9-12d7-4e01-8686-6f844d13a196",
                    "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-924887a9-12d7-4e01-8686-6f844d13a196"
                },
                {
                    "AlarmName": "TargetTracking-my-asg-AlarmLow-f96f899d-b8e7-4d09-a010-c1aaa35da296",
                    "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-f96f899d-b8e7-4d09-a010-c1aaa35da296"
                }
            ],
            "TargetTrackingConfiguration": {
                "PredefinedMetricSpecification": {
                    "PredefinedMetricType": "ALBRequestCountPerTarget",
                    "ResourceLabel": "app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff"
                },
                "TargetValue": 1000.0,
                "DisableScaleIn": false
            },
            "Enabled": true
        },
        {
            "AutoScalingGroupName": "my-asg",
            "PolicyName": "cpu40-target-tracking-scaling-policy",
            "PolicyARN": "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:5fd26f71-39d4-4690-82a9-b8515c45cdde:autoScalingGroupName/my-asg:policyName/cpu40-target-tracking-scaling-policy",
            "PolicyType": "TargetTrackingScaling",
            "StepAdjustments": [],
            "Alarms": [
                {
                    "AlarmName": "TargetTracking-my-asg-AlarmHigh-139f9789-37b9-42ad-bea5-b5b147d7f473",
                    "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-139f9789-37b9-42ad-bea5-b5b147d7f473"
                },
                {
                    "AlarmName": "TargetTracking-my-asg-AlarmLow-bd681c67-fc18-4c56-8468-fb8e413009c9",
                    "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-bd681c67-fc18-4c56-8468-fb8e413009c9"
                }
            ],
            "TargetTrackingConfiguration": {
                "PredefinedMetricSpecification": {
                    "PredefinedMetricType": "ASGAverageCPUUtilization"
                },
                "TargetValue": 40.0,
                "DisableScaleIn": false
            },
            "Enabled": true
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[ダイナミックスケーリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html)」を参照してください。  
**例 2: 指定された名前のスケーリングポリシーを記述する方法**  
特定のスケーリングポリシーを返すには、 `--policy-names` オプションを使用します。  

```
aws autoscaling describe-policies \
    --auto-scaling-group-name my-asg \
    --policy-names cpu40-target-tracking-scaling-policy
```
出力例については、例 1 を参照してください。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[ダイナミックスケーリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html)を参照してください。  
**例 3: スケーリングポリシーの数を記述する方法**  
特定の数のポリシーを返すには、`--max-items` オプションを使用します。  

```
aws autoscaling describe-policies \
    --auto-scaling-group-name my-asg \
    --max-items 1
```
出力例については、例 1 を参照してください。  
出力に `NextToken` フィールドが含まれている場合は、後続の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用し、追加のポリシーを取得します。  

```
aws autoscaling describe-policies --auto-scaling-group-name my-asg --starting-token Z3M3LMPEXAMPLE
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[ダイナミックスケーリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html)を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribePolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-policies.html)」を参照してください。

### `describe-scaling-activities`
<a name="auto-scaling_DescribeScalingActivities_cli_2_topic"></a>

次のコード例では、`describe-scaling-activities` を使用する方法を示しています。

**AWS CLI**  
**例 1: 指定されたグループのスケーリングアクティビティを記述する方法**  
この例では、指定された Auto Scaling グループのスケーリングアクティビティを記述します。  

```
aws autoscaling describe-scaling-activities \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "f9f2d65b-f1f2-43e7-b46d-d86756459699",
            "Description": "Launching a new EC2 instance: i-0d44425630326060f",
            "AutoScalingGroupName": "my-asg",
            "Cause": "At 2020-10-30T19:35:51Z a user request update of AutoScalingGroup constraints to min: 0, max: 16, desired: 16 changing the desired capacity from 0 to 16.  At 2020-10-30T19:36:07Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 16.",
            "StartTime": "2020-10-30T19:36:09.766Z",
            "EndTime": "2020-10-30T19:36:41Z",
            "StatusCode": "Successful",
            "Progress": 100,
            "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"}"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Verify a scaling activity for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-verify-scaling-activity.html)」を参照してください。  
**例 2: 削除されたグループのスケーリングアクティビティを記述する方法**  
Auto Scaling グループが削除された後にスケーリングアクティビティを説明するには、`--include-deleted-groups` オプションを追加します。  

```
aws autoscaling describe-scaling-activities \
    --auto-scaling-group-name my-asg \
    --include-deleted-groups
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "e1f5de0e-f93e-1417-34ac-092a76fba220",
            "Description": "Launching a new EC2 instance.  Status Reason: Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.",
            "AutoScalingGroupName": "my-asg",
            "Cause": "At 2021-01-13T20:47:24Z a user request update of AutoScalingGroup constraints to min: 1, max: 5, desired: 3 changing the desired capacity from 0 to 3.  At 2021-01-13T20:47:27Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 3.",
            "StartTime": "2021-01-13T20:47:30.094Z",
            "EndTime": "2021-01-13T20:47:30Z",
            "StatusCode": "Failed",
            "StatusMessage": "Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.",
            "Progress": 100,
            "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"}",
            "AutoScalingGroupState": "Deleted",
            "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:283179a2-f3ce-423d-93f6-66bb518232f7:autoScalingGroupName/my-asg"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling をトラブルシューティングする](https://docs.aws.amazon.com/autoscaling/ec2/userguide/CHAP_Troubleshooting.html)」を参照してください。**  
**例 3: 指定された数のスケーリングアクティビティを記述する方法**  
特定の数のアクティビティを返すには、`--max-items` オプションを使用します。  

```
aws autoscaling describe-scaling-activities \
    --max-items 1
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "f9f2d65b-f1f2-43e7-b46d-d86756459699",
            "Description": "Launching a new EC2 instance: i-0d44425630326060f",
            "AutoScalingGroupName": "my-asg",
            "Cause": "At 2020-10-30T19:35:51Z a user request update of AutoScalingGroup constraints to min: 0, max: 16, desired: 16 changing the desired capacity from 0 to 16.  At 2020-10-30T19:36:07Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 16.",
            "StartTime": "2020-10-30T19:36:09.766Z",
            "EndTime": "2020-10-30T19:36:41Z",
            "StatusCode": "Successful",
            "Progress": 100,
            "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"}"
        }
    ]
}
```
出力に `NextToken` フィールドが含まれている場合は、さらに多くのアクティビティがあることを示しています。追加のアクティビティを取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-scaling-activities \
    --starting-token Z3M3LMPEXAMPLE
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Verify a scaling activity for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-verify-scaling-activity.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeScalingActivities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-scaling-activities.html)」を参照してください。

### `describe-scaling-process-types`
<a name="auto-scaling_DescribeScalingProcessTypes_cli_2_topic"></a>

次のコード例では、`describe-scaling-process-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能なプロセスタイプを記述する方法**  
この例では、使用可能なプロセスタイプを記述します。  

```
aws autoscaling describe-scaling-process-types
```
出力:  

```
{
    "Processes": [
        {
            "ProcessName": "AZRebalance"
        },
        {
            "ProcessName": "AddToLoadBalancer"
        },
        {
            "ProcessName": "AlarmNotification"
        },
        {
            "ProcessName": "HealthCheck"
        },
        {
            "ProcessName": "InstanceRefresh"
        },
        {
            "ProcessName": "Launch"
        },
        {
            "ProcessName": "ReplaceUnhealthy"
        },
        {
            "ProcessName": "ScheduledActions"
        },
        {
            "ProcessName": "Terminate"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[スケーリングプロセスの中断と再開](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeScalingProcessTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-scaling-process-types.html)」を参照してください。

### `describe-scheduled-actions`
<a name="auto-scaling_DescribeScheduledActions_cli_2_topic"></a>

次のコード例では、`describe-scheduled-actions` を使用する方法を示しています。

**AWS CLI**  
**例 1: スケジュール済みのすべてのアクションを記述する方法**  
この例では、スケジュール済みのすべてのアクションを記述します。  

```
aws autoscaling describe-scheduled-actions
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 2: 指定されたグループのスケジュール済みのアクションを記述する方法**  
特定の Auto Scaling グループのスケジュール済みのアクションを説明するには、 `--auto-scaling-group-name` オプションを使用します。  

```
aws autoscaling describe-scheduled-actions \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 3: 指定されたスケジュール済みのアクションを記述する方法**  
特定のスケジュール済みのアクションを説明するには、`--scheduled-action-names` オプションを使用します。  

```
aws autoscaling describe-scheduled-actions \
    --scheduled-action-names my-recurring-action
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 4: 指定された開始時刻でスケジュール済みのアクションを記述する方法**  
特定の時間に開始されるスケジュール済みのアクションを説明するには、`--start-time` オプションを使用します。  

```
aws autoscaling describe-scheduled-actions \
    --start-time "2023-12-01T04:00:00Z"
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 5: 指定された時間に終了するスケジュール済みのアクションを記述する方法**  
特定の時間に終了するスケジュール済みのアクションを説明するには、`--end-time` オプションを使用します。  

```
aws autoscaling describe-scheduled-actions \
    --end-time "2023-12-01T04:00:00Z"
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 6: 指定された数のスケーリングアクティビティを記述する方法**  
特定の数のアクティビティを返すには、`--max-items` オプションを使用します。  

```
aws autoscaling describe-scheduled-actions \
    --auto-scaling-group-name my-asg \
    --max-items 1
```
出力:  

```
{
    "ScheduledUpdateGroupActions": [
        {
            "AutoScalingGroupName": "my-asg",
            "ScheduledActionName": "my-recurring-action",
            "Recurrence": "30 0 1 1,6,12 *",
            "ScheduledActionARN": "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-asg:scheduledActionName/my-recurring-action",
            "StartTime": "2023-12-01T04:00:00Z",
            "Time": "2023-12-01T04:00:00Z",
            "MinSize": 1,
            "MaxSize": 6,
            "DesiredCapacity": 4,
            "TimeZone": "America/New_York"
        }
    ]
}
```
出力に `NextToken` フィールドが含まれている場合は、さらに多くのスケジュール済みのアクションがあることを示しています。追加のスケジュール済みのアクションを取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-scheduled-actions \
    --auto-scaling-group-name my-asg \
    --starting-token Z3M3LMPEXAMPLE
```
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Scheduled scaling (スケジュールされたスケーリング)](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeScheduledActions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-scheduled-actions.html)」を参照してください。

### `describe-tags`
<a name="auto-scaling_DescribeTags_cli_2_topic"></a>

次のコード例では、`describe-tags` を使用する方法を示しています。

**AWS CLI**  
**すべてのタグを記述する方法**  
この例では、すべてのタグを記述します。  

```
aws autoscaling describe-tags
```
出力:  

```
{
    "Tags": [
        {
            "ResourceType": "auto-scaling-group",
            "ResourceId": "my-asg",
            "PropagateAtLaunch": true,
            "Value": "Research",
            "Key": "Dept"
        },
        {
            "ResourceType": "auto-scaling-group",
            "ResourceId": "my-asg",
            "PropagateAtLaunch": true,
            "Value": "WebServer",
            "Key": "Role"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスのタグ付け](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html)」を参照してください。  
**例 2: 指定されたグループのタグを記述する方法**  
特定の Auto Scaling グループのタグを説明するには、`--filters` オプションを使用します。  

```
aws autoscaling describe-tags --filters Name=auto-scaling-group,Values=my-asg
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスのタグ付け](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html)」を参照してください。  
**例 3: 指定された数のタグを記述する方法**  
特定の数のタグを返すには、`--max-items` オプションを使用します。  

```
aws autoscaling describe-tags \
    --max-items 1
```
出力に `NextToken` フィールドが含まれている場合は、さらに多くのタグがあることを示しています。追加のタグを取得するには、次のように、以降の呼び出しで `--starting-token` オプションを使用してこのフィールドの値を使用します。  

```
aws autoscaling describe-tags \
    --filters Name=auto-scaling-group,Values=my-asg \
    --starting-token Z3M3LMPEXAMPLE
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスのタグ付け](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-tags.html)」を参照してください。

### `describe-termination-policy-types`
<a name="auto-scaling_DescribeTerminationPolicyTypes_cli_2_topic"></a>

次のコード例では、`describe-termination-policy-types` を使用する方法を示しています。

**AWS CLI**  
**使用可能な終了ポリシータイプを記述する方法**  
この例では、使用可能な終了ポリシータイプを記述します。  

```
aws autoscaling describe-termination-policy-types
```
出力:  

```
{
    "TerminationPolicyTypes": [
        "AllocationStrategy",
        "ClosestToNextInstanceHour",
        "Default",
        "NewestInstance",
        "OldestInstance",
        "OldestLaunchConfiguration",
        "OldestLaunchTemplate"
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[スケールイン時にどの Auto Scaling インスタンスを終了するか設定する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeTerminationPolicyTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-termination-policy-types.html)」を参照してください。

### `describe-warm-pool`
<a name="auto-scaling_DescribeWarmPool_cli_2_topic"></a>

次のコード例では、`describe-warm-pool` を使用する方法を示しています。

**AWS CLI**  
**ウォームプールを記述する方法**  
この例では、指定された Auto Scaling グループのウォームプールを記述します。  

```
aws autoscaling describe-warm-pool \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "WarmPoolConfiguration": {
        "MinSize": 2,
        "PoolState": "Stopped"
    },
    "Instances": [
        {
            "InstanceId": "i-070a5bbc7e7f40dc5",
            "InstanceType": "t2.micro",
            "AvailabilityZone": "us-west-2c",
            "LifecycleState": "Warmed:Pending",
            "HealthStatus": "Healthy",
            "LaunchTemplate": {
                "LaunchTemplateId": "lt-00a731f6e9fa48610",
                "LaunchTemplateName": "my-template-for-auto-scaling",
                "Version": "6"
            }
        },
        {
            "InstanceId": "i-0b52f061814d3bd2d",
            "InstanceType": "t2.micro",
            "AvailabilityZone": "us-west-2b",
            "LifecycleState": "Warmed:Pending",
            "HealthStatus": "Healthy",
            "LaunchTemplate": {
                "LaunchTemplateId": "lt-00a731f6e9fa48610",
                "LaunchTemplateName": "my-template-for-auto-scaling",
                "Version": "6"
            }
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Warm pools for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeWarmPool](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/describe-warm-pool.html)」を参照してください。

### `detach-instances`
<a name="auto-scaling_DetachInstances_cli_2_topic"></a>

次のコード例では、`detach-instances` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループからインスタンスをデタッチする方法**  
この例では、指定されたインスタンスを指定された Auto Scaling グループからデタッチします。  

```
aws autoscaling detach-instances \
    --instance-ids i-030017cfa84b20135 \
    --auto-scaling-group-name my-asg \
    --should-decrement-desired-capacity
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "5091cb52-547a-47ce-a236-c9ccbc2cb2c9",
            "AutoScalingGroupName": "my-asg",
            "Description": "Detaching EC2 instance: i-030017cfa84b20135",
            "Cause": "At 2020-10-31T17:35:04Z instance i-030017cfa84b20135 was detached in response to a user request, shrinking the capacity from 2 to 1.",
            "StartTime": "2020-04-12T15:02:16.179Z",
            "StatusCode": "InProgress",
            "Progress": 50,
            "Details": "{\"Subnet ID\":\"subnet-6194ea3b\",\"Availability Zone\":\"us-west-2c\"}"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DetachInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/detach-instances.html)」を参照してください。

### `detach-load-balancer-target-groups`
<a name="auto-scaling_DetachLoadBalancerTargetGroups_cli_2_topic"></a>

次のコード例では、`detach-load-balancer-target-groups` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループからロードバランサーのターゲットグループをデタッチする方法**  
この例では、指定されたロードバランサーのターゲットグループを指定された Auto Scaling グループからデタッチします。  

```
aws autoscaling detach-load-balancer-target-groups \
    --auto-scaling-group-name my-asg \
    --target-group-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループへのロードバランサーのアタッチ](https://docs.aws.amazon.com/autoscaling/ec2/userguide/attach-load-balancer-asg.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DetachLoadBalancerTargetGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/detach-load-balancer-target-groups.html)」を参照してください。

### `detach-load-balancers`
<a name="auto-scaling_DetachLoadBalancers_cli_2_topic"></a>

次のコード例では、`detach-load-balancers` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループから Classic Load Balancer をデタッチする方法**  
この例では、指定された Classic Load Balancer を指定された Auto Scaling グループからデタッチします。  

```
aws autoscaling detach-load-balancers \
    --load-balancer-names my-load-balancer \
    --auto-scaling-group-name my-asg
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループへのロードバランサーのアタッチ](https://docs.aws.amazon.com/autoscaling/ec2/userguide/attach-load-balancer-asg.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DetachLoadBalancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/detach-load-balancers.html)」を参照してください。

### `disable-metrics-collection`
<a name="auto-scaling_DisableMetricsCollection_cli_2_topic"></a>

次のコード例では、`disable-metrics-collection` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループのメトリクス収集を無効にする方法**  
この例では、指定された Auto Scaling グループの `GroupDesiredCapacity` メトリクスの収集を無効にします。  

```
aws autoscaling disable-metrics-collection \
    --auto-scaling-group-name my-asg \
    --metrics GroupDesiredCapacity
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスの CloudWatch メトリクスのモニタリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html)」をご参照ください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DisableMetricsCollection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/disable-metrics-collection.html)」を参照してください。

### `enable-metrics-collection`
<a name="auto-scaling_EnableMetricsCollection_cli_2_topic"></a>

次のコード例では、`enable-metrics-collection` を使用する方法を示しています。

**AWS CLI**  
**例 1: Auto Scaling グループのメトリクス収集を有効にする方法**  
この例では、指定された Auto Scaling グループのデータの収集を有効にします。  

```
aws autoscaling enable-metrics-collection \
    --auto-scaling-group-name my-asg \
    --granularity "1Minute"
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスの CloudWatch メトリクスのモニタリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html)」をご参照ください。  
**例 2: Auto Scaling グループの指定されたメトリックスのデータを収集する方法**  
特定のメトリックスのデータを収集するには、`--metrics` オプションを使用します。  

```
aws autoscaling enable-metrics-collection \
    --auto-scaling-group-name my-asg \
    --metrics GroupDesiredCapacity --granularity "1Minute"
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループとインスタンスの CloudWatch メトリクスのモニタリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html)」をご参照ください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[EnableMetricsCollection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/enable-metrics-collection.html)」を参照してください。

### `enter-standby`
<a name="auto-scaling_EnterStandby_cli_2_topic"></a>

次のコード例では、`enter-standby` を使用する方法を示しています。

**AWS CLI**  
**インスタンスをスタンバイモードに移行する方法**  
この例では、指定されたインスタンスをスタンバイモードにします。これは、現在稼働中のインスタンスの更新またはトラブルシューティングに役立ちます。  

```
aws autoscaling enter-standby \
    --instance-ids i-061c63c5eb45f0416 \
    --auto-scaling-group-name my-asg \
    --should-decrement-desired-capacity
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "ffa056b4-6ed3-41ba-ae7c-249dfae6eba1",
            "AutoScalingGroupName": "my-asg",
            "Description": "Moving EC2 instance to Standby: i-061c63c5eb45f0416",
            "Cause": "At 2020-10-31T20:31:00Z instance i-061c63c5eb45f0416 was moved to standby in response to a user request, shrinking the capacity from 1 to 0.",
            "StartTime": "2020-10-31T20:31:00.949Z",
            "StatusCode": "InProgress",
            "Progress": 50,
            "Details": "{\"Subnet ID\":\"subnet-6194ea3b\",\"Availability Zone\":\"us-west-2c\"}"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Amazon EC2 Auto Scaling インスタンスのライフサイクル](https://docs.aws.amazon.com/autoscaling/ec2/userguide/detach-instance-asg.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[EnterStandby](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/enter-standby.html)」を参照してください。

### `execute-policy`
<a name="auto-scaling_ExecutePolicy_cli_2_topic"></a>

次のコード例では、`execute-policy` を使用する方法を示しています。

**AWS CLI**  
**スケーリングポリシーを実行する方法**  
この例では、指定された Auto Scaling グループに「`my-step-scale-out-policy`」という名前のスケーリングポリシーを実行します。  

```
aws autoscaling execute-policy \
    --auto-scaling-group-name my-asg \
    --policy-name  my-step-scale-out-policy \
    --metric-value 95 \
    --breach-threshold 80
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[ステップとシンプルなスケーリングポリシー](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ExecutePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/execute-policy.html)」を参照してください。

### `exit-standby`
<a name="auto-scaling_ExitStandby_cli_2_topic"></a>

次のコード例では、`exit-standby` を使用する方法を示しています。

**AWS CLI**  
**インスタンスをスタンバイモードから移動する方法**  
指定されたインスタンスのスタンバイモードを解除します。  

```
aws autoscaling exit-standby \
    --instance-ids i-061c63c5eb45f0416 \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "142928e1-a2dc-453a-9b24-b85ad6735928",
            "AutoScalingGroupName": "my-asg",
            "Description": "Moving EC2 instance out of Standby: i-061c63c5eb45f0416",
            "Cause": "At 2020-10-31T20:32:50Z instance i-061c63c5eb45f0416 was moved out of standby in response to a user request, increasing the capacity from 0 to 1.",
            "StartTime": "2020-10-31T20:32:50.222Z",
            "StatusCode": "PreInService",
            "Progress": 30,
            "Details": "{\"Subnet ID\":\"subnet-6194ea3b\",\"Availability Zone\":\"us-west-2c\"}"
        }
    ]
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling グループからの一時的なインスタンスの削除](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ExitStandby](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/exit-standby.html)」を参照してください。

### `put-lifecycle-hook`
<a name="auto-scaling_PutLifecycleHook_cli_2_topic"></a>

次のコード例では、`put-lifecycle-hook` を使用する方法を示しています。

**AWS CLI**  
**例 1: ライフサイクルフックを作成する方法**  
この例では、新しく起動した任意のインスタンスで呼び出すライフサイクルフックを作成します。タイムアウトは 4800 秒です。これは、ユーザーデータスクリプトが完了するまでインスタンスを待機状態に保つ場合や、EventBridge を使用して AWS Lambda 関数を呼び出す場合に便利です。  

```
aws autoscaling put-lifecycle-hook \
    --auto-scaling-group-name my-asg \
    --lifecycle-hook-name my-launch-hook \
    --lifecycle-transition autoscaling:EC2_INSTANCE_LAUNCHING \
    --heartbeat-timeout 4800
```
このコマンドでは何も出力されません。同じ名前のライフサイクルフックがすでに存在する場合、新しいライフサイクルフックによって上書きされます。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
**例 2: Amazon SNS の E メールメッセージを送信してインスタンスの状態遷移を通知する方法**  
この例では、インスタンスの起動時に通知を受信するために使用する Amazon SNS トピックと IAM ロールを含むライフサイクルフックを作成します。  

```
aws autoscaling put-lifecycle-hook \
    --auto-scaling-group-name my-asg \
    --lifecycle-hook-name my-launch-hook \
    --lifecycle-transition autoscaling:EC2_INSTANCE_LAUNCHING \
    --notification-target-arn arn:aws:sns:us-west-2:123456789012:my-sns-topic \
    --role-arn arn:aws:iam::123456789012:role/my-auto-scaling-role
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
**例 3: Amazon SQS キューにメッセージを公開する方法**  
この例では、メタデータを含むメッセージを指定された Amazon SQS キューに発行するライフサイクルフックを作成します。  

```
aws autoscaling put-lifecycle-hook \
    --auto-scaling-group-name my-asg \
    --lifecycle-hook-name my-launch-hook \
    --lifecycle-transition autoscaling:EC2_INSTANCE_LAUNCHING \
    --notification-target-arn arn:aws:sqs:us-west-2:123456789012:my-sqs-queue \
    --role-arn arn:aws:iam::123456789012:role/my-notification-role \
    --notification-metadata "SQS message metadata"
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PutLifecycleHook](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/put-lifecycle-hook.html)」を参照してください。

### `put-notification-configuration`
<a name="auto-scaling_PutNotificationConfiguration_cli_2_topic"></a>

次のコード例では、`put-notification-configuration` を使用する方法を示しています。

**AWS CLI**  
**通知を追加する方法**  
この例では、指定された Auto Scaling グループに指定された通知を追加します。  

```
aws autoscaling put-notification-configuration \
    --auto-scaling-group-name my-asg \
    --topic-arn arn:aws:sns:us-west-2:123456789012:my-sns-topic \
    --notification-type autoscaling:TEST_NOTIFICATION
```
このコマンドでは何も出力されません。  
詳細については、『*Amazon EC2 Auto Scaling ユーザーガイド*』の「[Auto Scaling グループのスケーリング時の Amazon SNS 通知の取得](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html#as-configure-asg-for-sns)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PutNotificationConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/put-notification-configuration.html)」を参照してください。

### `put-scaling-policy`
<a name="auto-scaling_PutScalingPolicy_cli_2_topic"></a>

次のコード例では、`put-scaling-policy` を使用する方法を示しています。

**AWS CLI**  
**ターゲット追跡スケーリングポリシーを Auto Scaling グループを追加する方法**  
次の `put-scaling-policy` 例では、指定された Auto Scaling グループにターゲットトラッキングスケーリングポリシーを適用します。出力には、自動的に作成された 2 つの CloudWatch アラームの ARN と名前が含まれます。同じ名前のスケーリングポリシーが既に存在する場合は、新しいスケーリングポリシーで上書きされます。  

```
aws autoscaling put-scaling-policy --auto-scaling-group-name my-asg \
  --policy-name alb1000-target-tracking-scaling-policy \
  --policy-type TargetTrackingScaling \
  --target-tracking-configuration file://config.json
```
`config.json` の内容:  

```
{
     "TargetValue": 1000.0,
     "PredefinedMetricSpecification": {
          "PredefinedMetricType": "ALBRequestCountPerTarget",
          "ResourceLabel": "app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff"
     }
}
```
出力:  

```
{
     "PolicyARN": "arn:aws:autoscaling:region:account-id:scalingPolicy:228f02c2-c665-4bfd-aaac-8b04080bea3c:autoScalingGroupName/my-asg:policyName/alb1000-target-tracking-scaling-policy",
     "Alarms": [
         {
             "AlarmARN": "arn:aws:cloudwatch:region:account-id:alarm:TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e",
             "AlarmName": "TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e"
         },
         {
             "AlarmARN": "arn:aws:cloudwatch:region:account-id:alarm:TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2",
             "AlarmName": "TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2"
         }
     ]
 }
```
その他の例については、「Amazon EC2 Auto Scaling [AWS ユーザーガイド」の「コマンドラインインターフェイス (AWS CLI) のスケーリングポリシーの例](https://docs.aws.amazon.com/autoscaling/ec2/userguide/examples-scaling-policies.html)」を参照してください。 *Amazon EC2 Auto Scaling *  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PutScalingPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/put-scaling-policy.html)」を参照してください。

### `put-scheduled-update-group-action`
<a name="auto-scaling_PutScheduledUpdateGroupAction_cli_2_topic"></a>

次のコード例では、`put-scheduled-update-group-action` を使用する方法を示しています。

**AWS CLI**  
**例 1: スケジュール済みのアクションを Auto Scaling グループに追加する方法**  
この例では、指定された Auto Scaling グループから指定されたスケジュール済みの通知を追加します。  

```
aws autoscaling put-scheduled-update-group-action \
    --auto-scaling-group-name my-asg \
    --scheduled-action-name my-scheduled-action \
    --start-time "2023-05-12T08:00:00Z" \
    --min-size 2 \
    --max-size 6 \
    --desired-capacity 4
```
このコマンドでは何も出力されません。同じ名前のスケジュールされたアクションが既に存在する場合、新しいスケジュールされたアクションで上書きされます。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[スケジュールされたスケーリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
**例 2: 定期的なスケジュールを指定する方法**  
この例では、毎年 1 月、6 月、12 月の 1 日の 00:30 に実行する定期スケジュールでスケーリングするスケジュール済みのアクションを作成します。  

```
aws autoscaling put-scheduled-update-group-action \
    --auto-scaling-group-name my-asg \
    --scheduled-action-name my-recurring-action \
    --recurrence "30 0 1 1,6,12 *" \
    --min-size 2 \
    --max-size 6 \
    --desired-capacity 4
```
このコマンドでは何も出力されません。同じ名前のスケジュールされたアクションが既に存在する場合、新しいスケジュールされたアクションで上書きされます。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[スケジュールされたスケーリング](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scheduled-scaling.html)」を参照してください。  
+  API の詳細については、「AWS CLI コマンドリファレンス」の「[PutScheduledUpdateGroupAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/put-scheduled-update-group-action.html)」を参照してください。

### `put-warm-pool`
<a name="auto-scaling_PutWarmPool_cli_2_topic"></a>

次のコード例では、`put-warm-pool` を使用する方法を示しています。

**AWS CLI**  
**ウォームプールを作成する方法**  
次の例では、特定の Auto Scaling グループのウォームプールを作成します。  

```
aws autoscaling put-warm-pool \
    --auto-scaling-group-name my-asg \
    --min-size 2
```
このコマンドでは何も出力されません。ウォームプールが既に存在する場合は、更新されます。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Warm pools for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PutWarmPool](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/put-warm-pool.html)」を参照してください。

### `record-lifecycle-action-heartbeat`
<a name="auto-scaling_RecordLifecycleActionHeartbeat_cli_2_topic"></a>

次のコード例では、`record-lifecycle-action-heartbeat` を使用する方法を示しています。

**AWS CLI**  
**ライフサイクルアクションハートビートを記録する方法**  
この例では、ライフサイクルアクションのハートビートを記録して、インスタンスを保留状態に保ちます。  

```
aws autoscaling record-lifecycle-action-heartbeat \
    --lifecycle-hook-name my-launch-hook \
    --auto-scaling-group-name my-asg \
    --lifecycle-action-token bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Amazon EC2 Auto Scaling のライフサイクルフック](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[RecordLifecycleActionHeartbeat](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/record-lifecycle-action-heartbeat.html)」を参照してください。

### `resume-processes`
<a name="auto-scaling_ResumeProcesses_cli_2_topic"></a>

次のコード例では、`resume-processes` を使用する方法を示しています。

**AWS CLI**  
**停止されたプロセスを再開する方法**  
この例では、指定された Auto Scaling グループの指定された一時停止スケーリングプロセスを再開します。  

```
aws autoscaling resume-processes \
    --auto-scaling-group-name my-asg \
    --scaling-processes AlarmNotification
```
このコマンドでは何も出力されません。  
詳細については、「[Amazon EC2 Auto Scaling ユーザーガイド](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html)」の「*スケーリングプロセスの中断と再開*」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ResumeProcesses](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/resume-processes.html)」を参照してください。

### `rollback-instance-refresh`
<a name="auto-scaling_RollbackInstanceRefresh_cli_2_topic"></a>

次のコード例では、`rollback-instance-refresh` を使用する方法を示しています。

**AWS CLI**  
**インスタンスの更新をロールバックする方法**  
次の `rollback-instance-refresh` 例では、指定された Auto Scaling グループの進行中のインスタンスの更新をロールバックします。  

```
aws autoscaling rollback-instance-refresh \
    --auto-scaling-group-name my-asg
```
出力:  

```
{
    "InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Undo changes with a rollback](https://docs.aws.amazon.com/autoscaling/ec2/userguide/instance-refresh-rollback.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[RollbackInstanceRefresh](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/rollback-instance-refresh.html)」を参照してください。

### `set-desired-capacity`
<a name="auto-scaling_SetDesiredCapacity_cli_2_topic"></a>

次のコード例では、`set-desired-capacity` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループに希望する容量を設定する方法**  
この例では、指定された Auto Scaling グループの希望する容量を設定します。  

```
aws autoscaling set-desired-capacity \
    --auto-scaling-group-name my-asg \
    --desired-capacity 2 \
    --honor-cooldown
```
正常に完了すると、このコマンドはプロンプトに戻ります。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[SetDesiredCapacity](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/set-desired-capacity.html)」を参照してください。

### `set-instance-health`
<a name="auto-scaling_SetInstanceHealth_cli_2_topic"></a>

次のコード例では、`set-instance-health` を使用する方法を示しています。

**AWS CLI**  
**インスタンスのヘルスステータスをチェックする方法**  
指定されたインスタンスのヘルスステータスを `Unhealthy` に設定します。  

```
aws autoscaling set-instance-health \
    --instance-id i-061c63c5eb45f0416 \
    --health-status Unhealthy
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[SetInstanceHealth](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/set-instance-health.html)」を参照してください。

### `set-instance-protection`
<a name="auto-scaling_SetInstanceProtection_cli_2_topic"></a>

次のコード例では、`set-instance-protection` を使用する方法を示しています。

**AWS CLI**  
**例 1: インスタンスに対するインスタンスの保護設定を変更する方法**  
この例では、指定されたインスタンスのインスタンス保護を有効にします。  

```
aws autoscaling set-instance-protection \
    --instance-ids i-061c63c5eb45f0416 \
    --auto-scaling-group-name my-asg --protected-from-scale-in
```
このコマンドでは何も出力されません。  
**例 2: インスタンスに対するインスタンスの保護設定を無効にする方法**  
この例では、指定されたインスタンスのインスタンス保護を無効にします。  

```
aws autoscaling set-instance-protection \
    --instance-ids i-061c63c5eb45f0416 \
    --auto-scaling-group-name my-asg \
    --no-protected-from-scale-in
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[SetInstanceProtection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/set-instance-protection.html)」を参照してください。

### `start-instance-refresh`
<a name="auto-scaling_StartInstanceRefresh_cli_2_topic"></a>

次のコード例では、`start-instance-refresh` を使用する方法を示しています。

**AWS CLI**  
**例 1: コマンドラインパラメータを使用してインスタンスの更新を開始する方法**  
次の `start-instance-refresh` 例では、コマンドライン引数を使用してインスタンスの更新を開始します。オプションの `preferences` パラメータは、`60` 秒の `InstanceWarmup` と `50` パーセント `MinHealthyPercentage` を指定します。  

```
aws autoscaling start-instance-refresh \
    --auto-scaling-group-name my-asg \
    --preferences '{"InstanceWarmup": 60, "MinHealthyPercentage": 50}'
```
出力:  

```
{
    "InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[インスタンスの更新を開始](https://docs.aws.amazon.com/en_us/autoscaling/ec2/userguide/start-instance-refresh.html)」を参照してください。  
**例 2: JSON ファイルを使用してインスタンスの更新を開始する方法**  
次の `start-instance-refresh` 例では、JSON ファイルを使用してインスタンスの更新を開始します。次の例に示すように、Auto Scaling グループを指定し、JSON ファイルで必要な各種構成を定義できます。  

```
aws autoscaling start-instance-refresh \
    --cli-input-json file://config.json
```
`config.json` の内容:  

```
{
    "AutoScalingGroupName": "my-asg",
    "DesiredConfiguration": {
        "LaunchTemplate": {
            "LaunchTemplateId": "lt-068f72b729example",
            "Version": "$Default"
        }
    },
    "Preferences": {
        "InstanceWarmup": 60,
        "MinHealthyPercentage": 50,
        "AutoRollback": true,
        "ScaleInProtectedInstances": Ignore,
        "StandbyInstances": Terminate
    }
}
```
出力:  

```
{
    "InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
```
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[インスタンスの更新を開始](https://docs.aws.amazon.com/en_us/autoscaling/ec2/userguide/start-instance-refresh.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[StartInstanceRefresh](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/start-instance-refresh.html)」を参照してください。

### `suspend-processes`
<a name="auto-scaling_SuspendProcesses_cli_2_topic"></a>

次のコード例では、`suspend-processes` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling プロセスを一時停止する方法**  
この例では、指定された Auto Scaling グループの指定されたスケーリングプロセスを一時停止します。  

```
aws autoscaling suspend-processes \
    --auto-scaling-group-name my-asg \
    --scaling-processes AlarmNotification
```
このコマンドでは何も出力されません。  
詳細については、「[Amazon EC2 Auto Scaling ユーザーガイド](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html)」の「*スケーリングプロセスの中断と再開*」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[SuspendProcesses](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/suspend-processes.html)」を参照してください。

### `terminate-instance-in-auto-scaling-group`
<a name="auto-scaling_TerminateInstanceInAutoScalingGroup_cli_2_topic"></a>

次のコード例では、`terminate-instance-in-auto-scaling-group` を使用する方法を示しています。

**AWS CLI**  
**Auto Scaling グループのインスタンスを終了する方法**  
この例では、グループのサイズを更新せずに、指定された Auto Scaling グループの指定されたインスタンスを終了します。指定されたインスタンスが終了した後、Amazon EC2 Auto Scaling は代替インスタンスを起動します。  

```
aws autoscaling terminate-instance-in-auto-scaling-group \
    --instance-id i-061c63c5eb45f0416 \
    --no-should-decrement-desired-capacity
```
出力:  

```
{
    "Activities": [
        {
            "ActivityId": "8c35d601-793c-400c-fcd0-f64a27530df7",
            "AutoScalingGroupName": "my-asg",
            "Description": "Terminating EC2 instance: i-061c63c5eb45f0416",
            "Cause": "",
            "StartTime": "2020-10-31T20:34:25.680Z",
            "StatusCode": "InProgress",
            "Progress": 0,
            "Details": "{\"Subnet ID\":\"subnet-6194ea3b\",\"Availability Zone\":\"us-west-2c\"}"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[TerminateInstanceInAutoScalingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/terminate-instance-in-auto-scaling-group.html)」を参照してください。

### `update-auto-scaling-group`
<a name="auto-scaling_UpdateAutoScalingGroup_cli_2_topic"></a>

次のコード例では、`update-auto-scaling-group` を使用する方法を示しています。

**AWS CLI**  
**例 1: Auto Scaling グループのサイズ制限を更新する方法**  
この例では、最小サイズが 2、最大サイズが 10 で、指定された Auto Scaling グループを更新します。  

```
aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --min-size 2 \
    --max-size 10
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Auto Scaling グループにキャパシティの制限を設定する](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-capacity-limits.html)」を参照してください。**  
**例 2: Elastic Load Balancing ヘルスチェックを追加し、使用するアベイラビリティーゾーンとサブネットを指定する方法**  
この例では、指定された Auto Scaling グループを更新して、Elastic Load Balancing のヘルスチェックを追加します。またこのコマンドは、複数のアベイラビリティーゾーンのサブネット ID のリストを使用して、`--vpc-zone-identifier` の値も更新します。  

```
aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --health-check-type ELB \
    --health-check-grace-period 600 \
    --vpc-zone-identifier "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782"
```
このコマンドでは何も出力されません。  
詳細については、「Amazon EC2 Auto Scaling ユーザーガイド」の「[Elastic Load Balancing を使用して Auto Scaling グループ内のインスタンス全体にトラフィックを分散させる](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html)」を参照してください。**  
**例 3: プレイスメントグループと終了ポリシーを更新する方法**  
この例では、プレイスメントグループと終了ポリシーを更新します。  

```
aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --placement-group my-placement-group \
    --termination-policies "OldestInstance"
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[Auto Scaling groups](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html)」を参照してください。  
**例 4: 起動テンプレートの最新バージョンを使用する方法**  
この例では、最新の起動テンプレートバージョンを使用するように、指定された Auto Scaling グループを更新します。  

```
aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-template LaunchTemplateId=lt-1234567890abcde12,Version='$Latest'
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[起動テンプレート](https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html)」を参照してください。  
**例 5: 特定のバージョンの起動テンプレートを使用する方法**  
この例では、最新バージョンやデフォルトバージョンではなく、指定された起動テンプレートのバージョンを使用するように、指定された Auto Scaling グループを更新します。  

```
aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-asg \
    --launch-template LaunchTemplateName=my-template-for-auto-scaling,Version='2'
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon EC2 Auto Scaling ユーザーガイド*」の「[起動テンプレート](https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html)」を参照してください。  
**例 6: 混合インスタンスポリシーを定義し、容量のリバランスを有効にする方法**  
この例では、指定された Auto Scaling グループを更新して、混合インスタンスポリシーを使用し、容量のリバランスを有効にします。この構造により、スポット容量とオンデマンド容量でグループを指定し、アーキテクチャごとに異なる起動テンプレートを使用できます。  

```
aws autoscaling update-auto-scaling-group \
    --cli-input-json file://~/config.json
```
`config.json` の内容:  

```
{
    "AutoScalingGroupName": "my-asg",
    "CapacityRebalance": true,
    "MixedInstancesPolicy": {
        "LaunchTemplate": {
            "LaunchTemplateSpecification": {
                "LaunchTemplateName": "my-launch-template-for-x86",
                "Version": "$Latest"
            },
            "Overrides": [
                {
                    "InstanceType": "c6g.large",
                    "LaunchTemplateSpecification": {
                        "LaunchTemplateName": "my-launch-template-for-arm",
                        "Version": "$Latest"
                    }
                },
                {
                    "InstanceType": "c5.large"
                },
                {
                    "InstanceType": "c5a.large"
                }
            ]
        },
        "InstancesDistribution": {
            "OnDemandPercentageAboveBaseCapacity": 50,
            "SpotAllocationStrategy": "capacity-optimized"
        }
    }
}
```
このコマンドでは何も出力されません。  
詳細については「Amazon EC2 Auto Scaling ユーザーガイド」の「[複数のインスタンスタイプと購入オプションを使用する Auto Scaling グループ](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateAutoScalingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/autoscaling/update-auto-scaling-group.html)」を参照してください。