UngroupResourcesCommand

Removes the specified resources from the specified group. This operation works only with static groups that you populated using the GroupResources operation. It doesn't work with any resource groups that are automatically populated by tag-based or CloudFormation stack-based queries.

Minimum permissions

To run this command, you must have the following permissions:

  • resource-groups:UngroupResources

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ResourceGroupsClient, UngroupResourcesCommand } from "@aws-sdk/client-resource-groups"; // ES Modules import
// const { ResourceGroupsClient, UngroupResourcesCommand } = require("@aws-sdk/client-resource-groups"); // CommonJS import
const client = new ResourceGroupsClient(config);
const input = { // UngroupResourcesInput
  Group: "STRING_VALUE", // required
  ResourceArns: [ // ResourceArnList // required
    "STRING_VALUE",
  ],
};
const command = new UngroupResourcesCommand(input);
const response = await client.send(command);
// { // UngroupResourcesOutput
//   Succeeded: [ // ResourceArnList
//     "STRING_VALUE",
//   ],
//   Failed: [ // FailedResourceList
//     { // FailedResource
//       ResourceArn: "STRING_VALUE",
//       ErrorMessage: "STRING_VALUE",
//       ErrorCode: "STRING_VALUE",
//     },
//   ],
//   Pending: [ // PendingResourceList
//     { // PendingResource
//       ResourceArn: "STRING_VALUE",
//     },
//   ],
// };

UngroupResourcesCommand Input

See UngroupResourcesCommandInput for more details

Parameter
Type
Description
Group
Required
string | undefined

The name or the Amazon resource name (ARN) of the resource group from which to remove the resources.

ResourceArns
Required
string[] | undefined

The Amazon resource names (ARNs) of the resources to be removed from the group.

UngroupResourcesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Failed
FailedResource[] | undefined

A list of any resources that failed to be removed from the group by this operation.

Pending
PendingResource[] | undefined

A list of any resources that are still in the process of being removed from the group by this operation. These pending removals continue asynchronously. You can check the status of pending removals by using the ListGroupResources operation. After the resource is successfully removed, it no longer appears in the response.

Succeeded
string[] | undefined

A list of resources that were successfully removed from the group by this operation.

Throws

Name
Fault
Details
BadRequestException
client

The request includes one or more parameters that violate validation rules.

ForbiddenException
client

The caller isn't authorized to make the request. Check permissions.

InternalServerErrorException
server

An internal error occurred while processing the request. Try again later.

MethodNotAllowedException
client

The request uses an HTTP method that isn't allowed for the specified resource.

NotFoundException
client

One or more of the specified resources don't exist.

TooManyRequestsException
client

You've exceeded throttling limits by making too many requests in a period of time.

ResourceGroupsServiceException
Base exception class for all service exceptions from ResourceGroups service.