class InstanceIdTarget
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets.InstanceIdTarget |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.targets.InstanceIdTarget |
Python | aws_cdk.aws_elasticloadbalancingv2_targets.InstanceIdTarget |
TypeScript (source) | @aws-cdk/aws-elasticloadbalancingv2-targets » InstanceIdTarget |
Implements
IApplication
, INetwork
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 * as elasticloadbalancingv2_targets from '@aws-cdk/aws-elasticloadbalancingv2-targets';
const instanceIdTarget = new elasticloadbalancingv2_targets.InstanceIdTarget('instanceId', /* all optional props */ 123);
Initializer
new InstanceIdTarget(instanceId: string, port?: number)
Parameters
- instanceId
string
— Instance ID of the instance to register to. - port
number
— Override the default port for the target group.
Create a new Instance target.
Methods
Name | Description |
---|---|
attach | Register this instance target with a load balancer. |
attach | Register this instance target with a load balancer. |
attachToApplicationTargetGroup(targetGroup)
public attachToApplicationTargetGroup(targetGroup: IApplicationTargetGroup): LoadBalancerTargetProps
Parameters
- targetGroup
IApplication
Target Group
Returns
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)
public attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetProps
Parameters
- targetGroup
INetwork
Target Group
Returns
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.