1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. TrafficMirrorTarget

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi

aws.ec2.TrafficMirrorTarget

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi

    Provides a Traffic mirror target.
    Read limits and considerations for traffic mirroring

    Example Usage

    To create a basic traffic mirror session

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const nlb = new aws.ec2.TrafficMirrorTarget("nlb", {
        description: "NLB target",
        networkLoadBalancerArn: lb.arn,
    });
    const eni = new aws.ec2.TrafficMirrorTarget("eni", {
        description: "ENI target",
        networkInterfaceId: test.primaryNetworkInterfaceId,
    });
    const gwlb = new aws.ec2.TrafficMirrorTarget("gwlb", {
        description: "GWLB target",
        gatewayLoadBalancerEndpointId: example.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    nlb = aws.ec2.TrafficMirrorTarget("nlb",
        description="NLB target",
        network_load_balancer_arn=lb["arn"])
    eni = aws.ec2.TrafficMirrorTarget("eni",
        description="ENI target",
        network_interface_id=test["primaryNetworkInterfaceId"])
    gwlb = aws.ec2.TrafficMirrorTarget("gwlb",
        description="GWLB target",
        gateway_load_balancer_endpoint_id=example["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewTrafficMirrorTarget(ctx, "nlb", &ec2.TrafficMirrorTargetArgs{
    			Description:            pulumi.String("NLB target"),
    			NetworkLoadBalancerArn: pulumi.Any(lb.Arn),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewTrafficMirrorTarget(ctx, "eni", &ec2.TrafficMirrorTargetArgs{
    			Description:        pulumi.String("ENI target"),
    			NetworkInterfaceId: pulumi.Any(test.PrimaryNetworkInterfaceId),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewTrafficMirrorTarget(ctx, "gwlb", &ec2.TrafficMirrorTargetArgs{
    			Description:                   pulumi.String("GWLB target"),
    			GatewayLoadBalancerEndpointId: pulumi.Any(example.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var nlb = new Aws.Ec2.TrafficMirrorTarget("nlb", new()
        {
            Description = "NLB target",
            NetworkLoadBalancerArn = lb.Arn,
        });
    
        var eni = new Aws.Ec2.TrafficMirrorTarget("eni", new()
        {
            Description = "ENI target",
            NetworkInterfaceId = test.PrimaryNetworkInterfaceId,
        });
    
        var gwlb = new Aws.Ec2.TrafficMirrorTarget("gwlb", new()
        {
            Description = "GWLB target",
            GatewayLoadBalancerEndpointId = example.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.TrafficMirrorTarget;
    import com.pulumi.aws.ec2.TrafficMirrorTargetArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 nlb = new TrafficMirrorTarget("nlb", TrafficMirrorTargetArgs.builder()        
                .description("NLB target")
                .networkLoadBalancerArn(lb.arn())
                .build());
    
            var eni = new TrafficMirrorTarget("eni", TrafficMirrorTargetArgs.builder()        
                .description("ENI target")
                .networkInterfaceId(test.primaryNetworkInterfaceId())
                .build());
    
            var gwlb = new TrafficMirrorTarget("gwlb", TrafficMirrorTargetArgs.builder()        
                .description("GWLB target")
                .gatewayLoadBalancerEndpointId(example.id())
                .build());
    
        }
    }
    
    resources:
      nlb:
        type: aws:ec2:TrafficMirrorTarget
        properties:
          description: NLB target
          networkLoadBalancerArn: ${lb.arn}
      eni:
        type: aws:ec2:TrafficMirrorTarget
        properties:
          description: ENI target
          networkInterfaceId: ${test.primaryNetworkInterfaceId}
      gwlb:
        type: aws:ec2:TrafficMirrorTarget
        properties:
          description: GWLB target
          gatewayLoadBalancerEndpointId: ${example.id}
    

    Create TrafficMirrorTarget Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TrafficMirrorTarget(name: string, args?: TrafficMirrorTargetArgs, opts?: CustomResourceOptions);
    @overload
    def TrafficMirrorTarget(resource_name: str,
                            args: Optional[TrafficMirrorTargetArgs] = None,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def TrafficMirrorTarget(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            description: Optional[str] = None,
                            gateway_load_balancer_endpoint_id: Optional[str] = None,
                            network_interface_id: Optional[str] = None,
                            network_load_balancer_arn: Optional[str] = None,
                            tags: Optional[Mapping[str, str]] = None)
    func NewTrafficMirrorTarget(ctx *Context, name string, args *TrafficMirrorTargetArgs, opts ...ResourceOption) (*TrafficMirrorTarget, error)
    public TrafficMirrorTarget(string name, TrafficMirrorTargetArgs? args = null, CustomResourceOptions? opts = null)
    public TrafficMirrorTarget(String name, TrafficMirrorTargetArgs args)
    public TrafficMirrorTarget(String name, TrafficMirrorTargetArgs args, CustomResourceOptions options)
    
    type: aws:ec2:TrafficMirrorTarget
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TrafficMirrorTargetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TrafficMirrorTargetArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TrafficMirrorTargetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TrafficMirrorTargetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TrafficMirrorTargetArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var trafficMirrorTargetResource = new Aws.Ec2.TrafficMirrorTarget("trafficMirrorTargetResource", new()
    {
        Description = "string",
        GatewayLoadBalancerEndpointId = "string",
        NetworkInterfaceId = "string",
        NetworkLoadBalancerArn = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := ec2.NewTrafficMirrorTarget(ctx, "trafficMirrorTargetResource", &ec2.TrafficMirrorTargetArgs{
    	Description:                   pulumi.String("string"),
    	GatewayLoadBalancerEndpointId: pulumi.String("string"),
    	NetworkInterfaceId:            pulumi.String("string"),
    	NetworkLoadBalancerArn:        pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var trafficMirrorTargetResource = new TrafficMirrorTarget("trafficMirrorTargetResource", TrafficMirrorTargetArgs.builder()        
        .description("string")
        .gatewayLoadBalancerEndpointId("string")
        .networkInterfaceId("string")
        .networkLoadBalancerArn("string")
        .tags(Map.of("string", "string"))
        .build());
    
    traffic_mirror_target_resource = aws.ec2.TrafficMirrorTarget("trafficMirrorTargetResource",
        description="string",
        gateway_load_balancer_endpoint_id="string",
        network_interface_id="string",
        network_load_balancer_arn="string",
        tags={
            "string": "string",
        })
    
    const trafficMirrorTargetResource = new aws.ec2.TrafficMirrorTarget("trafficMirrorTargetResource", {
        description: "string",
        gatewayLoadBalancerEndpointId: "string",
        networkInterfaceId: "string",
        networkLoadBalancerArn: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:ec2:TrafficMirrorTarget
    properties:
        description: string
        gatewayLoadBalancerEndpointId: string
        networkInterfaceId: string
        networkLoadBalancerArn: string
        tags:
            string: string
    

    TrafficMirrorTarget Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The TrafficMirrorTarget resource accepts the following input properties:

    Description string
    A description of the traffic mirror session.
    GatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    NetworkInterfaceId string
    The network interface ID that is associated with the target.
    NetworkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    Tags Dictionary<string, string>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    Description string
    A description of the traffic mirror session.
    GatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    NetworkInterfaceId string
    The network interface ID that is associated with the target.
    NetworkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    Tags map[string]string

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    description String
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId String
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId String
    The network interface ID that is associated with the target.
    networkLoadBalancerArn String
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    tags Map<String,String>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    description string
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId string
    The network interface ID that is associated with the target.
    networkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    tags {[key: string]: string}

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    description str
    A description of the traffic mirror session.
    gateway_load_balancer_endpoint_id str
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    network_interface_id str
    The network interface ID that is associated with the target.
    network_load_balancer_arn str
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    tags Mapping[str, str]

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    description String
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId String
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId String
    The network interface ID that is associated with the target.
    networkLoadBalancerArn String
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    tags Map<String>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TrafficMirrorTarget resource produces the following output properties:

    Arn string
    The ARN of the traffic mirror target.
    Id string
    The provider-assigned unique ID for this managed resource.
    OwnerId string
    The ID of the AWS account that owns the traffic mirror target.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    The ARN of the traffic mirror target.
    Id string
    The provider-assigned unique ID for this managed resource.
    OwnerId string
    The ID of the AWS account that owns the traffic mirror target.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the traffic mirror target.
    id String
    The provider-assigned unique ID for this managed resource.
    ownerId String
    The ID of the AWS account that owns the traffic mirror target.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    The ARN of the traffic mirror target.
    id string
    The provider-assigned unique ID for this managed resource.
    ownerId string
    The ID of the AWS account that owns the traffic mirror target.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    The ARN of the traffic mirror target.
    id str
    The provider-assigned unique ID for this managed resource.
    owner_id str
    The ID of the AWS account that owns the traffic mirror target.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the traffic mirror target.
    id String
    The provider-assigned unique ID for this managed resource.
    ownerId String
    The ID of the AWS account that owns the traffic mirror target.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing TrafficMirrorTarget Resource

    Get an existing TrafficMirrorTarget resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TrafficMirrorTargetState, opts?: CustomResourceOptions): TrafficMirrorTarget
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            description: Optional[str] = None,
            gateway_load_balancer_endpoint_id: Optional[str] = None,
            network_interface_id: Optional[str] = None,
            network_load_balancer_arn: Optional[str] = None,
            owner_id: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> TrafficMirrorTarget
    func GetTrafficMirrorTarget(ctx *Context, name string, id IDInput, state *TrafficMirrorTargetState, opts ...ResourceOption) (*TrafficMirrorTarget, error)
    public static TrafficMirrorTarget Get(string name, Input<string> id, TrafficMirrorTargetState? state, CustomResourceOptions? opts = null)
    public static TrafficMirrorTarget get(String name, Output<String> id, TrafficMirrorTargetState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string
    The ARN of the traffic mirror target.
    Description string
    A description of the traffic mirror session.
    GatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    NetworkInterfaceId string
    The network interface ID that is associated with the target.
    NetworkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    OwnerId string
    The ID of the AWS account that owns the traffic mirror target.
    Tags Dictionary<string, string>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    The ARN of the traffic mirror target.
    Description string
    A description of the traffic mirror session.
    GatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    NetworkInterfaceId string
    The network interface ID that is associated with the target.
    NetworkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    OwnerId string
    The ID of the AWS account that owns the traffic mirror target.
    Tags map[string]string

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the traffic mirror target.
    description String
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId String
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId String
    The network interface ID that is associated with the target.
    networkLoadBalancerArn String
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    ownerId String
    The ID of the AWS account that owns the traffic mirror target.
    tags Map<String,String>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    The ARN of the traffic mirror target.
    description string
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId string
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId string
    The network interface ID that is associated with the target.
    networkLoadBalancerArn string
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    ownerId string
    The ID of the AWS account that owns the traffic mirror target.
    tags {[key: string]: string}

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    The ARN of the traffic mirror target.
    description str
    A description of the traffic mirror session.
    gateway_load_balancer_endpoint_id str
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    network_interface_id str
    The network interface ID that is associated with the target.
    network_load_balancer_arn str
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    owner_id str
    The ID of the AWS account that owns the traffic mirror target.
    tags Mapping[str, str]

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the traffic mirror target.
    description String
    A description of the traffic mirror session.
    gatewayLoadBalancerEndpointId String
    The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
    networkInterfaceId String
    The network interface ID that is associated with the target.
    networkLoadBalancerArn String
    The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
    ownerId String
    The ID of the AWS account that owns the traffic mirror target.
    tags Map<String>

    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Import

    Using pulumi import, import traffic mirror targets using the id. For example:

    $ pulumi import aws:ec2/trafficMirrorTarget:TrafficMirrorTarget target tmt-0c13a005422b86606
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.31.0 published on Monday, Apr 15, 2024 by Pulumi