1. Packages
  2. AWS Classic
  3. API Docs
  4. globalaccelerator
  5. Listener

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

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.globalaccelerator.Listener

Explore with Pulumi AI

aws logo

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

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

    Provides a Global Accelerator listener.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.globalaccelerator.Accelerator("example", {
        name: "Example",
        ipAddressType: "IPV4",
        enabled: true,
        attributes: {
            flowLogsEnabled: true,
            flowLogsS3Bucket: "example-bucket",
            flowLogsS3Prefix: "flow-logs/",
        },
    });
    const exampleListener = new aws.globalaccelerator.Listener("example", {
        acceleratorArn: example.id,
        clientAffinity: "SOURCE_IP",
        protocol: "TCP",
        portRanges: [{
            fromPort: 80,
            toPort: 80,
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.globalaccelerator.Accelerator("example",
        name="Example",
        ip_address_type="IPV4",
        enabled=True,
        attributes=aws.globalaccelerator.AcceleratorAttributesArgs(
            flow_logs_enabled=True,
            flow_logs_s3_bucket="example-bucket",
            flow_logs_s3_prefix="flow-logs/",
        ))
    example_listener = aws.globalaccelerator.Listener("example",
        accelerator_arn=example.id,
        client_affinity="SOURCE_IP",
        protocol="TCP",
        port_ranges=[aws.globalaccelerator.ListenerPortRangeArgs(
            from_port=80,
            to_port=80,
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/globalaccelerator"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := globalaccelerator.NewAccelerator(ctx, "example", &globalaccelerator.AcceleratorArgs{
    			Name:          pulumi.String("Example"),
    			IpAddressType: pulumi.String("IPV4"),
    			Enabled:       pulumi.Bool(true),
    			Attributes: &globalaccelerator.AcceleratorAttributesArgs{
    				FlowLogsEnabled:  pulumi.Bool(true),
    				FlowLogsS3Bucket: pulumi.String("example-bucket"),
    				FlowLogsS3Prefix: pulumi.String("flow-logs/"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = globalaccelerator.NewListener(ctx, "example", &globalaccelerator.ListenerArgs{
    			AcceleratorArn: example.ID(),
    			ClientAffinity: pulumi.String("SOURCE_IP"),
    			Protocol:       pulumi.String("TCP"),
    			PortRanges: globalaccelerator.ListenerPortRangeArray{
    				&globalaccelerator.ListenerPortRangeArgs{
    					FromPort: pulumi.Int(80),
    					ToPort:   pulumi.Int(80),
    				},
    			},
    		})
    		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 example = new Aws.GlobalAccelerator.Accelerator("example", new()
        {
            Name = "Example",
            IpAddressType = "IPV4",
            Enabled = true,
            Attributes = new Aws.GlobalAccelerator.Inputs.AcceleratorAttributesArgs
            {
                FlowLogsEnabled = true,
                FlowLogsS3Bucket = "example-bucket",
                FlowLogsS3Prefix = "flow-logs/",
            },
        });
    
        var exampleListener = new Aws.GlobalAccelerator.Listener("example", new()
        {
            AcceleratorArn = example.Id,
            ClientAffinity = "SOURCE_IP",
            Protocol = "TCP",
            PortRanges = new[]
            {
                new Aws.GlobalAccelerator.Inputs.ListenerPortRangeArgs
                {
                    FromPort = 80,
                    ToPort = 80,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.globalaccelerator.Accelerator;
    import com.pulumi.aws.globalaccelerator.AcceleratorArgs;
    import com.pulumi.aws.globalaccelerator.inputs.AcceleratorAttributesArgs;
    import com.pulumi.aws.globalaccelerator.Listener;
    import com.pulumi.aws.globalaccelerator.ListenerArgs;
    import com.pulumi.aws.globalaccelerator.inputs.ListenerPortRangeArgs;
    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 example = new Accelerator("example", AcceleratorArgs.builder()        
                .name("Example")
                .ipAddressType("IPV4")
                .enabled(true)
                .attributes(AcceleratorAttributesArgs.builder()
                    .flowLogsEnabled(true)
                    .flowLogsS3Bucket("example-bucket")
                    .flowLogsS3Prefix("flow-logs/")
                    .build())
                .build());
    
            var exampleListener = new Listener("exampleListener", ListenerArgs.builder()        
                .acceleratorArn(example.id())
                .clientAffinity("SOURCE_IP")
                .protocol("TCP")
                .portRanges(ListenerPortRangeArgs.builder()
                    .fromPort(80)
                    .toPort(80)
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:globalaccelerator:Accelerator
        properties:
          name: Example
          ipAddressType: IPV4
          enabled: true
          attributes:
            flowLogsEnabled: true
            flowLogsS3Bucket: example-bucket
            flowLogsS3Prefix: flow-logs/
      exampleListener:
        type: aws:globalaccelerator:Listener
        name: example
        properties:
          acceleratorArn: ${example.id}
          clientAffinity: SOURCE_IP
          protocol: TCP
          portRanges:
            - fromPort: 80
              toPort: 80
    

    Create Listener Resource

    new Listener(name: string, args: ListenerArgs, opts?: CustomResourceOptions);
    @overload
    def Listener(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 accelerator_arn: Optional[str] = None,
                 client_affinity: Optional[str] = None,
                 port_ranges: Optional[Sequence[ListenerPortRangeArgs]] = None,
                 protocol: Optional[str] = None)
    @overload
    def Listener(resource_name: str,
                 args: ListenerArgs,
                 opts: Optional[ResourceOptions] = None)
    func NewListener(ctx *Context, name string, args ListenerArgs, opts ...ResourceOption) (*Listener, error)
    public Listener(string name, ListenerArgs args, CustomResourceOptions? opts = null)
    public Listener(String name, ListenerArgs args)
    public Listener(String name, ListenerArgs args, CustomResourceOptions options)
    
    type: aws:globalaccelerator:Listener
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ListenerArgs
    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 ListenerArgs
    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 ListenerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Listener 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 Listener resource accepts the following input properties:

    AcceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    PortRanges List<ListenerPortRange>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    Protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    ClientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    AcceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    PortRanges []ListenerPortRangeArgs
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    Protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    ClientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    acceleratorArn String
    The Amazon Resource Name (ARN) of your accelerator.
    portRanges List<ListenerPortRange>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol String
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    clientAffinity String
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    acceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    portRanges ListenerPortRange[]
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    clientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    accelerator_arn str
    The Amazon Resource Name (ARN) of your accelerator.
    port_ranges Sequence[ListenerPortRangeArgs]
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol str
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    client_affinity str
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    acceleratorArn String
    The Amazon Resource Name (ARN) of your accelerator.
    portRanges List<Property Map>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol String
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    clientAffinity String
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Listener Resource

    Get an existing Listener 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?: ListenerState, opts?: CustomResourceOptions): Listener
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            accelerator_arn: Optional[str] = None,
            client_affinity: Optional[str] = None,
            port_ranges: Optional[Sequence[ListenerPortRangeArgs]] = None,
            protocol: Optional[str] = None) -> Listener
    func GetListener(ctx *Context, name string, id IDInput, state *ListenerState, opts ...ResourceOption) (*Listener, error)
    public static Listener Get(string name, Input<string> id, ListenerState? state, CustomResourceOptions? opts = null)
    public static Listener get(String name, Output<String> id, ListenerState 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:
    AcceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    ClientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    PortRanges List<ListenerPortRange>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    Protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    AcceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    ClientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    PortRanges []ListenerPortRangeArgs
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    Protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    acceleratorArn String
    The Amazon Resource Name (ARN) of your accelerator.
    clientAffinity String
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    portRanges List<ListenerPortRange>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol String
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    acceleratorArn string
    The Amazon Resource Name (ARN) of your accelerator.
    clientAffinity string
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    portRanges ListenerPortRange[]
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol string
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    accelerator_arn str
    The Amazon Resource Name (ARN) of your accelerator.
    client_affinity str
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    port_ranges Sequence[ListenerPortRangeArgs]
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol str
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.
    acceleratorArn String
    The Amazon Resource Name (ARN) of your accelerator.
    clientAffinity String
    Direct all requests from a user to the same endpoint. Valid values are NONE, SOURCE_IP. Default: NONE. If NONE, Global Accelerator uses the "five-tuple" properties of source IP address, source port, destination IP address, destination port, and protocol to select the hash value. If SOURCE_IP, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
    portRanges List<Property Map>
    The list of port ranges for the connections from clients to the accelerator. Fields documented below.
    protocol String
    The protocol for the connections from clients to the accelerator. Valid values are TCP, UDP.

    Supporting Types

    ListenerPortRange, ListenerPortRangeArgs

    FromPort int
    The first port in the range of ports, inclusive.
    ToPort int
    The last port in the range of ports, inclusive.
    FromPort int
    The first port in the range of ports, inclusive.
    ToPort int
    The last port in the range of ports, inclusive.
    fromPort Integer
    The first port in the range of ports, inclusive.
    toPort Integer
    The last port in the range of ports, inclusive.
    fromPort number
    The first port in the range of ports, inclusive.
    toPort number
    The last port in the range of ports, inclusive.
    from_port int
    The first port in the range of ports, inclusive.
    to_port int
    The last port in the range of ports, inclusive.
    fromPort Number
    The first port in the range of ports, inclusive.
    toPort Number
    The last port in the range of ports, inclusive.

    Import

    Using pulumi import, import Global Accelerator listeners using the id. For example:

    $ pulumi import aws:globalaccelerator/listener:Listener example arn:aws:globalaccelerator::111111111111:accelerator/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/listener/xxxxxxxx
    

    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.28.1 published on Thursday, Mar 28, 2024 by Pulumi