

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立容量保留群組
<a name="create-group"></a>

您可使用下列範例，藉助以下請求參數來為容量保留建立資源群組。
+ `AWS::EC2::CapacityReservationPool` – 確保將資源群組鎖定為執行個體啟動的目標
+ `AWS::ResourceGroups::Generic` 將 `allowed-resource-types` 設為 `AWS::EC2::CapacityReservation` – 確保資源群組僅接受容量保留

在您建立群組之後，可[新增容量保留](add-to-group.md)至群組。

------
#### [ AWS CLI ]

**為容量保留建立群組**  
使用 [create-group](https://docs.aws.amazon.com/cli/latest/reference/resource-groups/create-group.html) AWS CLI 命令。

```
aws resource-groups create-group \
    --name MyCRGroup \
    --configuration \
        '{"Type": "AWS::EC2::CapacityReservationPool"}' \
        '{"Type": "AWS::ResourceGroups::Generic", "Parameters": [{"Name": "allowed-resource-types", "Values": ["AWS::EC2::CapacityReservation"]}]}'
```

------
#### [ PowerShell ]

**為容量保留建立群組**  
使用 [New-RGGroup](https://docs.aws.amazon.com/powershell/latest/reference/items/New-RGGroup.html) cmdlet。

```
New-RGGroup `
    -Name MyCRGroup `
    -Configuration `
        @{"Type"="AWS::EC2::CapacityReserationPool"} `
        @{"Type"="AWS::ResourceGroups::Generic"; "Parameters"=@{"allowed-resource-types"=@{"Values"="AWS::EC2::CapacityReservations"}}}
```

------