aws.ec2.TrafficMirrorTarget
Explore with Pulumi AI
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.
Constructor 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The TrafficMirrorTarget resource accepts the following input properties:
- Description string
- A description of the traffic mirror session.
- GatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- NetworkInterface stringId 
- The network interface ID that is associated with the target.
- NetworkLoad stringBalancer Arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- Dictionary<string, string>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- Description string
- A description of the traffic mirror session.
- GatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- NetworkInterface stringId 
- The network interface ID that is associated with the target.
- NetworkLoad stringBalancer Arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- map[string]string
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- description String
- A description of the traffic mirror session.
- gatewayLoad StringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface StringId 
- The network interface ID that is associated with the target.
- networkLoad StringBalancer Arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- Map<String,String>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- description string
- A description of the traffic mirror session.
- gatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface stringId 
- The network interface ID that is associated with the target.
- networkLoad stringBalancer Arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- {[key: string]: string}
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- description str
- A description of the traffic mirror session.
- gateway_load_ strbalancer_ endpoint_ id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- network_interface_ strid 
- The network interface ID that is associated with the target.
- network_load_ strbalancer_ arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- Mapping[str, str]
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- description String
- A description of the traffic mirror session.
- gatewayLoad StringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface StringId 
- The network interface ID that is associated with the target.
- networkLoad StringBalancer Arn 
- The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target.
- Map<String>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould 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.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- 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.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- 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.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- 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.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- 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.
- Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- 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.
- Map<String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
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) -> TrafficMirrorTargetfunc 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)resources:  _:    type: aws:ec2:TrafficMirrorTarget    get:      id: ${id}- 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.
- Arn string
- The ARN of the traffic mirror target.
- Description string
- A description of the traffic mirror session.
- GatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- NetworkInterface stringId 
- The network interface ID that is associated with the target.
- NetworkLoad stringBalancer Arn 
- 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.
- Dictionary<string, string>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- Arn string
- The ARN of the traffic mirror target.
- Description string
- A description of the traffic mirror session.
- GatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- NetworkInterface stringId 
- The network interface ID that is associated with the target.
- NetworkLoad stringBalancer Arn 
- 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.
- map[string]string
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn String
- The ARN of the traffic mirror target.
- description String
- A description of the traffic mirror session.
- gatewayLoad StringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface StringId 
- The network interface ID that is associated with the target.
- networkLoad StringBalancer Arn 
- 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.
- Map<String,String>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn string
- The ARN of the traffic mirror target.
- description string
- A description of the traffic mirror session.
- gatewayLoad stringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface stringId 
- The network interface ID that is associated with the target.
- networkLoad stringBalancer Arn 
- 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.
- {[key: string]: string}
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn str
- The ARN of the traffic mirror target.
- description str
- A description of the traffic mirror session.
- gateway_load_ strbalancer_ endpoint_ id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- network_interface_ strid 
- The network interface ID that is associated with the target.
- network_load_ strbalancer_ arn 
- 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.
- Mapping[str, str]
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- arn String
- The ARN of the traffic mirror target.
- description String
- A description of the traffic mirror session.
- gatewayLoad StringBalancer Endpoint Id 
- The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target.
- networkInterface StringId 
- The network interface ID that is associated with the target.
- networkLoad StringBalancer Arn 
- 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.
- Map<String>
- Key-value map of resource tags. If configured with a provider - default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.- NOTE: Either - network_interface_idor- network_load_balancer_arnshould be specified and both should not be specified together
- Map<String>
- A map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
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 awsTerraform Provider.