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

See CreateAgentCommandInput for more details

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 vpce-01234d5aff67890e1.

The VPC service endpoint you use must include the DataSync service name (for example, com.amazonaws.us-east-2.datasync).

CreateAgentCommand Output

See CreateAgentCommandOutput for details

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
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.