Class Listener
Provides a Load Balancer Listener resource.
Note:
aws.alb.Listeneris known asaws.lb.Listener. The functionality is identical.
Example Usage
Forward Action
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
{
});
var frontEndTargetGroup = new Aws.LB.TargetGroup("frontEndTargetGroup", new Aws.LB.TargetGroupArgs
{
});
var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
{
CertificateArn = "arn:aws:iam::187416307283:server-certificate/test_cert_rab3wuqwgja25ct3n4jdj2tzu4",
DefaultActions =
{
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
TargetGroupArn = frontEndTargetGroup.Arn,
Type = "forward",
},
},
LoadBalancerArn = frontEndLoadBalancer.Arn,
Port = "443",
Protocol = "HTTPS",
SslPolicy = "ELBSecurityPolicy-2016-08",
});
}
}
Redirect Action
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
{
});
var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
{
DefaultActions =
{
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
Redirect = new Aws.LB.Inputs.ListenerDefaultActionRedirectArgs
{
Port = "443",
Protocol = "HTTPS",
StatusCode = "HTTP_301",
},
Type = "redirect",
},
},
LoadBalancerArn = frontEndLoadBalancer.Arn,
Port = "80",
Protocol = "HTTP",
});
}
}
Fixed-response Action
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
{
});
var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
{
DefaultActions =
{
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
FixedResponse = new Aws.LB.Inputs.ListenerDefaultActionFixedResponseArgs
{
ContentType = "text/plain",
MessageBody = "Fixed response content",
StatusCode = "200",
},
Type = "fixed-response",
},
},
LoadBalancerArn = frontEndLoadBalancer.Arn,
Port = "80",
Protocol = "HTTP",
});
}
}
Authenticate-cognito Action
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
{
});
var frontEndTargetGroup = new Aws.LB.TargetGroup("frontEndTargetGroup", new Aws.LB.TargetGroupArgs
{
});
var pool = new Aws.Cognito.UserPool("pool", new Aws.Cognito.UserPoolArgs
{
});
var client = new Aws.Cognito.UserPoolClient("client", new Aws.Cognito.UserPoolClientArgs
{
});
var domain = new Aws.Cognito.UserPoolDomain("domain", new Aws.Cognito.UserPoolDomainArgs
{
});
var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
{
DefaultActions =
{
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
AuthenticateCognito = new Aws.LB.Inputs.ListenerDefaultActionAuthenticateCognitoArgs
{
UserPoolArn = pool.Arn,
UserPoolClientId = client.Id,
UserPoolDomain = domain.Domain,
},
Type = "authenticate-cognito",
},
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
TargetGroupArn = frontEndTargetGroup.Arn,
Type = "forward",
},
},
LoadBalancerArn = frontEndLoadBalancer.Arn,
Port = "80",
Protocol = "HTTP",
});
}
}
Authenticate-oidc Action
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
{
});
var frontEndTargetGroup = new Aws.LB.TargetGroup("frontEndTargetGroup", new Aws.LB.TargetGroupArgs
{
});
var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
{
DefaultActions =
{
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
AuthenticateOidc = new Aws.LB.Inputs.ListenerDefaultActionAuthenticateOidcArgs
{
AuthorizationEndpoint = "https://example.com/authorization_endpoint",
ClientId = "client_id",
ClientSecret = "client_secret",
Issuer = "https://example.com",
TokenEndpoint = "https://example.com/token_endpoint",
UserInfoEndpoint = "https://example.com/user_info_endpoint",
},
Type = "authenticate-oidc",
},
new Aws.LB.Inputs.ListenerDefaultActionArgs
{
TargetGroupArn = frontEndTargetGroup.Arn,
Type = "forward",
},
},
LoadBalancerArn = frontEndLoadBalancer.Arn,
Port = "80",
Protocol = "HTTP",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.ApplicationLoadBalancing
Assembly: Pulumi.Aws.dll
Syntax
[Obsolete("aws.applicationloadbalancing.Listener has been deprecated in favor of aws.alb.Listener")]
public class Listener : CustomResource
Constructors
View SourceListener(String, ListenerArgs, CustomResourceOptions)
Create a Listener resource with the given unique name, arguments, and options.
Declaration
public Listener(string name, ListenerArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| ListenerArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
The ARN of the listener (matches id)
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CertificateArn
The ARN of the default SSL server certificate. Exactly one certificate is required if the protocol is HTTPS. For adding additional SSL certificates, see the aws.lb.ListenerCertificate resource.
Declaration
public Output<string> CertificateArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DefaultActions
An Action block. Action blocks are documented below.
Declaration
public Output<ImmutableArray<ListenerDefaultAction>> DefaultActions { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<ListenerDefaultAction>> |
LoadBalancerArn
The ARN of the load balancer.
Declaration
public Output<string> LoadBalancerArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Port
The port on which the load balancer is listening.
Declaration
public Output<int> Port { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Protocol
The protocol for connections from clients to the load balancer. Valid values are TCP, TLS, UDP, TCP_UDP, HTTP and HTTPS. Defaults to HTTP.
Declaration
public Output<string> Protocol { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SslPolicy
The name of the SSL Policy for the listener. Required if protocol is HTTPS or TLS.
Declaration
public Output<string> SslPolicy { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, ListenerState, CustomResourceOptions)
Get an existing Listener resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Listener Get(string name, Input<string> id, ListenerState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| ListenerState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Listener |