Add a Capacity Reservation to a group - Amazon Elastic Compute Cloud

Add a Capacity Reservation to a group

If you add a Capacity Reservation that is shared with you to a group, and that Capacity Reservation is unshared, it is automatically removed from the group.

To add a Capacity Reservation to a group

Use the group-resources AWS CLI command. For group, specify the name of the group to which to add the Capacity Reservations, and for resources, specify ARNs of the Capacity Reservations to add. To add multiple Capacity Reservations, separate the ARNs with a space. To get the ARNs of the Capacity Reservations to add, use the describe-capacity-reservations AWS CLI command and specify the IDs of the Capacity Reservations.

For example, the following command adds two Capacity Reservations to a group named MyCRGroup.

aws resource-groups group-resources \ --group MyCRGroup \ --resource-arns arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-1234567890abcdef1 arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-54321abcdef567890

The following shows example output.

{ "Failed": [], "Succeeded": [ "arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-1234567890abcdef1", "arn:aws:ec2:sa-east-1:123456789012:capacity-reservation/cr-54321abcdef567890" ] }