- 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.
CreateAgentCommand
Activates an DataSync agent that you deploy in your storage environment. The activation process associates the agent with your Amazon Web Services account.
If you haven't deployed an agent yet, see Do I need a DataSync agent?
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { DataSyncClient, CreateAgentCommand } from "@aws-sdk/client-datasync"; // ES Modules import
// const { DataSyncClient, CreateAgentCommand } = require("@aws-sdk/client-datasync"); // CommonJS import
const client = new DataSyncClient(config);
const input = { // CreateAgentRequest
ActivationKey: "STRING_VALUE", // required
AgentName: "STRING_VALUE",
Tags: [ // InputTagList
{ // TagListEntry
Key: "STRING_VALUE", // required
Value: "STRING_VALUE",
},
],
VpcEndpointId: "STRING_VALUE",
SubnetArns: [ // PLSubnetArnList
"STRING_VALUE",
],
SecurityGroupArns: [ // PLSecurityGroupArnList
"STRING_VALUE",
],
};
const command = new CreateAgentCommand(input);
const response = await client.send(command);
// { // CreateAgentResponse
// AgentArn: "STRING_VALUE",
// };
CreateAgentCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
ActivationKey Required | string | undefined | Specifies your DataSync agent's activation key. If you don't have an activation key, see Activating your agent . |
AgentName | string | undefined | Specifies a name for your agent. We recommend specifying a name that you can remember. |
SecurityGroupArns | string[] | undefined | Specifies the Amazon Resource Name (ARN) of the security group that allows traffic between your agent and VPC service endpoint. You can only specify one ARN. |
SubnetArns | string[] | undefined | Specifies the ARN of the subnet where your VPC service endpoint is located. You can only specify one ARN. |
Tags | TagListEntry[] | undefined | Specifies labels that help you categorize, filter, and search for your Amazon Web Services resources. We recommend creating at least one tag for your agent. |
VpcEndpointId | string | undefined | Specifies the ID of the VPC service endpoint that you're using. For example, a VPC endpoint ID looks like The VPC service endpoint you use must include the DataSync service name (for example, |
CreateAgentCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
AgentArn | string | undefined | The ARN of the agent that you just activated. Use the ListAgents operation to return a list of agents in your Amazon Web Services account and Amazon Web Services Region. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalException | server | This exception is thrown when an error occurs in the DataSync service. |
InvalidRequestException | client | This exception is thrown when the client submits a malformed request. |
DataSyncServiceException | Base exception class for all service exceptions from DataSync service. |