Module classic/lb
Pulumi Elastic Load Balancing Components
Pulumi’s API’s for simplifying Elastic Load Balancing. The API provides a simple way to create either Application (ALB) or Network (NLB) load balancers, and their associated Target Groups and Listeners. For more details, see Application Load Balancers and Network Load Balancers.
Network Load Balancer
To create an NLB
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
// Creates an NLB associated with the default Vpc for this region. Pass 'external: true' to make the NLB
// externally accessible
const nlb1 = new awsx.lb.NetworkLoadBalancer("nlb1", { external: true });
// To create an NLB for a different Vpc, simply pass it in:
const vpc = new awsx.ec2.Vpc(...);
const nlb2 = new awsx.lb.NetworkLoadBalancer("nlb2", { vpc, external: true });
Once created, an NLB can be used to create both Listeners
and TargetGroups
. By default, a Listener needs at least one TargetGroup that it can route requests to. So, if a Listener is created without specifying a TargetGroup, one will be automatically created. For example:
// continuing from above. Manually create the target group and the listener.
const tg1 = nlb1.createTargetGroup("tg1", { port: 8080 });
const listener1 = tg1.createListener("listener1", { port: 80 });
// or, create a listener and have the target group automatically created. In this case, the port
// will automatically be the same for the listener and target group.
const listener2 = nlb1.createListener("listener2", { port: 80 });
// in both these cases the 'defaultAction' of the Listeners will be to 'forward' requests to the explicit
// or implicit target group they are associated with. To have the listener do something different, supply
// a preferred 'defaultAction' manually. For example:
const listener3 = nlb1.createListener(`redirecthttp`, {
port: 80,
protocol: "HTTP",
defaultAction: {
type: "redirect",
redirect: {
protocol: "HTTPS",
port: "443",
statusCode: "HTTP_301",
},
},
});
Listeners and TargetGroups are automatically setup to operate well with the awsx ecs
module. Specifically, once a Listener (or an associated TargetGroup) has been created, it can be used directly by the ECS module to automatically setup the correct information for both an ECS Container
or Service
. Specifically, a Listener or TargetGroup can be provided in a Container definition. If so, it (and its associated LoadBalancer) will be queried to map the right ports and automatically connect to the load balancer. This can be done like so:
// Continuing from above.
// Need a cluster for ecs or fargate services to pull instances from. This cluster will be
// associated with the default VPC for the region. To override that, pass in a VPC manually.
const cluster = new awsx.ecs.Cluster("testing");
// Create a listener to handle requests coming in on port 80. This will automatically create a
// target group that also forwards the requests to targets in it at the same port.
const nginxListener = nlb1.createListener("nginx", { port: 80 });
// Create a Service pointing to the well known 'nginx' image. Supply the listener we just created
// in the `portMappings` section. This will both properly connect the service and launched instances
// to the target group.
//
// For a Fargate service just replace this with `new awsx.ecs.FargateService`.
const nginx = new awsx.ecs.EC2Service("examples-nginx", {
cluster,
taskDefinitionArgs: {
containers: {
nginx: {
image: "nginx",
memory: 128,
portMappings: [nginxListener],
},
},
},
desiredCount: 2,
});
Application Load Balancers
ALBs follow the same pattern above as NLBs. To create and use them, simply replace usages of Network
above with Application
. i.e. instead of new awsx.lb.NetworkLoadBalancer
use new awsx.lb.ApplicationLoadBalancer
.
For detailed reference documentation, please visit the API docs.
Resources
Others
- ApplicationListener
- ApplicationListenerArgs
- ApplicationLoadBalancer
- ApplicationLoadBalancerArgs
- ApplicationProtocol
- ApplicationTargetGroup
- ApplicationTargetGroupArgs
- ApplicationTargetGroupHealthCheck
- isLoadBalancerTargetInfoProvider
- ListenerActions
- ListenerArgs
- ListenerDefaultAction
- ListenerDefaultActionArgs
- ListenerEndpoint
- ListenerRuleArgs
- LoadBalancerArgs
- LoadBalancerSubnets
- LoadBalancerTarget
- LoadBalancerTargetInfo
- LoadBalancerTargetInfoProvider
- metrics
- NetworkListener
- NetworkListenerArgs
- NetworkLoadBalancer
- NetworkLoadBalancerArgs
- NetworkProtocol
- NetworkTargetGroup
- NetworkTargetGroupArgs
- NetworkTargetGroupHealthCheck
- TargetGroupArgs
- TargetGroupAttachmentArgs
- TargetGroupHealthCheck
- TargetType
Resources
Resource Listener
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider
constructor
new Listener(type: string, name: string, defaultListenerAction: ListenerDefaultAction | undefined, args: ListenerArgs, opts: ComponentResourceOptions)
method addListenerRule
public addListenerRule(name: string, args: ListenerRuleArgs, opts?: pulumi.ComponentResourceOptions): ListenerRule
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the defaultTargetGroup
for this Listener.
method containerLoadBalancer
public containerLoadBalancer(name: string, parent: Resource): Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(name: string, parent: Resource): Input<PortMapping>
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property defaultTargetGroup
public defaultTargetGroup?: TargetGroup;
property endpoint
public endpoint: pulumi.Output<ListenerEndpoint>;
property listener
public listener: Listener;
property loadBalancer
public loadBalancer: LoadBalancer;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource ListenerRule
class ListenerRule extends ComponentResource
The rules that you define for your listener determine how the load balancer routes requests to the targets in one or more target groups.
Each rule consists of a priority, one or more actions, an optional host condition, and an optional path condition. For more information, see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html
constructor
new ListenerRule(name: string, listener: Listener, args: ListenerRuleArgs, opts: ComponentResourceOptions)
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listenerRule
public listenerRule: ListenerRule;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource LoadBalancer
class LoadBalancer extends ComponentResource
constructor
new LoadBalancer(type: string, name: string, args: LoadBalancerArgs, opts: ComponentResourceOptions)
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the first listener
of this LoadBalancer. If there are multiple
listeners
you can add a target to specific listener to by calling .attachTarget
directly
on it.
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: Listener[] = [];
property loadBalancer
public loadBalancer: LoadBalancer;
property securityGroups
public securityGroups: SecurityGroup[];
property targetGroups
public targetGroups: TargetGroup[] = [];
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
Resource TargetGroup
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider, ListenerDefaultAction, ListenerActions
constructor
new TargetGroup(type: string, name: string, loadBalancer: LoadBalancer, args: TargetGroupArgs, opts: ComponentResourceOptions)
method actions
public actions()
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to this target group. See Register-Targets for more details.
method containerLoadBalancer
public containerLoadBalancer(): pulumi.Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(): pulumi.Input<PortMapping>
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method listenerDefaultAction
public listenerDefaultAction(): pulumi.Input<ListenerDefaultActionArgs>
method registerListener
public registerListener(listener: Listener): void
Do not call directly. Intended for use by [Listener] and [ListenerRule]
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: Listener[] = [];
property loadBalancer
public loadBalancer: LoadBalancer;
property targetGroup
public targetGroup: TargetGroup;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
Resource TargetGroupAttachment
class TargetGroupAttachment extends ComponentResource
constructor
new TargetGroupAttachment(name: string, targetGroup: TargetGroup, args: LoadBalancerTarget, opts: ComponentResourceOptions)
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property func
public func?: aws.lambda.Function;
property permission
public permission?: aws.lambda.Permission;
property targetGroupAttachment
public targetGroupAttachment: TargetGroupAttachment;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Others
class ApplicationListener
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider
constructor
new ApplicationListener(name: string, args: ApplicationListenerArgs, opts: ComponentResourceOptions)
method addListenerRule
public addListenerRule(name: string, args: ListenerRuleArgs, opts?: pulumi.ComponentResourceOptions): ListenerRule
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the defaultTargetGroup
for this Listener.
method containerLoadBalancer
public containerLoadBalancer(name: string, parent: Resource): Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(name: string, parent: Resource): Input<PortMapping>
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property defaultTargetGroup
public defaultTargetGroup?: ApplicationTargetGroup;
property endpoint
public endpoint: pulumi.Output<ListenerEndpoint>;
property listener
public listener: Listener;
property loadBalancer
public loadBalancer: ApplicationLoadBalancer;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
interface ApplicationListenerArgs
interface ApplicationListenerArgs
property certificateArn
certificateArn?: pulumi.Input<string>;
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_listener_certificate
resource.
property defaultAction
defaultAction?: pulumi.Input<ListenerDefaultActionArgs> | ListenerDefaultAction;
An Action block. If neither this nor [defaultActions] is provided, a suitable defaultAction will be chosen that forwards to a new [ApplicationTargetGroup] created from [port].
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property defaultActions
defaultActions?: pulumi.Input<pulumi.Input<ListenerDefaultActionArgs>[]>;
An list of Action blocks. If neither this nor [defaultActions] is provided, a suitable defaultAction will be chosen that forwards to a new [ApplicationTargetGroup] created from [port].
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property external
external?: undefined | false | true;
If the listener should be available externally.
If this is [true] and the LoadBalancer for this Listener is [external=true], then this listener is available to the entire internet. If this is [true] and the LoadBalancer is [external=false], then this listener is available to everything in the LoadBalancer’s VPC. In both cases, the security groups for the ALB will all get ingress rules to the port for this listener from any IPv4 location.
If this is [false] then access will controlled entirely by the egress and ingress rules of the security groups of the LoadBalancer. No changes will be made to the security groups of the ALB.
Defaults to [true].
property listener
listener?: aws.lb.Listener;
An existing aws.lb.Listener to use for this awsx.lb.Listener. If not provided, one will be created.
property loadBalancer
loadBalancer?: ApplicationLoadBalancer | ApplicationLoadBalancerArgs;
The load balancer this listener is associated with. If not provided, a new load balancer will be automatically created.
property name
name?: undefined | string;
An explicit name to use for dependent resources. Specifically, if a LoadBalancer or TargetGroup is not provided, this name will be used to name those resources.
property port
port?: pulumi.Input<number>;
The port. Specify a value from 1
to 65535
. Computed from “protocol” if not provided.
property protocol
protocol?: pulumi.Input<ApplicationProtocol>;
The protocol. Valid values are HTTP
, HTTPS
. Computed from “port” if not provided.
property sslPolicy
sslPolicy?: pulumi.Input<string>;
The name of the SSL Policy for the listener. Required if protocol
is HTTPS
.
property targetGroup
targetGroup?: ApplicationTargetGroup | ApplicationTargetGroupArgs;
Target group this listener is associated with. This is used to determine the [defaultAction] for the listener.
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
class ApplicationLoadBalancer
class ApplicationLoadBalancer extends LoadBalancer
A application load balancer serves as the single point of contact for clients. The load balancer distributes incoming application traffic across multiple targets, such as EC2 instances, in multiple Availability Zones. This increases the availability of your application. You add one or more listeners to your load balancer.
See https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html for more details.
constructor
new ApplicationLoadBalancer(name: string, args: ApplicationLoadBalancerArgs, opts: ComponentResourceOptions)
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the first listener
of this LoadBalancer. If there are multiple
listeners
you can add a target to specific listener to by calling .attachTarget
directly
on it.
method createListener
public createListener(name: string, args: ApplicationListenerArgs, opts: ComponentResourceOptions): ApplicationListener
Creates a new listener for this [ApplicationLoadBalancer] see ApplicationListener for more details.
method createTargetGroup
public createTargetGroup(name: string, args: ApplicationTargetGroupArgs, opts: ComponentResourceOptions): ApplicationTargetGroup
Creates a target group for this [ApplicationLoadBalancer] see ApplicationTargetGroup for more details.
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: ApplicationListener[];
property loadBalancer
public loadBalancer: LoadBalancer;
property securityGroups
public securityGroups: SecurityGroup[];
property targetGroups
public targetGroups: ApplicationTargetGroup[];
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
interface ApplicationLoadBalancerArgs
interface ApplicationLoadBalancerArgs
property accessLogs
accessLogs?;
An Access Logs block. Access Logs documented below.
property enableDeletionProtection
enableDeletionProtection?: pulumi.Input<boolean>;
If true, deletion of the load balancer will be disabled via the AWS API. This will prevent
Terraform from deleting the load balancer. Defaults to false
.
property enableHttp2
enableHttp2?: pulumi.Input<boolean>;
Indicates whether HTTP/2 is enabled. Defaults to true
.
property external
external?: undefined | false | true;
Whether or not the load balancer is exposed to the internet. Defaults to true
if
unspecified.
property idleTimeout
idleTimeout?: pulumi.Input<number>;
The time in seconds that the connection is allowed to be idle. Default: 60.
property ipAddressType
ipAddressType?: pulumi.Input<"ipv4" | "dualstack">;
The type of IP addresses used by the subnets for your load balancer. The possible values are
ipv4
and dualstack
property loadBalancer
loadBalancer?: aws.lb.LoadBalancer;
An existing aws.lb.LoadBalancer to use for this awsx.lb.LoadBalancer. If this value is set then all other arguments are ignored. If not provided, one will be created.
property name
name?: undefined | string;
The name of the LoadBalancer. 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, the [name] parameter passed into the LoadBalancer constructor will be hashed and used as the name.
property securityGroups
securityGroups?: ec2.SecurityGroupOrId[];
A list of security group IDs to assign to the ALB. If not provided, a default instance will be created for the ALB. To prevent a default instance from being created, pass in an empty array here.
property subnetMappings
subnetMappings?;
A subnet mapping block as documented below.
property subnets
subnets?: pulumi.Input<pulumi.Input<string>[]> | LoadBalancerSubnets;
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.
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
type ApplicationProtocol
type ApplicationProtocol = "HTTP" | "HTTPS";
class ApplicationTargetGroup
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider, ListenerDefaultAction, ListenerActions
Each target group routes requests to one or more registered targets, such as EC2 instances, using the protocol and port number that you specify. You can register a target with multiple target groups. You can configure health checks on a per target group basis. Health checks are performed on all targets registered to a target group that is specified in a listener rule for your load balancer.
constructor
new ApplicationTargetGroup(name: string, args: ApplicationTargetGroupArgs, opts: ComponentResourceOptions)
method actions
public actions()
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to this target group. See Register-Targets for more details.
method containerLoadBalancer
public containerLoadBalancer(): pulumi.Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(): pulumi.Input<PortMapping>
method createListener
public createListener(name: string, args: ApplicationListenerArgs, opts: ComponentResourceOptions): ApplicationListener
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
public static isInstance(obj: any): obj is ApplicationTargetGroup
method listenerDefaultAction
public listenerDefaultAction(): pulumi.Input<ListenerDefaultActionArgs>
method registerListener
public registerListener(listener: Listener): void
Do not call directly. Intended for use by [Listener] and [ListenerRule]
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: ApplicationListener[];
property loadBalancer
public loadBalancer: ApplicationLoadBalancer;
property targetGroup
public targetGroup: TargetGroup;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
interface ApplicationTargetGroupArgs
interface ApplicationTargetGroupArgs
property deregistrationDelay
deregistrationDelay?: pulumi.Input<number>;
The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.
property healthCheck
healthCheck?: pulumi.Input<ApplicationTargetGroupHealthCheck>;
A Health Check block.
property loadBalancer
loadBalancer?: ApplicationLoadBalancer;
The load balancer this target group is associated with. If not provided, a new load balancer will be automatically created.
property name
name?: undefined | string;
The name of the TargetGroup. If not specified, the [name] parameter passed into the TargetGroup constructor will be hashed and used as the name. If a [loadBalancer] is not provided, this name will be used to name that resource as well.
property port
port?: pulumi.Input<number>;
The port to use to connect with the target. Valid values are either ports 1-65536. If unspecified will be inferred from the [protocol].
property protocol
protocol?: pulumi.Input<ApplicationProtocol>;
The protocol to use to connect with the target. If unspecified will be inferred from [port].
property proxyProtocolV2
proxyProtocolV2?: pulumi.Input<boolean>;
Boolean to enable / disable support for proxy protocol v2 on Network Load Balancers. See doc for more information.
property slowStart
slowStart?: pulumi.Input<number>;
The amount time for targets to warm up before the load balancer sends them a full share of requests. The range is 30-900 seconds or 0 to disable. The default value is 0 seconds.
property stickiness
stickiness?;
A Stickiness block. Stickiness blocks are documented below. stickiness
is only valid if
used with Load Balancers of type Application
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property targetGroup
targetGroup?: aws.lb.TargetGroup;
An existing aws.lb.TargetGroup to use for this awsx.lb.TargetGroup. If not provided, one will be created.
property targetType
targetType?: pulumi.Input<TargetType>;
The type of target that you must specify when registering targets with this target group. The
possible values are instance
(targets are specified by instance ID) or ip
(targets are
specified by IP address) or lambda
(targets are specified by lambda arn). The default is
ip
. Note that you can’t specify targets for a target group using both instance IDs and IP
addresses. If the target type is ip
, specify IP addresses from the subnets of the virtual
private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and
192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can’t specify publicly routable
IP addresses.
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
interface ApplicationTargetGroupHealthCheck
interface ApplicationTargetGroupHealthCheck extends TargetGroupHealthCheck
A Health Check block.
The Health Check parameters you can set vary by the protocol of the Target Group. See http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html for a complete reference. Keep in mind, that health checks produce actual requests to the backend. The underlying function is invoked when target_type is set to lambda.
property healthyThreshold
healthyThreshold?: pulumi.Input<number>;
The number of consecutive health checks successes required before considering an unhealthy target healthy. Defaults to 3.
property interval
interval?: pulumi.Input<number>;
The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. For lambda target groups, it needs to be greater as the [timeout] of the underlying [lambda]. Default 30 seconds.
property matcher
matcher?: pulumi.Input<string>;
The HTTP codes to use when checking for a successful response from a target. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”). Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP)
property path
path: pulumi.Input<string>;
(Required for HTTP/HTTPS ALB) The destination for the health check request.
property port
port?: pulumi.Input<string>;
The port to use to connect with the target.
property protocol
protocol?: pulumi.Input<string>;
The protocol to use to connect with the target. Defaults to HTTP. Not applicable when target_type is [lambda].
property timeout
timeout?: pulumi.Input<number>;
The amount of time, in seconds, during which no response means a failed health check. For Application Load Balancers, the range is 2 to 60 seconds and the default is 5 seconds.
property unhealthyThreshold
unhealthyThreshold?: pulumi.Input<number>;
The number of consecutive health check failures required before considering the target unhealthy. Defaults to 3.
function isLoadBalancerTargetInfoProvider
isLoadBalancerTargetInfoProvider(obj: any): obj is LoadBalancerTargetInfoProvider
interface ListenerActions
interface ListenerActions
method actions
actions()
method registerListener
registerListener(listener: Listener): void
interface ListenerArgs
interface ListenerArgs
property certificateArn
certificateArn?: pulumi.Input<string>;
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_listener_certificate
resource.
property defaultActions
defaultActions: pulumi.Input<pulumi.Input<ListenerDefaultActionArgs>[]>;
An list of Action blocks. See [ListenerDefaultActionArgs] for more information.
property listener
listener?: aws.lb.Listener;
An existing aws.lb.Listener to use for this awsx.lb.Listener. If not provided, one will be created.
property loadBalancer
loadBalancer: LoadBalancer;
property port
port: pulumi.Input<number>;
The port. Specify a value from 1
to 65535
.
property protocol
protocol: pulumi.Input<"HTTP" | "HTTPS" | "TCP" | "TLS" | "GENEVE" | "UDP" | "TCP_UDP">;
The protocol.
property sslPolicy
sslPolicy?: pulumi.Input<string>;
The name of the SSL Policy for the listener. Required if protocol
is HTTPS
.
interface ListenerDefaultAction
interface ListenerDefaultAction
method listenerDefaultAction
listenerDefaultAction(): pulumi.Input<ListenerDefaultActionArgs>
method registerListener
registerListener(listener: Listener): void
interface ListenerDefaultActionArgs
interface ListenerDefaultActionArgs
See https://www.terraform.io/docs/providers/aws/r/lb_listener.html#default_action
property authenticateCognito
authenticateCognito?: pulumi.Input<{
authenticationRequestExtraParams?: pulumi.Input<{[key: string]: any}>;
onUnauthenticatedRequest?: pulumi.Input<string>;
scope?: pulumi.Input<string>;
sessionCookieName?: pulumi.Input<string>;
sessionTimeout?: pulumi.Input<number>;
userPoolArn: pulumi.Input<string>;
userPoolClientId: pulumi.Input<string>;
userPoolDomain: pulumi.Input<string>;
}>;
property authenticateOidc
authenticateOidc?: pulumi.Input<{
authenticationRequestExtraParams?: pulumi.Input<{[key: string]: any}>;
authorizationEndpoint: pulumi.Input<string>;
clientId: pulumi.Input<string>;
clientSecret: pulumi.Input<string>;
issuer: pulumi.Input<string>;
onUnauthenticatedRequest?: pulumi.Input<string>;
scope?: pulumi.Input<string>;
sessionCookieName?: pulumi.Input<string>;
sessionTimeout?: pulumi.Input<number>;
tokenEndpoint: pulumi.Input<string>;
userInfoEndpoint: pulumi.Input<string>;
}>;
property fixedResponse
fixedResponse?: pulumi.Input<{
contentType: pulumi.Input<string>;
messageBody?: pulumi.Input<string>;
statusCode?: pulumi.Input<string>;
}>;
Information for creating an action that returns a custom HTTP response. Required if type is “fixed-response”.
property order
order?: pulumi.Input<number>;
property redirect
redirect?: pulumi.Input<{
host?: pulumi.Input<string>;
path?: pulumi.Input<string>;
port?: pulumi.Input<string>;
protocol?: pulumi.Input<string>;
query?: pulumi.Input<string>;
statusCode: pulumi.Input<string>;
}>;
Information for creating a redirect action. Required if type is “redirect”.
property targetGroupArn
targetGroupArn?: pulumi.Input<string>;
The ARN of the Target Group to which to route traffic. Required if type is “forward”.
property type
type: pulumi.Input<string>;
The type of routing action. Valid values are “forward”, “redirect”, “fixed-response”, “authenticate-cognito” and “authenticate-oidc”.
interface ListenerEndpoint
interface ListenerEndpoint
property hostname
hostname: string;
property port
port: number;
interface ListenerRuleArgs
interface ListenerRuleArgs
property actions
actions: | ListenerActions;
An Action block. Action blocks are documented below.
property conditions
conditions;
A Condition block. Condition blocks are documented below.
property priority
priority?: pulumi.Input<number>;
The priority for the rule between 1
and 50000
. Leaving it unset will automatically set the rule with next available priority after currently existing highest rule. A listener can’t have multiple rules with the same priority.
interface LoadBalancerArgs
interface LoadBalancerArgs
property enableDeletionProtection
enableDeletionProtection?: pulumi.Input<boolean>;
If true, deletion of the load balancer will be disabled via the AWS API. This will prevent
Terraform from deleting the load balancer. Defaults to false
.
property external
external?: undefined | false | true;
Whether or not the load balancer is exposed to the internet. Defaults to true
if
unspecified.
property ipAddressType
ipAddressType?: pulumi.Input<"ipv4" | "dualstack">;
The type of IP addresses used by the subnets for your load balancer. The possible values are
ipv4
and dualstack
property loadBalancer
loadBalancer?: aws.lb.LoadBalancer;
An existing aws.lb.LoadBalancer to use for this awsx.lb.LoadBalancer. If this value is set then all other arguments are ignored. If not provided, one will be created.
property loadBalancerType
loadBalancerType: pulumi.Input<"application" | "network">;
The type of load balancer to create. Possible values are application
or network
.
property name
name?: undefined | string;
property securityGroups
securityGroups?: ec2.SecurityGroupOrId[];
A list of security group IDs to assign to the LB. Only valid for Load Balancers of type
application
.
property subnetMappings
subnetMappings?;
A subnet mapping block as documented below.
property subnets
subnets?: pulumi.Input<pulumi.Input<string>[]> | LoadBalancerSubnets;
The subnets to use for the load balancer. If not provided, the appropriate external or internal subnets of the [network] will be used.
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
interface LoadBalancerSubnets
interface LoadBalancerSubnets
method subnets
subnets(): pulumi.Input<pulumi.Input<string>[]>
type LoadBalancerTarget
type LoadBalancerTarget = pulumi.Input<LoadBalancerTargetInfo> | LoadBalancerTargetInfoProvider | Instance | aws.lambda.EventHandler<apigateway.Request, apigateway.Response>;
The types of things that can be the target of a load balancer.
Note: A lambda event handler can only be supplied if using an application load balancer.
interface LoadBalancerTargetInfo
interface LoadBalancerTargetInfo
property availabilityZone
availabilityZone?: undefined | string;
The Availability Zone where the IP address of the target is to be registered.
property port
port?: undefined | number;
The port on which targets receive traffic.
property targetId
targetId: string;
The ID of the target. This is the Instance ID for an instance
, or the container ID for an
ECS container. If the target type is ip
, specify an IP address. If the target type is
lambda
, specify the arn of lambda.
interface LoadBalancerTargetInfoProvider
interface LoadBalancerTargetInfoProvider
method loadBalancerTargetInfo
loadBalancerTargetInfo(targetType: pulumi.Input<TargetType>): pulumi.Output<LoadBalancerTargetInfo>
namespace metrics
namespace application
function activeConnectionCount
activeConnectionCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of concurrent TCP connections active from clients to the load balancer and from the load balancer to targets. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions LoadBalancer
type ApplicationMetricName
type ApplicationMetricName = "ActiveConnectionCount" | "ClientTLSNegotiationErrorCount" | "ConsumedLCUs" | "HTTP_Fixed_Response_Count" | "HTTP_Redirect_Count" | "HTTP_Redirect_Url_Limit_Exceeded_Count" | "HTTPCode_ELB_3XX_Count" | "HTTPCode_ELB_4XX_Count" | "HTTPCode_ELB_5XX_Count" | "HTTPCode_ELB_500_Count" | "HTTPCode_ELB_502_Count" | "HTTPCode_ELB_503_Count" | "HTTPCode_ELB_504_Count" | "IPv6ProcessedBytes" | "IPv6RequestCount" | "NewConnectionCount" | "ProcessedBytes" | "RejectedConnectionCount" | "RequestCount" | "RuleEvaluations" | "HealthyHostCount" | "HTTPCode_Target_2XX_Count" | "HTTPCode_Target_3XX_Count" | "HTTPCode_Target_4XX_Count" | "HTTPCode_Target_5XX_Count" | "NonStickyRequestCount" | "RequestCountPerTarget" | "TargetConnectionErrorCount" | "TargetResponseTime" | "TargetTLSNegotiationErrorCount" | "UnHealthyHostCount";
function clientTLSNegotiationErrorCount
clientTLSNegotiationErrorCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of TLS connections initiated by the client that did not establish a session with the load balancer. Possible causes include a mismatch of ciphers or protocols. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: AvailabilityZone, LoadBalancer
function consumedLCUs
consumedLCUs(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of load balancer capacity units (LCU) used by your load balancer. You pay for the number of LCUs that you use per hour. For more information, see Elastic Load Balancing Pricing. Reporting criteria: Always reported
Statistics: All
Dimensions: LoadBalancer
interface ElasticLoadBalancingV2MetricChange
interface ElasticLoadBalancingV2MetricChange extends MetricChange
property availabilityZone
availabilityZone?: undefined | string;
Filters the metric data by Availability Zone.
property color
color?: pulumi.Input<string>;
The six-digit HTML hex color code to be used for this metric.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property dimensions
dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;
The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.
property extendedStatistic
extendedStatistic?: pulumi.Input<number>;
The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property label
label?: pulumi.Input<string>;
The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property loadBalancer
loadBalancer?: LoadBalancer | ApplicationLoadBalancer;
Filters the metric data by load balancer.
property period
period?: pulumi.Input<number>;
The new period in seconds over which the specified stat
is applied. If this object is
missing this property, then no change will be made. However, if the property is there by set
to [undefined] then the value will be set to the default (300s).
property statistic
statistic?: pulumi.Input<MetricStatistic>;
The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property targetGroup
targetGroup?: TargetGroup | ApplicationTargetGroup;
Filters the metric data by target group. If this is an [ApplicationTargetGroup] then [loadBalancer] does not have to be provided. If this is an [aws.lb.TargetGroup] then [loadBalancer] must be provided.
property unit
unit?: pulumi.Input<MetricUnit>;
The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property visible
visible?: pulumi.Input<boolean>;
Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property yAxis
yAxis?: pulumi.Input<"left" | "right">;
Where on the graph to display the y-axis for this metric. The default is left.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
function healthyHostCount
healthyHostCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of targets that are considered healthy. Reporting criteria: Reported if health checks are enabled
Statistics: The most useful statistics are Average, Minimum, and Maximum.
Dimensions: TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function httpCodeELB3XXCount
httpCodeELB3XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 3XX redirection codes that originate from the load balancer. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
Dimensions: LoadBalancer
function httpCodeELB4XXCount
httpCodeELB4XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 4XX client error codes that originate from the load balancer. Client errors are generated when requests are malformed or incomplete. These requests have not been received by the target. This count does not include any response codes generated by the targets. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer
function httpCodeELB500Count
httpCodeELB500Count(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 500 error codes that originate from the load balancer.
Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
function httpCodeELB502Count
httpCodeELB502Count(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 502 error codes that originate from the load balancer. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
function httpCodeELB503Count
httpCodeELB503Count(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 503 error codes that originate from the load balancer. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
function httpCodeELB504Count
httpCodeELB504Count(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 504 error codes that originate from the load balancer. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
function httpCodeELB5XXCount
httpCodeELB5XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP 5XX server error codes that originate from the load balancer. This count does not include any response codes generated by the targets. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer
function httpCodeTarget2XXCount
httpCodeTarget2XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP response codes generated by the targets. This does not include any response codes generated by the load balancer. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function httpCodeTarget3XXCount
httpCodeTarget3XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP response codes generated by the targets. This does not include any response codes generated by the load balancer. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function httpCodeTarget4XXCount
httpCodeTarget4XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP response codes generated by the targets. This does not include any response codes generated by the load balancer. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function httpCodeTarget5XXCount
httpCodeTarget5XXCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of HTTP response codes generated by the targets. This does not include any response codes generated by the load balancer. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function httpFixedResponseCount
httpFixedResponseCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of fixed-response actions that were successful. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
Dimensions: LoadBalancer
function httpRedirectCount
httpRedirectCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of redirect actions that were successful. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
Dimensions: LoadBalancer
function httpRedirectUrlLimitExceededCount
httpRedirectUrlLimitExceededCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of redirect actions that couldn’t be completed because the URL in the response location header is larger than 8K. Reporting criteria: There is a nonzero value
Statistics: The only meaningful statistic is Sum.
Dimensions: LoadBalancer
function ipv6ProcessedBytes
ipv6ProcessedBytes(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of bytes processed by the load balancer over IPv6. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer
function ipv6RequestCount
ipv6RequestCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of IPv6 requests received by the load balancer. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, and Average all return 1.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function metric
metric(metricName: ApplicationMetricName, change: ElasticLoadBalancingV2MetricChange): Metric
Creates an AWS/ApplicationELB metric with the requested [metricName]. See https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html for list of all metric-names.
Elastic Load Balancing publishes data points to Amazon CloudWatch for your load balancers and your targets. CloudWatch enables you to retrieve statistics about those data points as an ordered set of time-series data, known as metrics. Think of a metric as a variable to monitor, and the data points as the values of that variable over time. For example, you can monitor the total number of healthy targets for a load balancer over a specified time period. Each data point has an associated time stamp and an optional unit of measurement.
You can use metrics to verify that your system is performing as expected. For example, you can create a CloudWatch alarm to monitor a specified metric and initiate an action (such as sending a notification to an email address) if the metric goes outside what you consider an acceptable range.
Elastic Load Balancing reports metrics to CloudWatch only when requests are flowing through the load balancer. If there are requests flowing through the load balancer, Elastic Load Balancing measures and sends its metrics in 60-second intervals. If there are no requests flowing through the load balancer or no data for a metric, the metric is not reported.
To filter the metrics for your Application Load Balancer, use the following dimensions.
- “AvailabilityZone”: Filters the metric data by Availability Zone.
- “LoadBalancer”: Filters the metric data by load balancer. Specify the load balancer
using
LoadBalancer.arnSuffix
. - “TargetGroup”: Filters the metric data by target group. Specify the target group using
TargetGroup.arnSuffix
.
function newConnectionCount
newConnectionCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of new TCP connections established from clients to the load balancer and from the load balancer to targets. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer
function nonStickyRequestCount
nonStickyRequestCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of requests where the load balancer chose a new target because it couldn’t use an existing sticky session. For example, the request was the first request from a new client and no stickiness cookie was presented, a stickiness cookie was presented but it did not specify a target that was registered with this target group, the stickiness cookie was malformed or expired, or an internal error prevented the load balancer from reading the stickiness cookie. Reporting criteria: Stickiness is enabled on the target group.
Statistics: The only meaningful statistic is Sum.
function processedBytes
processedBytes(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of bytes processed by the load balancer over IPv4 and IPv6. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer
function rejectedConnectionCount
rejectedConnectionCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of connections that were rejected because the load balancer had reached its maximum number of connections. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer
function requestCount
requestCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of requests processed over IPv4 and IPv6. This count includes only the requests with a response generated by a target of the load balancer. Reporting criteria: Always reported
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function requestCountPerTarget
requestCountPerTarget(change?: ElasticLoadBalancingV2MetricChange): Metric
The average number of requests received by each target in a target group. You must specify the target group using the TargetGroup dimension. This metric does not apply if the target is a Lambda function. Reporting criteria: Always reported
Statistics: The only valid statistic is Sum. Note that this represents the average not the sum.
Dimensions: TargetGroup TargetGroup, LoadBalancer
function ruleEvaluations
ruleEvaluations(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of rules processed by the load balancer given a request rate averaged over an hour. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer
function targetConnectionErrorCount
targetConnectionErrorCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of connections that were not successfully established between the load balancer and target. This metric does not apply if the target is a Lambda function. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function targetResponseTime
targetResponseTime(change?: ElasticLoadBalancingV2MetricChange): Metric
The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received. This is equivalent to the target_processing_time field in the access logs. Reporting criteria: There is a nonzero value
Statistics: The most useful statistics are Average and pNN.NN (percentiles).
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function targetTLSNegotiationErrorCount
targetTLSNegotiationErrorCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of TLS connections initiated by the load balancer that did not establish a session with the target. Possible causes include a mismatch of ciphers or protocols. This metric does not apply if the target is a Lambda function. Reporting criteria: There is a nonzero value
Statistics: The most useful statistic is Sum.
Dimensions: LoadBalancer AvailabilityZone, LoadBalancer TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
function unHealthyHostCount
unHealthyHostCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of targets that are considered unhealthy. Reporting criteria: Reported if health checks are enabled
Statistics: The most useful statistics are Average, Minimum, and Maximum.
Dimensions: TargetGroup, LoadBalancer TargetGroup, AvailabilityZone, LoadBalancer
interface CoreMetricChange
interface CoreMetricChange extends MetricChange
property availabilityZone
availabilityZone?: undefined | string;
Filters the metric data by Availability Zone.
property color
color?: pulumi.Input<string>;
The six-digit HTML hex color code to be used for this metric.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property dimensions
dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;
The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.
property extendedStatistic
extendedStatistic?: pulumi.Input<number>;
The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property label
label?: pulumi.Input<string>;
The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property loadBalancer
loadBalancer?: LoadBalancer | LoadBalancer;
Filters the metric data by load balancer.
property period
period?: pulumi.Input<number>;
The new period in seconds over which the specified stat
is applied. If this object is
missing this property, then no change will be made. However, if the property is there by set
to [undefined] then the value will be set to the default (300s).
property statistic
statistic?: pulumi.Input<MetricStatistic>;
The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property targetGroup
targetGroup?: TargetGroup | TargetGroup;
Filters the metric data by target group. If this is a [NetworkTargetGroup] then [loadBalancer] does not have to be provided. If this is an [aws.lb.TargetGroup] then [loadBalancer] must be provided.
property unit
unit?: pulumi.Input<MetricUnit>;
The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property visible
visible?: pulumi.Input<boolean>;
Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property yAxis
yAxis?: pulumi.Input<"left" | "right">;
Where on the graph to display the y-axis for this metric. The default is left.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
function createDimensions
createDimensions(change: CoreMetricChange): Record<string, Input<string>>
namespace network
function activeFlowCount
activeFlowCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of concurrent flows (or connections) from clients to targets. This metric includes connections in the SYN_SENT and ESTABLISHED states. TCP connections are not terminated at the load balancer, so a client opening a TCP connection to a target counts as a single flow.
Statistics: The most useful statistics are Average, Maximum, and Minimum.
function activeFlowCount_TLS
activeFlowCount_TLS(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of concurrent TLS flows (or connections) from clients to targets. This metric includes only connections in the ESTABLISHED states.
Statistics: The most useful statistics are Average, Maximum, and Minimum.
function clientTLSNegotiationErrorCount
clientTLSNegotiationErrorCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of TLS handshakes that failed during negotiation between a client and a TLS listener.
Statistics: The most useful statistic is Sum.
function consumedLCUs
consumedLCUs(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of load balancer capacity units (LCU) used by your load balancer. You pay for the number of LCUs that you use per hour. For more information, see Elastic Load Balancing Pricing.
interface ElasticLoadBalancingV2MetricChange
interface ElasticLoadBalancingV2MetricChange extends MetricChange
property availabilityZone
availabilityZone?: undefined | string;
Filters the metric data by Availability Zone.
property color
color?: pulumi.Input<string>;
The six-digit HTML hex color code to be used for this metric.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property dimensions
dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;
The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.
property extendedStatistic
extendedStatistic?: pulumi.Input<number>;
The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property label
label?: pulumi.Input<string>;
The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property loadBalancer
loadBalancer?: LoadBalancer | NetworkLoadBalancer;
Filters the metric data by load balancer.
property period
period?: pulumi.Input<number>;
The new period in seconds over which the specified stat
is applied. If this object is
missing this property, then no change will be made. However, if the property is there by set
to [undefined] then the value will be set to the default (300s).
property statistic
statistic?: pulumi.Input<MetricStatistic>;
The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property targetGroup
targetGroup?: TargetGroup | NetworkTargetGroup;
Filters the metric data by target group. If this is a [NetworkTargetGroup] then [loadBalancer] does not have to be provided. If this is an [aws.lb.TargetGroup] then [loadBalancer] must be provided.
property unit
unit?: pulumi.Input<MetricUnit>;
The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property visible
visible?: pulumi.Input<boolean>;
Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property yAxis
yAxis?: pulumi.Input<"left" | "right">;
Where on the graph to display the y-axis for this metric. The default is left.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
function healthyHostCount
healthyHostCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of targets that are considered healthy.
Statistics: The most useful statistics are Maximum and Minimum.
function metric
metric(metricName: NetworkMetricName, change: ElasticLoadBalancingV2MetricChange): Metric
Creates an AWS/NetworkELB metric with the requested [metricName]. See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-cloudwatch-metrics.html for list of all metric-names.
Elastic Load Balancing publishes data points to Amazon CloudWatch for your load balancers and your targets. CloudWatch enables you to retrieve statistics about those data points as an ordered set of time-series data, known as metrics. Think of a metric as a variable to monitor, and the data points as the values of that variable over time. For example, you can monitor the total number of healthy targets for a load balancer over a specified time period. Each data point has an associated time stamp and an optional unit of measurement.
You can use metrics to verify that your system is performing as expected. For example, you can create a CloudWatch alarm to monitor a specified metric and initiate an action (such as sending a notification to an email address) if the metric goes outside what you consider an acceptable range.
Elastic Load Balancing reports metrics to CloudWatch only when requests are flowing through the load balancer. If there are requests flowing through the load balancer, Elastic Load Balancing measures and sends its metrics in 60-second intervals. If there are no requests flowing through the load balancer or no data for a metric, the metric is not reported.
To filter the metrics for your Application Load Balancer, use the following dimensions.
- “AvailabilityZone”: Filters the metric data by Availability Zone.
- “LoadBalancer”: Filters the metric data by load balancer. Specify the load balancer
using
LoadBalancer.arnSuffix
. - “TargetGroup”: Filters the metric data by target group. Specify the target group using
TargetGroup.arnSuffix
.
type NetworkMetricName
type NetworkMetricName = "ActiveFlowCount" | "ActiveFlowCount_TLS" | "ClientTLSNegotiationErrorCount" | "ConsumedLCUs" | "HealthyHostCount" | "NewFlowCount" | "NewFlowCount_TLS" | "ProcessedBytes" | "ProcessedBytes_TLS" | "TargetTLSNegotiationErrorCount" | "TCP_Client_Reset_Count" | "TCP_ELB_Reset_Count" | "TCP_Target_Reset_Count" | "UnHealthyHostCount";
function newFlowCount
newFlowCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of new flows (or connections) established from clients to targets in the time period.
Statistics: The most useful statistic is Sum.
function newFlowCountTLS
newFlowCountTLS(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of new TLS flows (or connections) established from clients to targets in the time period.
Statistics: The most useful statistic is Sum.
function processedBytes
processedBytes(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of bytes processed by the load balancer, including TCP/IP headers.
Statistics: The most useful statistic is Sum.
function processedBytesTLS
processedBytesTLS(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of bytes processed by TLS listeners.
Statistics: The most useful statistic is Sum.
function targetTLSNegotiationErrorCount
targetTLSNegotiationErrorCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of TLS handshakes that failed during negotiation between a TLS listener and a target.
Statistics: The most useful statistic is Sum.
function tcpClientResetCount
tcpClientResetCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of reset (RST) packets sent from a client to a target. These resets are generated by the client and forwarded by the load balancer.
Statistics: The most useful statistic is Sum.
function tcpELBResetCount
tcpELBResetCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of reset (RST) packets generated by the load balancer.
Statistics: The most useful statistic is Sum.
function tcpTargetResetCount
tcpTargetResetCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The total number of reset (RST) packets sent from a target to a client. These resets are generated by the target and forwarded by the load balancer.
Statistics: The most useful statistic is Sum.
function unhealthyHostCount
unhealthyHostCount(change?: ElasticLoadBalancingV2MetricChange): Metric
The number of targets that are considered unhealthy.
Statistics: The most useful statistics are Maximum and Minimum.
class NetworkListener
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider, IntegrationRouteTargetProvider
A listener is a process that checks for connection requests, using the protocol and port that you configure. The rules that you define for a listener determine how the load balancer routes requests to the targets in one or more target groups.
See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-listeners.html for more details.
constructor
new NetworkListener(name: string, args: NetworkListenerArgs, opts: ComponentResourceOptions)
method addListenerRule
public addListenerRule(name: string, args: ListenerRuleArgs, opts?: pulumi.ComponentResourceOptions): ListenerRule
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the defaultTargetGroup
for this Listener.
method containerLoadBalancer
public containerLoadBalancer(name: string, parent: Resource): Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(name: string, parent: Resource): Input<PortMapping>
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
method target
public target(name: string, parent: Resource): pulumi.Input<IntegrationTarget>
property defaultTargetGroup
public defaultTargetGroup?: NetworkTargetGroup;
property endpoint
public endpoint: pulumi.Output<ListenerEndpoint>;
property listener
public listener: Listener;
property loadBalancer
public loadBalancer: NetworkLoadBalancer;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
interface NetworkListenerArgs
interface NetworkListenerArgs
property certificateArn
certificateArn?: pulumi.Input<string>;
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_listener_certificate
resource.
property defaultAction
defaultAction?: pulumi.Input<ListenerDefaultActionArgs> | ListenerDefaultAction;
An Action block. If neither this nor [defaultActions] is provided, a suitable defaultAction will be chosen that forwards to a new [NetworkTargetGroup] created from [port].
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property defaultActions
defaultActions?: pulumi.Input<pulumi.Input<ListenerDefaultActionArgs>[]>;
An list of Action blocks. If neither this nor [defaultAction] is provided, a suitable defaultAction will be chosen that forwards to a new [NetworkTargetGroup] created from [port].
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property listener
listener?: aws.lb.Listener;
An existing aws.lb.Listener to use for this awsx.lb.Listener. If not provided, one will be created.
property loadBalancer
loadBalancer?: NetworkLoadBalancer | NetworkLoadBalancerArgs;
The load balancer this listener is associated with. If not provided, a new load balancer will be automatically created.
property name
name?: undefined | string;
An explicit name to use for dependent resources. Specifically, if a LoadBalancer or TargetGroup is not provided, this name will be used to name those resources.
property port
port: pulumi.Input<number>;
The port. Specify a value from 1
to 65535
.
property protocol
protocol?: pulumi.Input<NetworkProtocol>;
The protocol for connections from clients to the load balancer. Valid values are TCP, TLS, HTTP and HTTPS. Defaults to TCP.
property sslPolicy
sslPolicy?: pulumi.Input<string>;
The name of the SSL Policy for the listener. Required if protocol
is HTTPS
.
property targetGroup
targetGroup?: NetworkTargetGroup | NetworkTargetGroupArgs;
Target group this listener is associated with. This is used to determine the [defaultAction] for the listener.
Only provide one of [defaultAction], [defaultActions] or [targetGroup]
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
class NetworkLoadBalancer
class NetworkLoadBalancer extends LoadBalancer
constructor
new NetworkLoadBalancer(name: string, args: NetworkLoadBalancerArgs, opts: ComponentResourceOptions)
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to the first listener
of this LoadBalancer. If there are multiple
listeners
you can add a target to specific listener to by calling .attachTarget
directly
on it.
method createListener
public createListener(name: string, args: NetworkListenerArgs, opts: ComponentResourceOptions): NetworkListener
method createTargetGroup
public createTargetGroup(name: string, args: NetworkTargetGroupArgs, opts: ComponentResourceOptions): NetworkTargetGroup
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: NetworkListener[];
property loadBalancer
public loadBalancer: LoadBalancer;
property securityGroups
public securityGroups: SecurityGroup[];
property targetGroups
public targetGroups: NetworkTargetGroup[];
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
interface NetworkLoadBalancerArgs
interface NetworkLoadBalancerArgs
property enableCrossZoneLoadBalancing
enableCrossZoneLoadBalancing?: pulumi.Input<boolean>;
If true, cross-zone load balancing of the load balancer will be enabled. Defaults to false
.
property enableDeletionProtection
enableDeletionProtection?: pulumi.Input<boolean>;
If true, deletion of the load balancer will be disabled via the AWS API. This will prevent
Terraform from deleting the load balancer. Defaults to false
.
property external
external?: undefined | false | true;
Whether or not the load balancer is exposed to the internet. Defaults to true
if
unspecified.
property ipAddressType
ipAddressType?: pulumi.Input<"ipv4" | "dualstack">;
The type of IP addresses used by the subnets for your load balancer. The possible values are
ipv4
and dualstack
property loadBalancer
loadBalancer?: aws.lb.LoadBalancer;
An existing aws.lb.LoadBalancer to use for this awsx.lb.LoadBalancer. If this value is set then all other arguments are ignored. If not provided, one will be created.
property name
name?: undefined | string;
The name of the LoadBalancer. 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, the [name] parameter passed into the LoadBalancer constructor will be hashed and used as the name.
property subnetMappings
subnetMappings?;
A subnet mapping block as documented below.
property subnets
subnets?: pulumi.Input<pulumi.Input<string>[]> | LoadBalancerSubnets;
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.
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
type NetworkProtocol
type NetworkProtocol = "HTTP" | "HTTPS" | "TCP" | "TLS" | "GENEVE" | "UDP" | "TCP_UDP";
class NetworkTargetGroup
implements ContainerPortMappingProvider, ContainerLoadBalancerProvider, ListenerDefaultAction, ListenerActions
Each target group is used to route requests to one or more registered targets. When you create each listener rule, you specify a target group and conditions. When a rule condition is met, traffic is forwarded to the corresponding target group. You can create different target groups for different types of requests. For example, create one target group for general requests and other target groups for requests to the microservices for your application.
You define health check settings for your load balancer on a per target group basis. Each target group uses the default health check settings, unless you override them when you create the target group or modify them later on. After you specify a target group in a rule for a listener, the load balancer continually monitors the health of all targets registered with the target group that are in an Availability Zone enabled for the load balancer. The load balancer routes requests to the registered targets that are healthy.
See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html for more details.
constructor
new NetworkTargetGroup(name: string, args: NetworkTargetGroupArgs, opts: ComponentResourceOptions)
method actions
public actions()
method attachTarget
public attachTarget(name: string, args: LoadBalancerTarget, opts: CustomResourceOptions): TargetGroupAttachment
Attaches a target to this target group. See Register-Targets for more details.
method containerLoadBalancer
public containerLoadBalancer(): pulumi.Input<ContainerLoadBalancer>
method containerPortMapping
public containerPortMapping(): pulumi.Input<PortMapping>
method createListener
public createListener(name: string, args: NetworkListenerArgs, opts: ComponentResourceOptions): NetworkListener
method getData
protected getData(): Promise<TData>
Retrieves the data produces by [initialize]. The data is immediately available in a
derived class’s constructor after the super(...)
call to ComponentResource
.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefined
method initialize
protected initialize(args: Inputs): Promise<TData>
Can be overridden by a subclass to asynchronously initialize data for this Component
automatically when constructed. The data will be available immediately for subclass
constructors to use. To access the data use .getData
.
method isInstance
static isInstance(obj: any): obj is ComponentResource
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method listenerDefaultAction
public listenerDefaultAction(): pulumi.Input<ListenerDefaultActionArgs>
method registerListener
public registerListener(listener: Listener): void
Do not call directly. Intended for use by [Listener] and [ListenerRule]
method registerOutputs
protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void
registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
ComponentResources can call this at the end of their constructor to indicate that they are
done creating child resources. This is not strictly necessary as this will automatically be
called after the initialize
method completes.
property listeners
public listeners: NetworkListener[];
property loadBalancer
public loadBalancer: NetworkLoadBalancer;
property targetGroup
public targetGroup: TargetGroup;
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property vpc
public vpc: Vpc;
interface NetworkTargetGroupArgs
interface NetworkTargetGroupArgs
property deregistrationDelay
deregistrationDelay?: pulumi.Input<number>;
The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.
property healthCheck
healthCheck?: pulumi.Input<NetworkTargetGroupHealthCheck>;
A Health Check block. Health Check blocks are documented below.
property loadBalancer
loadBalancer?: NetworkLoadBalancer;
The load balancer this target group is associated with. If not provided, a new load balancer will be automatically created.
property name
name?: undefined | string;
The name of the TargetGroup. If not specified, the [name] parameter passed into the TargetGroup constructor will be hashed and used as the name. If a [loadBalancer] is not provided, this name will be used to name that resource as well.
property port
port: pulumi.Input<number>;
The port to use to connect with the target. Valid values are either ports 1-65536, or
traffic-port
. Defaults to traffic-port
.
property protocol
protocol?: pulumi.Input<NetworkProtocol>;
The protocol for connections from clients to the load balancer. Valid values are TCP, TLS, HTTP and HTTPS. Defaults to TCP.
property proxyProtocolV2
proxyProtocolV2?: pulumi.Input<boolean>;
Boolean to enable / disable support for proxy protocol v2 on Network Load Balancers. See doc for more information.
property slowStart
slowStart?: pulumi.Input<number>;
The amount time for targets to warm up before the load balancer sends them a full share of requests. The range is 30-900 seconds or 0 to disable. The default value is 0 seconds.
property stickiness
stickiness?;
A Stickiness block. Stickiness blocks are documented below. stickiness
is only valid if
used with Load Balancers of type Application
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property targetGroup
targetGroup?: aws.lb.TargetGroup;
An existing aws.lb.TargetGroup to use for this awsx.lb.TargetGroup. If not provided, one will be created.
property targetType
targetType?: pulumi.Input<"instance" | "ip">;
The type of target that you must specify when registering targets with this target group. The
possible values are instance
(targets are specified by instance ID) or ip
(targets are
specified by IP address). The default is ip
.
Note that you can’t specify targets for a target group using both instance IDs and IP
addresses. If the target type is ip
, specify IP addresses from the subnets of the virtual
private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and
192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can’t specify publicly routable
IP addresses.
property vpc
vpc?: ec2.Vpc;
The vpc this load balancer will be used with. Defaults to [Vpc.getDefault]
if
unspecified.
interface NetworkTargetGroupHealthCheck
interface NetworkTargetGroupHealthCheck extends TargetGroupHealthCheck
A Health Check block.
The Health Check parameters you can set vary by the protocol of the Target Group. Many parameters cannot be set to custom values for network load balancers at this time. See http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html for a complete reference. Keep in mind, that health checks produce actual requests to the backend. The underlying function is invoked when target_type is set to lambda.
property healthyThreshold
healthyThreshold?: pulumi.Input<number>;
The number of consecutive health checks successes required before considering an unhealthy target healthy. Defaults to 3.
property interval
interval?: pulumi.Input<number>;
The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. For lambda target groups, it needs to be greater as the [timeout] of the underlying [lambda]. Default 30 seconds.
property matcher
matcher?: pulumi.Input<string>;
The HTTP codes to use when checking for a successful response from a target. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”). Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP)
property path
path?: pulumi.Input<string>;
(Required for HTTP/HTTPS ALB) The destination for the health check request. Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP).
property port
port?: pulumi.Input<string>;
The port to use to connect with the target.
property protocol
protocol?: pulumi.Input<string>;
The protocol to use to connect with the target. Defaults to HTTP. Not applicable when target_type is [lambda].
property timeout
timeout?: undefined;
For Network Load Balancers, you cannot set a custom value, and the default is 10 seconds for TCP and HTTPS health checks and 6 seconds for HTTP health checks.
property unhealthyThreshold
unhealthyThreshold?: pulumi.Input<number>;
The number of consecutive health check failures required before considering the target unhealthy. For Network Load Balancers, this value must be the same as the healthy_threshold. Defaults to 3.
interface TargetGroupArgs
interface TargetGroupArgs
property deregistrationDelay
deregistrationDelay?: pulumi.Input<number>;
The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.
property healthCheck
healthCheck?: pulumi.Input<TargetGroupHealthCheck>;
Health check parameters for this target group.
property name
name?: undefined | string;
property port
port: pulumi.Input<number> | undefined;
The port to use to connect with the target. Valid values are either ports 1-65536, or
traffic-port
. Defaults to traffic-port
.
property protocol
protocol: pulumi.Input<"HTTP" | "HTTPS" | "TCP" | "TLS" | "GENEVE" | "UDP" | "TCP_UDP"> | undefined;
The protocol to use to connect with the target.
property proxyProtocolV2
proxyProtocolV2?: pulumi.Input<boolean>;
Boolean to enable / disable support for proxy protocol v2 on Network Load Balancers. See doc for more information.
property slowStart
slowStart?: pulumi.Input<number>;
The amount time for targets to warm up before the load balancer sends them a full share of requests. The range is 30-900 seconds or 0 to disable. The default value is 0 seconds.
property stickiness
stickiness?;
A Stickiness block. Stickiness blocks are documented below. stickiness
is only valid if
used with Load Balancers of type Application
property tags
tags?: pulumi.Input<Tags>;
A mapping of tags to assign to the resource.
property targetGroup
targetGroup?: aws.lb.TargetGroup;
An existing aws.lb.TargetGroup to use for this awsx.lb.TargetGroup. If not provided, one will be created.
property targetType
targetType?: pulumi.Input<TargetType>;
The type of target that you must specify when registering targets with this target group. The
possible values are instance
(targets are specified by instance ID) or ip
(targets are
specified by IP address) or lambda
(targets are specified by lambda arn). The default is
ip
. Note that you can’t specify targets for a target group using both instance IDs
and IP addresses. If the target type is ip
, specify IP addresses from the subnets of the
virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8,
172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can’t specify
publicly routable IP addresses.
property vpc
vpc: Vpc;
The vpc for this target group.
interface TargetGroupAttachmentArgs
interface TargetGroupAttachmentArgs
property availabilityZone
availabilityZone?: pulumi.Input<string>;
The Availability Zone where the IP address of the target is to be registered.
property func
func?: aws.lambda.Function;
Optional function this target group attachment targets.
property port
port?: pulumi.Input<number>;
The port on which targets receive traffic.
property targetId
targetId: pulumi.Input<string>;
The ID of the target. This is the Instance ID for an instance, or the container ID for an ECS container. If the target type is ip, specify an IP address. If the target type is lambda, specify the arn of lambda.
interface TargetGroupHealthCheck
interface TargetGroupHealthCheck
A Health Check block.
The Health Check parameters you can set vary by the protocol of the Target Group. Many parameters cannot be set to custom values for network load balancers at this time. See http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html for a complete reference. Keep in mind, that health checks produce actual requests to the backend. The underlying function is invoked when target_type is set to lambda.
property healthyThreshold
healthyThreshold?: pulumi.Input<number>;
The number of consecutive health checks successes required before considering an unhealthy target healthy. Defaults to 3.
property interval
interval?: pulumi.Input<number>;
The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. For lambda target groups, it needs to be greater as the [timeout] of the underlying [lambda]. Default 30 seconds.
property matcher
matcher?: pulumi.Input<string>;
The HTTP codes to use when checking for a successful response from a target. You can specify multiple values (for example, “200,202”) or a range of values (for example, “200-299”). Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP)
property path
path?: pulumi.Input<string>;
(Required for HTTP/HTTPS ALB) The destination for the health check request. Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP).
property port
port?: pulumi.Input<string>;
The port to use to connect with the target.
property protocol
protocol?: pulumi.Input<string>;
The protocol to use to connect with the target. Defaults to HTTP. Not applicable when target_type is [lambda].
property timeout
timeout?: pulumi.Input<number>;
The amount of time, in seconds, during which no response means a failed health check. For Application Load Balancers, the range is 2 to 60 seconds and the default is 5 seconds. For Network Load Balancers, you cannot set a custom value, and the default is 10 seconds for TCP and HTTPS health checks and 6 seconds for HTTP health checks.
property unhealthyThreshold
unhealthyThreshold?: pulumi.Input<number>;
The number of consecutive health check failures required before considering the target unhealthy. For Network Load Balancers, this value must be the same as the healthy_threshold. Defaults to 3.
type TargetType
type TargetType = "instance" | "ip" | "lambda";
The type of target that you must specify when registering targets with a target group. The
possible values are instance
(targets are specified by instance ID) or ip
(targets are
specified by IP address) or lambda
(targets are specified by lambda arn). The default is ip
.
Note that you can’t specify targets for a target group using both instance IDs and IP addresses.
If the target type is ip
, specify IP addresses from the subnets of the virtual private cloud
(VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16),
and the RFC 6598 range (100.64.0.0/10). You can’t specify publicly routable IP addresses.
Network Load Balancers do not support the lambda target type, only Application Load Balancers support the lambda target type. For more information, see Lambda-Functions-as-Targets in the User Guide for Application Load Balancers.
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.