建立容量保留群組 - Amazon Elastic Compute Cloud

建立容量保留群組

您可使用下列範例,藉助以下請求參數來為容量保留建立資源群組。

  • AWS::EC2::CapacityReservationPool – 確保將資源群組鎖定為執行個體啟動的目標

  • AWS::ResourceGroups::Genericallowed-resource-types 設為 AWS::EC2::CapacityReservation – 確保資源群組僅接受容量保留

在您建立群組之後,可新增容量保留至群組。

AWS CLI
為容量保留建立群組

使用 create-group 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 cmdlet。

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