aws.globalaccelerator.Listener
Explore with Pulumi AI
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={
"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=[{
"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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Listener(name: string, args: ListenerArgs, opts?: CustomResourceOptions);
@overload
def Listener(resource_name: str,
args: ListenerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Listener(resource_name: str,
opts: Optional[ResourceOptions] = None,
accelerator_arn: Optional[str] = None,
port_ranges: Optional[Sequence[ListenerPortRangeArgs]] = None,
protocol: Optional[str] = None,
client_affinity: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var awsListenerResource = new Aws.GlobalAccelerator.Listener("awsListenerResource", new()
{
AcceleratorArn = "string",
PortRanges = new[]
{
new Aws.GlobalAccelerator.Inputs.ListenerPortRangeArgs
{
FromPort = 0,
ToPort = 0,
},
},
Protocol = "string",
ClientAffinity = "string",
});
example, err := globalaccelerator.NewListener(ctx, "awsListenerResource", &globalaccelerator.ListenerArgs{
AcceleratorArn: pulumi.String("string"),
PortRanges: globalaccelerator.ListenerPortRangeArray{
&globalaccelerator.ListenerPortRangeArgs{
FromPort: pulumi.Int(0),
ToPort: pulumi.Int(0),
},
},
Protocol: pulumi.String("string"),
ClientAffinity: pulumi.String("string"),
})
var awsListenerResource = new Listener("awsListenerResource", ListenerArgs.builder()
.acceleratorArn("string")
.portRanges(ListenerPortRangeArgs.builder()
.fromPort(0)
.toPort(0)
.build())
.protocol("string")
.clientAffinity("string")
.build());
aws_listener_resource = aws.globalaccelerator.Listener("awsListenerResource",
accelerator_arn="string",
port_ranges=[{
"fromPort": 0,
"toPort": 0,
}],
protocol="string",
client_affinity="string")
const awsListenerResource = new aws.globalaccelerator.Listener("awsListenerResource", {
acceleratorArn: "string",
portRanges: [{
fromPort: 0,
toPort: 0,
}],
protocol: "string",
clientAffinity: "string",
});
type: aws:globalaccelerator:Listener
properties:
acceleratorArn: string
clientAffinity: string
portRanges:
- fromPort: 0
toPort: 0
protocol: string
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:
- Accelerator
Arn string - The Amazon Resource Name (ARN) of your accelerator.
- Port
Ranges List<ListenerPort Range> - 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
. - Client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
- Accelerator
Arn string - The Amazon Resource Name (ARN) of your accelerator.
- Port
Ranges []ListenerPort Range Args - 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
. - Client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
- accelerator
Arn String - The Amazon Resource Name (ARN) of your accelerator.
- port
Ranges List<ListenerPort Range> - 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
. - client
Affinity String - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
- accelerator
Arn string - The Amazon Resource Name (ARN) of your accelerator.
- port
Ranges ListenerPort Range[] - 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
. - client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_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[ListenerPort Range Args] - 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
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value.
- accelerator
Arn String - The Amazon Resource Name (ARN) of your accelerator.
- port
Ranges 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
. - client
Affinity String - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_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.
- Accelerator
Arn string - The Amazon Resource Name (ARN) of your accelerator.
- Client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value. - Port
Ranges List<ListenerPort Range> - 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 string - The Amazon Resource Name (ARN) of your accelerator.
- Client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value. - Port
Ranges []ListenerPort Range Args - 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 String - The Amazon Resource Name (ARN) of your accelerator.
- client
Affinity String - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value. - port
Ranges List<ListenerPort Range> - 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 string - The Amazon Resource Name (ARN) of your accelerator.
- client
Affinity string - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value. - port
Ranges ListenerPort Range[] - 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
. IfNONE
, 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. IfSOURCE_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[ListenerPort Range Args] - 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
.
- accelerator
Arn String - The Amazon Resource Name (ARN) of your accelerator.
- client
Affinity String - Direct all requests from a user to the same endpoint. Valid values are
NONE
,SOURCE_IP
. Default:NONE
. IfNONE
, 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. IfSOURCE_IP
, Global Accelerator uses the "two-tuple" properties of source (client) IP address and destination IP address to select the hash value. - port
Ranges 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
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
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.