Class LoadBalancer
Provides a Load Balancer resource.
Note:
aws.alb.LoadBalanceris known asaws.lb.LoadBalancer. The functionality is identical.
Example Usage
Application Load Balancer
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var test = new Aws.LB.LoadBalancer("test", new Aws.LB.LoadBalancerArgs
{
AccessLogs = new Aws.LB.Inputs.LoadBalancerAccessLogsArgs
{
Bucket = aws_s3_bucket.Lb_logs.Bucket,
Enabled = true,
Prefix = "test-lb",
},
EnableDeletionProtection = true,
Internal = false,
LoadBalancerType = "application",
SecurityGroups =
{
aws_security_group.Lb_sg.Id,
},
Subnets =
{
aws_subnet.Public.Select(__item => __item.Id).ToList(),
},
Tags =
{
{ "Environment", "production" },
},
});
}
}
Network Load Balancer
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var test = new Aws.LB.LoadBalancer("test", new Aws.LB.LoadBalancerArgs
{
EnableDeletionProtection = true,
Internal = false,
LoadBalancerType = "network",
Subnets =
{
aws_subnet.Public.Select(__item => __item.Id).ToList(),
},
Tags =
{
{ "Environment", "production" },
},
});
}
}
Specifying Elastic IPs
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.LB.LoadBalancer("example", new Aws.LB.LoadBalancerArgs
{
LoadBalancerType = "network",
SubnetMappings =
{
new Aws.LB.Inputs.LoadBalancerSubnetMappingArgs
{
AllocationId = aws_eip.Example1.Id,
SubnetId = aws_subnet.Example1.Id,
},
new Aws.LB.Inputs.LoadBalancerSubnetMappingArgs
{
AllocationId = aws_eip.Example2.Id,
SubnetId = aws_subnet.Example2.Id,
},
},
});
}
}
Inherited Members
Namespace: Pulumi.Aws.ApplicationLoadBalancing
Assembly: Pulumi.Aws.dll
Syntax
[Obsolete("aws.applicationloadbalancing.LoadBalancer has been deprecated in favor of aws.alb.LoadBalancer")]
public class LoadBalancer : CustomResource
Constructors
View SourceLoadBalancer(String, LoadBalancerArgs, CustomResourceOptions)
Create a LoadBalancer resource with the given unique name, arguments, and options.
Declaration
public LoadBalancer(string name, LoadBalancerArgs args = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| LoadBalancerArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAccessLogs
An Access Logs block. Access Logs documented below.
Declaration
public Output<LoadBalancerAccessLogs> AccessLogs { get; }
Property Value
| Type | Description |
|---|---|
| Output<LoadBalancerAccessLogs> |
Arn
The ARN of the load balancer (matches id).
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ArnSuffix
The ARN suffix for use with CloudWatch Metrics.
Declaration
public Output<string> ArnSuffix { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DnsName
The DNS name of the load balancer.
Declaration
public Output<string> DnsName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DropInvalidHeaderFields
Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type application.
Declaration
public Output<bool?> DropInvalidHeaderFields { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
EnableCrossZoneLoadBalancing
If true, cross-zone load balancing of the load balancer will be enabled.
This is a network load balancer feature. Defaults to false.
Declaration
public Output<bool?> EnableCrossZoneLoadBalancing { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
EnableDeletionProtection
If true, deletion of the load balancer will be disabled via
the AWS API. This will prevent this provider from deleting the load balancer. Defaults to false.
Declaration
public Output<bool?> EnableDeletionProtection { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
EnableHttp2
Indicates whether HTTP/2 is enabled in application load balancers. Defaults to true.
Declaration
public Output<bool?> EnableHttp2 { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
IdleTimeout
The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application. Default: 60.
Declaration
public Output<int?> IdleTimeout { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
Internal
If true, the LB will be internal.
Declaration
public Output<bool> Internal { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Boolean> |
IpAddressType
The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack
Declaration
public Output<string> IpAddressType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LoadBalancerType
The type of load balancer to create. Possible values are application or network. The default value is application.
Declaration
public Output<string> LoadBalancerType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters,
must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified,
this provider will autogenerate a name beginning with tf-lb.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NamePrefix
Creates a unique name beginning with the specified prefix. Conflicts with name.
Declaration
public Output<string> NamePrefix { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SecurityGroups
A list of security group IDs to assign to the LB. Only valid for Load Balancers of type application.
Declaration
public Output<ImmutableArray<string>> SecurityGroups { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
SubnetMappings
A subnet mapping block as documented below.
Declaration
public Output<ImmutableArray<LoadBalancerSubnetMapping>> SubnetMappings { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<LoadBalancerSubnetMapping>> |
Subnets
A list of subnet IDs to attach to the LB. Subnets
cannot be updated for Load Balancers of type network. Changing this value
for load balancers of type network will force a recreation of the resource.
Declaration
public Output<ImmutableArray<string>> Subnets { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Tags
A map of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
VpcId
Declaration
public Output<string> VpcId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ZoneId
The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record).
Declaration
public Output<string> ZoneId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, LoadBalancerState, CustomResourceOptions)
Get an existing LoadBalancer resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static LoadBalancer Get(string name, Input<string> id, LoadBalancerState 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. |
| LoadBalancerState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| LoadBalancer |