awselasticloadbalancingv2targets

package
v1.168.0-devpreview Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

Targets for AWS Elastic Load Balancing V2

This package contains targets for ELBv2. See the README of the @aws-cdk/aws-elasticloadbalancingv2 library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAlbArnTarget_Override

func NewAlbArnTarget_Override(a AlbArnTarget, albArn *string, port *float64)

Create a new alb target. Experimental.

func NewAlbTarget_Override

func NewAlbTarget_Override(a AlbTarget, alb awselasticloadbalancingv2.ApplicationLoadBalancer, port *float64)

Experimental.

func NewInstanceIdTarget_Override

func NewInstanceIdTarget_Override(i InstanceIdTarget, instanceId *string, port *float64)

Create a new Instance target. Experimental.

func NewInstanceTarget_Override

func NewInstanceTarget_Override(i InstanceTarget, instance awsec2.Instance, port *float64)

Create a new Instance target. Experimental.

func NewIpTarget_Override

func NewIpTarget_Override(i IpTarget, ipAddress *string, port *float64, availabilityZone *string)

Create a new IPAddress target.

The availabilityZone parameter determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

This parameter is not supported if the target type of the target group is instance. If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

With an Application Load Balancer, if the IP address is outside the VPC for the target group, the only supported value is all.

Default is automatic. Experimental.

func NewLambdaTarget_Override

func NewLambdaTarget_Override(l LambdaTarget, fn awslambda.IFunction)

Create a new Lambda target. Experimental.

Types

type AlbArnTarget

type AlbArnTarget interface {
	awselasticloadbalancingv2.INetworkLoadBalancerTarget
	// Register this alb target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

A single Application Load Balancer as the target for load balancing.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

albArnTarget := awscdk.Aws_elasticloadbalancingv2_targets.NewAlbArnTarget(jsii.String("albArn"), jsii.Number(123))

Experimental.

func NewAlbArnTarget

func NewAlbArnTarget(albArn *string, port *float64) AlbArnTarget

Create a new alb target. Experimental.

type AlbTarget

type AlbTarget interface {
	AlbArnTarget
	// Register this alb target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

A single Application Load Balancer as the target for load balancing.

Example:

import targets "github.com/aws/aws-cdk-go/awscdk"
import ecs "github.com/aws/aws-cdk-go/awscdk"
import patterns "github.com/aws/aws-cdk-go/awscdk"

var vpc vpc

task := ecs.NewFargateTaskDefinition(this, jsii.String("Task"), &fargateTaskDefinitionProps{
	cpu: jsii.Number(256),
	memoryLimitMiB: jsii.Number(512),
})
task.addContainer(jsii.String("nginx"), &containerDefinitionOptions{
	image: ecs.containerImage.fromRegistry(jsii.String("public.ecr.aws/nginx/nginx:latest")),
	portMappings: []portMapping{
		&portMapping{
			containerPort: jsii.Number(80),
		},
	},
})

svc := patterns.NewApplicationLoadBalancedFargateService(this, jsii.String("Service"), &applicationLoadBalancedFargateServiceProps{
	vpc: vpc,
	taskDefinition: task,
	publicLoadBalancer: jsii.Boolean(false),
})

nlb := elbv2.NewNetworkLoadBalancer(this, jsii.String("Nlb"), &networkLoadBalancerProps{
	vpc: vpc,
	crossZoneEnabled: jsii.Boolean(true),
	internetFacing: jsii.Boolean(true),
})

listener := nlb.addListener(jsii.String("listener"), &baseNetworkListenerProps{
	port: jsii.Number(80),
})

listener.addTargets(jsii.String("Targets"), &addNetworkTargetsProps{
	targets: []iNetworkLoadBalancerTarget{
		targets.NewAlbTarget(svc.loadBalancer, jsii.Number(80)),
	},
	port: jsii.Number(80),
})

awscdk.NewCfnOutput(this, jsii.String("NlbEndpoint"), &cfnOutputProps{
	value: fmt.Sprintf("http://%v", nlb.loadBalancerDnsName),
})

Experimental.

func NewAlbTarget

Experimental.

type InstanceIdTarget

type InstanceIdTarget interface {
	awselasticloadbalancingv2.IApplicationLoadBalancerTarget
	awselasticloadbalancingv2.INetworkLoadBalancerTarget
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToApplicationTargetGroup(targetGroup awselasticloadbalancingv2.IApplicationTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

An EC2 instance that is the target for load balancing.

If you register a target of this type, you are responsible for making sure the load balancer's security group can connect to the instance.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

instanceIdTarget := awscdk.Aws_elasticloadbalancingv2_targets.NewInstanceIdTarget(jsii.String("instanceId"), jsii.Number(123))

Experimental.

func NewInstanceIdTarget

func NewInstanceIdTarget(instanceId *string, port *float64) InstanceIdTarget

Create a new Instance target. Experimental.

type InstanceTarget

type InstanceTarget interface {
	InstanceIdTarget
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToApplicationTargetGroup(targetGroup awselasticloadbalancingv2.IApplicationTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var instance instance

instanceTarget := awscdk.Aws_elasticloadbalancingv2_targets.NewInstanceTarget(instance, jsii.Number(123))

Experimental.

func NewInstanceTarget

func NewInstanceTarget(instance awsec2.Instance, port *float64) InstanceTarget

Create a new Instance target. Experimental.

type IpTarget

type IpTarget interface {
	awselasticloadbalancingv2.IApplicationLoadBalancerTarget
	awselasticloadbalancingv2.INetworkLoadBalancerTarget
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToApplicationTargetGroup(targetGroup awselasticloadbalancingv2.IApplicationTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

An IP address that is a target for load balancing.

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.

If you register a target of this type, you are responsible for making sure the load balancer's security group can send packets to the IP address.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

ipTarget := awscdk.Aws_elasticloadbalancingv2_targets.NewIpTarget(jsii.String("ipAddress"), jsii.Number(123), jsii.String("availabilityZone"))

Experimental.

func NewIpTarget

func NewIpTarget(ipAddress *string, port *float64, availabilityZone *string) IpTarget

Create a new IPAddress target.

The availabilityZone parameter determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

This parameter is not supported if the target type of the target group is instance. If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

With an Application Load Balancer, if the IP address is outside the VPC for the target group, the only supported value is all.

Default is automatic. Experimental.

type LambdaTarget

type LambdaTarget interface {
	awselasticloadbalancingv2.IApplicationLoadBalancerTarget
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToApplicationTargetGroup(targetGroup awselasticloadbalancingv2.IApplicationTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
	// Register this instance target with a load balancer.
	//
	// Don't call this, it is called automatically when you add the target to a
	// load balancer.
	// Experimental.
	AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps
}

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"
import targets "github.com/aws/aws-cdk-go/awscdk"

var lambdaFunction function
var lb applicationLoadBalancer

listener := lb.addListener(jsii.String("Listener"), &baseApplicationListenerProps{
	port: jsii.Number(80),
})
listener.addTargets(jsii.String("Targets"), &addApplicationTargetsProps{
	targets: []iApplicationLoadBalancerTarget{
		targets.NewLambdaTarget(lambdaFunction),
	},

	// For Lambda Targets, you need to explicitly enable health checks if you
	// want them.
	healthCheck: &healthCheck{
		enabled: jsii.Boolean(true),
	},
})

Experimental.

func NewLambdaTarget

func NewLambdaTarget(fn awslambda.IFunction) LambdaTarget

Create a new Lambda target. Experimental.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL