Skip to content

create_agent

create_agent(
    activation_key: ActivationKey,
    *,
    config_overrides: Optional[DataSyncClientConfig] = None,
    agent_name: Optional[TagValue] = None,
    tags: Optional[InputTagList] = None,
    vpc_endpoint_id: Optional[VpcEndpointId] = None,
    subnet_arns: Optional[PLSubnetArnList] = None,
    security_group_arns: Optional[PLSecurityGroupArnList] = None,
) -> CreateAgentResponse

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?

Parameters:

  • activation_key (ActivationKey) –

    Specifies your DataSync agent's activation key. If you don't have an activation key, see Activating your agent.

  • agent_name (Optional[TagValue], default: None ) –

    Specifies a name for your agent. We recommend specifying a name that you can remember.

  • tags (Optional[InputTagList], default: None ) –

    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.

  • vpc_endpoint_id (Optional[VpcEndpointId], default: None ) –

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

    The endpoint ID is informational. DataSync doesn't verify it or use it to connect to your agent. For more information, see Using a single VPC service endpoint across multiple subnets.

  • subnet_arns (Optional[PLSubnetArnList], default: None ) –

    Specifies the ARN of the subnet where DataSync creates the network interfaces that handle data transfer traffic for your tasks. You can only specify one ARN.

    The subnet doesn't have to be the subnet that contains your VPC service endpoint. The subnet can be one that another Amazon Web Services account shared with you through RAM, in which case the ARN must specify the account that owns the subnet. For more information, see Using a single VPC service endpoint across multiple subnets.

  • security_group_arns (Optional[PLSecurityGroupArnList], default: None ) –

    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.

    The ARN must specify your own account, even when the security group was shared with you from the account that owns the VPC. The security group must belong to the same VPC as the subnet that you specify in SubnetArns.

Raises:

Source code in docs_src/capo_datasync/_services/data_sync.py
def create_agent(
    self,
    activation_key: "capo_datasync.types.activation_key.ActivationKey",
    *,
    config_overrides: Optional[DataSyncClientConfig] = None,
    agent_name: Optional["capo_datasync.types.tag_value.TagValue"] = None,
    tags: Optional["capo_datasync.types.input_tag_list.InputTagList"] = None,
    vpc_endpoint_id: Optional[
        "capo_datasync.types.vpc_endpoint_id.VpcEndpointId"
    ] = None,
    subnet_arns: Optional[
        "capo_datasync.types.pl_subnet_arn_list.PLSubnetArnList"
    ] = None,
    security_group_arns: Optional[
        "capo_datasync.types.pl_security_group_arn_list.PLSecurityGroupArnList"
    ] = None,
) -> "capo_datasync.types.create_agent_response.CreateAgentResponse":
    """<p>Activates an DataSync agent that you deploy in your storage environment. The activation process associates the agent with your Amazon Web Services account.</p> <p>If you haven't deployed an agent yet, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/do-i-need-datasync-agent.html">Do I need a DataSync agent?</a> </p>

    Args:
        activation_key: <p>Specifies your DataSync agent's activation key. If you don't have an activation key, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/activate-agent.html">Activating your agent</a>.</p>
        agent_name: <p>Specifies a name for your agent. We recommend specifying a name that you can remember.</p>
        tags: <p>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.</p>
        vpc_endpoint_id: <p>Specifies the ID of the <a href="https://docs.aws.amazon.com/datasync/latest/userguide/choose-service-endpoint.html#datasync-in-vpc">VPC service endpoint</a> that you're using. For example, a VPC endpoint ID looks like <code>vpce-01234d5aff67890e1</code>.</p> <important> <p>The VPC service endpoint you use must include the DataSync service name (for example, <code>com.amazonaws.us-east-2.datasync</code>).</p> </important> <p>The endpoint ID is informational. DataSync doesn't verify it or use it to connect to your agent. For more information, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/choose-service-endpoint.html#vpc-endpoint-multiple-subnets">Using a single VPC service endpoint across multiple subnets</a>.</p>
        subnet_arns: <p>Specifies the ARN of the subnet where DataSync creates the <a href="https://docs.aws.amazon.com/datasync/latest/userguide/required-network-interfaces.html">network interfaces</a> that handle data transfer traffic for your tasks. You can only specify one ARN.</p> <p>The subnet doesn't have to be the subnet that contains your VPC service endpoint. The subnet can be one that another Amazon Web Services account shared with you through <a href="https://docs.aws.amazon.com/ram/latest/userguide/what-is.html">RAM</a>, in which case the ARN must specify the account that owns the subnet. For more information, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/choose-service-endpoint.html#vpc-endpoint-multiple-subnets">Using a single VPC service endpoint across multiple subnets</a>.</p>
        security_group_arns: <p>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.</p> <p>The ARN must specify your own account, even when the security group was shared with you from the account that owns the VPC. The security group must belong to the same VPC as the subnet that you specify in <code>SubnetArns</code>.</p>

    Raises:
        capo_datasync.errors.internal_exception.InternalException: <p>This exception is thrown when an error occurs in the DataSync service.</p>
        capo_datasync.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_datasync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_datasync.types.create_agent_request.CreateAgentRequest]",
    ) -> OperationResponse[
        "capo_datasync.types.create_agent_response.CreateAgentResponse"
    ]:
        import capo_datasync._operations.fmrs_service.create_agent

        output, http_response = (
            capo_datasync._operations.fmrs_service.create_agent.create_agent(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAgent")
    )
    input_: capo_datasync.types.create_agent_request.CreateAgentRequest = {
        "activation_key": activation_key
    }
    if agent_name is not None:
        input_["agent_name"] = agent_name
    if tags is not None:
        input_["tags"] = tags
    if vpc_endpoint_id is not None:
        input_["vpc_endpoint_id"] = vpc_endpoint_id
    if subnet_arns is not None:
        input_["subnet_arns"] = subnet_arns
    if security_group_arns is not None:
        input_["security_group_arns"] = security_group_arns

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output