

# 创建容量预留组
<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"}}}
```

------