Skip to content
v2.274.0

IpTarget Class ​

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 ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2_targets as elasticloadbalancingv2_targets } from 'aws-cdk-lib';
const ipTarget = new elasticloadbalancingv2_targets.IpTarget('ipAddress', /* all optional props */ 123, /* all optional props */ 'availabilityZone');
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancingv2_targets as elasticloadbalancingv2_targets

ip_target = elasticloadbalancingv2_targets.IpTarget("ipAddress", 123, "availabilityZone")
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancingv2.targets.*;

IpTarget ipTarget = new IpTarget("ipAddress", 123, "availabilityZone");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets;

var ipTarget = new IpTarget("ipAddress", 123, "availabilityZone");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// 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"))

Initializer ​

ts
new IpTarget(ipAddress: string, port?: number, availabilityZone?: string)
python
IpTarget(ip_address: str, port: typing.Optional[int | float] = None, availability_zone: typing.Optional[str] = None)
java
new IpTarget(String ipAddress, Number port, String availabilityZone)
csharp
new IpTarget(string ipAddress, double? port = null, string? availabilityZone = null)
go
NewIpTarget(IpAddress *string, Port *float64, AvailabilityZone *string)

Methods ​

attachToApplicationTargetGroup(targetGroup: IApplicationTargetGroup): LoadBalancerTargetPropsdef attach_to_application_target_group(self, target_group: IApplicationTargetGroup) -> LoadBalancerTargetPropspublic LoadBalancerTargetProps attachToApplicationTargetGroup(IApplicationTargetGroup targetGroup)public LoadBalancerTargetProps AttachToApplicationTargetGroup(IApplicationTargetGroup targetGroup)func AttachToApplicationTargetGroup(TargetGroup IApplicationTargetGroup) 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.

attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetPropsdef attach_to_network_target_group(self, target_group: INetworkTargetGroup) -> LoadBalancerTargetPropspublic LoadBalancerTargetProps attachToNetworkTargetGroup(INetworkTargetGroup targetGroup)public LoadBalancerTargetProps AttachToNetworkTargetGroup(INetworkTargetGroup targetGroup)func AttachToNetworkTargetGroup(TargetGroup INetworkTargetGroup) 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.