- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
InviteMembersCommand
We recommend using Organizations instead of Security Hub invitations to manage your member accounts. For information, see Managing Security Hub administrator and member accounts with Organizations in the Security Hub User Guide.
Invites other Amazon Web Services accounts to become member accounts for the Security Hub administrator account that the invitation is sent from.
This operation is only used to invite accounts that don't belong to an Amazon Web Services organization. Organization accounts don't receive invitations.
Before you can use this action to invite a member, you must first use the CreateMembers
action to create the member account in Security Hub.
When the account owner enables Security Hub and accepts the invitation to become a member account, the administrator account can view the findings generated in the member account.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { SecurityHubClient, InviteMembersCommand } from "@aws-sdk/client-securityhub"; // ES Modules import
// const { SecurityHubClient, InviteMembersCommand } = require("@aws-sdk/client-securityhub"); // CommonJS import
const client = new SecurityHubClient(config);
const input = { // InviteMembersRequest
AccountIds: [ // AccountIdList // required
"STRING_VALUE",
],
};
const command = new InviteMembersCommand(input);
const response = await client.send(command);
// { // InviteMembersResponse
// UnprocessedAccounts: [ // ResultList
// { // Result
// AccountId: "STRING_VALUE",
// ProcessingResult: "STRING_VALUE",
// },
// ],
// };
Example Usage
InviteMembersCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AccountIds Required | string[] | undefined | The list of account IDs of the Amazon Web Services accounts to invite to Security Hub as members. |
InviteMembersCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
UnprocessedAccounts | Result[] | undefined | The list of Amazon Web Services accounts that could not be processed. For each account, the list includes the account ID and the email address. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalException | server | Internal server error. |
InvalidAccessException | client | The account doesn't have permission to perform this action. |
InvalidInputException | client | The request was rejected because you supplied an invalid or out-of-range value for an input parameter. |
LimitExceededException | client | The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded. |
ResourceNotFoundException | client | The request was rejected because we can't find the specified resource. |
SecurityHubServiceException | Base exception class for all service exceptions from SecurityHub service. |