Agent class

Manages an AWS DataSync Agent deployed on premises.

> NOTE: One of activationKey or ipAddress must be provided for resource creation (agent activation). Neither is required for resource import. If using ipAddress, this provider must be able to make an HTTP (port 80) GET request to the specified IP address from where it is running. The agent will turn off that HTTP server after activation.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.datasync.Agent("example", {
    ipAddress: "1.2.3.4",
    name: "example",
});
import pulumi
import pulumi_aws as aws

example = aws.datasync.Agent("example",
    ip_address="1.2.3.4",
    name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.DataSync.Agent("example", new()
    {
        IpAddress = "1.2.3.4",
        Name = "example",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasync.NewAgent(ctx, "example", &datasync.AgentArgs{
			IpAddress: pulumi.String("1.2.3.4"),
			Name:      pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_datasync_agent" "example" {
  ip_address = "1.2.3.4"
  name       = "example"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.datasync.Agent;
import com.pulumi.aws.datasync.AgentArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Agent("example", AgentArgs.builder()
            .ipAddress("1.2.3.4")
            .name("example")
            .build());

    }
}
resources:
  example:
    type: aws:datasync:Agent
    properties:
      ipAddress: 1.2.3.4
      name: example

Example Usage with VPC Endpoints

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getRegion({});
const exampleVpcEndpoint = new aws.ec2.VpcEndpoint("example", {
    serviceName: current.then(current => `com.amazonaws.${current.region}.datasync`),
    vpcId: exampleAwsVpc.id,
    securityGroupIds: [exampleAwsSecurityGroup.id],
    subnetIds: [exampleAwsSubnet.id],
    vpcEndpointType: "Interface",
});
const example = aws.ec2.getNetworkInterfaceOutput({
    id: exampleVpcEndpoint.networkInterfaceIds[0],
});
const exampleAgent = new aws.datasync.Agent("example", {
    ipAddress: "1.2.3.4",
    securityGroupArns: [exampleAwsSecurityGroup.arn],
    subnetArns: [exampleAwsSubnet.arn],
    vpcEndpointId: exampleVpcEndpoint.id,
    privateLinkEndpoint: example.privateIp,
    name: "example",
});
import pulumi
import pulumi_aws as aws

current = aws.get_region()
example_vpc_endpoint = aws.ec2.VpcEndpoint("example",
    service_name=f"com.amazonaws.{current.region}.datasync",
    vpc_id=example_aws_vpc["id"],
    security_group_ids=[example_aws_security_group["id"]],
    subnet_ids=[example_aws_subnet["id"]],
    vpc_endpoint_type="Interface")
example = aws.ec2.get_network_interface_output(id=example_vpc_endpoint.network_interface_ids[0])
example_agent = aws.datasync.Agent("example",
    ip_address="1.2.3.4",
    security_group_arns=[example_aws_security_group["arn"]],
    subnet_arns=[example_aws_subnet["arn"]],
    vpc_endpoint_id=example_vpc_endpoint.id,
    private_link_endpoint=example.private_ip,
    name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetRegion.Invoke();

    var exampleVpcEndpoint = new Aws.Ec2.VpcEndpoint("example", new()
    {
        ServiceName = $"com.amazonaws.{current.Apply(getRegionResult => getRegionResult.Region)}.datasync",
        VpcId = exampleAwsVpc.Id,
        SecurityGroupIds = new[]
        {
            exampleAwsSecurityGroup.Id,
        },
        SubnetIds = new[]
        {
            exampleAwsSubnet.Id,
        },
        VpcEndpointType = "Interface",
    });

    var example = Aws.Ec2.GetNetworkInterface.Invoke(new()
    {
        Id = exampleVpcEndpoint.NetworkInterfaceIds[0],
    });

    var exampleAgent = new Aws.DataSync.Agent("example", new()
    {
        IpAddress = "1.2.3.4",
        SecurityGroupArns = new[]
        {
            exampleAwsSecurityGroup.Arn,
        },
        SubnetArns = new[]
        {
            exampleAwsSubnet.Arn,
        },
        VpcEndpointId = exampleVpcEndpoint.Id,
        PrivateLinkEndpoint = example.Apply(getNetworkInterfaceResult => getNetworkInterfaceResult.PrivateIp),
        Name = "example",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/datasync"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		exampleVpcEndpoint, err := ec2.NewVpcEndpoint(ctx, "example", &ec2.VpcEndpointArgs{
			ServiceName: pulumi.Sprintf("com.amazonaws.%v.datasync", current.Region),
			VpcId:       pulumi.Any(exampleAwsVpc.Id),
			SecurityGroupIds: pulumi.StringArray{
				exampleAwsSecurityGroup.Id,
			},
			SubnetIds: pulumi.StringArray{
				exampleAwsSubnet.Id,
			},
			VpcEndpointType: pulumi.String("Interface"),
		})
		if err != nil {
			return err
		}
		example := ec2.LookupNetworkInterfaceOutput(ctx, ec2.GetNetworkInterfaceOutputArgs{
			Id: exampleVpcEndpoint.NetworkInterfaceIds.ApplyT(func(networkInterfaceIds []string) (string, error) {
				return networkInterfaceIds[0], nil
			}).(pulumi.StringOutput),
		}, nil)
		_, err = datasync.NewAgent(ctx, "example", &datasync.AgentArgs{
			IpAddress: pulumi.String("1.2.3.4"),
			SecurityGroupArns: pulumi.StringArray{
				exampleAwsSecurityGroup.Arn,
			},
			SubnetArns: pulumi.StringArray{
				exampleAwsSubnet.Arn,
			},
			VpcEndpointId:       exampleVpcEndpoint.ID().ToIDOutput().ToStringOutput(),
			PrivateLinkEndpoint: example.PrivateIp(),
			Name:                pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getregion" "current" {
}
data "aws_ec2_getnetworkinterface" "example" {
  id = aws_ec2_vpcendpoint.example.network_interface_ids[0]
}

resource "aws_datasync_agent" "example" {
  ip_address            = "1.2.3.4"
  security_group_arns   = [exampleAwsSecurityGroup.arn]
  subnet_arns           = [exampleAwsSubnet.arn]
  vpc_endpoint_id       = aws_ec2_vpcendpoint.example.id
  private_link_endpoint = data.aws_ec2_getnetworkinterface.example.private_ip
  name                  = "example"
}
resource "aws_ec2_vpcendpoint" "example" {
  service_name       ="com.amazonaws.${data.aws_getregion.current.region}.datasync"
  vpc_id             = exampleAwsVpc.id
  security_group_ids = [exampleAwsSecurityGroup.id]
  subnet_ids         = [exampleAwsSubnet.id]
  vpc_endpoint_type  = "Interface"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetNetworkInterfaceArgs;
import com.pulumi.aws.datasync.Agent;
import com.pulumi.aws.datasync.AgentArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = AwsFunctions.getRegion(GetRegionArgs.builder()
            .build());

        var exampleVpcEndpoint = new VpcEndpoint("exampleVpcEndpoint", VpcEndpointArgs.builder()
            .serviceName(String.format("com.amazonaws.%s.datasync", current.region()))
            .vpcId(exampleAwsVpc.id())
            .securityGroupIds(exampleAwsSecurityGroup.id())
            .subnetIds(exampleAwsSubnet.id())
            .vpcEndpointType("Interface")
            .build());

        final var example = Ec2Functions.getNetworkInterface(GetNetworkInterfaceArgs.builder()
            .id(exampleVpcEndpoint.networkInterfaceIds().applyValue(_networkInterfaceIds -> _networkInterfaceIds[0]))
            .build());

        var exampleAgent = new Agent("exampleAgent", AgentArgs.builder()
            .ipAddress("1.2.3.4")
            .securityGroupArns(exampleAwsSecurityGroup.arn())
            .subnetArns(exampleAwsSubnet.arn())
            .vpcEndpointId(exampleVpcEndpoint.id())
            .privateLinkEndpoint(example.applyValue(_example -> _example.privateIp()))
            .name("example")
            .build());

    }
}
resources:
  exampleAgent:
    type: aws:datasync:Agent
    name: example
    properties:
      ipAddress: 1.2.3.4
      securityGroupArns:
        - ${exampleAwsSecurityGroup.arn}
      subnetArns:
        - ${exampleAwsSubnet.arn}
      vpcEndpointId: ${exampleVpcEndpoint.id}
      privateLinkEndpoint: ${example.privateIp}
      name: example
  exampleVpcEndpoint:
    type: aws:ec2:VpcEndpoint
    name: example
    properties:
      serviceName: com.amazonaws.${current.region}.datasync
      vpcId: ${exampleAwsVpc.id}
      securityGroupIds:
        - ${exampleAwsSecurityGroup.id}
      subnetIds:
        - ${exampleAwsSubnet.id}
      vpcEndpointType: Interface
variables:
  current:
    fn::invoke:
      function: aws:getRegion
      arguments: {}
  example:
    fn::invoke:
      function: aws:ec2:getNetworkInterface
      arguments:
        id: ${exampleVpcEndpoint.networkInterfaceIds[0]}

Import

Identity Schema

Required

  • arn (String) ARN of the DataSync agent.

Using pulumi import, import aws.datasync.Agent using the DataSync Agent ARN. For example:

$ pulumi import aws:datasync/agent:Agent example arn:aws:datasync:us-east-1:123456789012:agent/agent-12345678901234567

Constructors

Agent(String name, {AgentArgs? args, CustomResourceOptions? options})
Creates a new Agent. name The Pulumi resource name. args Arguments used to configure this Agent. The set of arguments for Agent. options Resource options controlling this resource's behavior.
Agent.reference(String urn)
Creates a typed reference to an existing Agent resource.

Properties

activationKey ↔ Output<String>
DataSync Agent activation key during resource creation. Conflicts with ipAddress. If an ipAddress is provided instead, the provider will retrieve the activationKey as part of the resource creation.
latefinal
arn ↔ Output<String>
ARN of the DataSync Agent.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
ipAddress ↔ Output<String>
DataSync Agent IP address to retrieve activation key during resource creation. Conflicts with activationKey. DataSync Agent must be accessible on port 80 from where the provider is running.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the DataSync Agent.
latefinal
privateLinkEndpoint ↔ Output<String>
The IP address of the VPC endpoint the agent should connect to when retrieving an activation key during resource creation. Conflicts with activationKey.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityGroupArns ↔ Output<List<String>?>
The ARNs of the security groups used to protect your data transfer task subnets.
latefinal
subnetArns ↔ Output<List<String>?>
ARNs of the subnets in which DataSync will create elastic network interfaces for each data transfer task.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value pairs of resource tags to assign to the DataSync Agent. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
vpcEndpointId ↔ Output<String?>
ID of the VPC endpoint that the agent has access to.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AgentState? state, CustomResourceOptions? options}) → Agent
Gets an existing Agent resource's state with the given name and id.