Skip to content
v2.275.0

EndpointGroup L2 construct ​

EndpointGroup construct.

Example ​

ts
declare const listener: globalaccelerator.Listener;

// Non-open ALB
declare const alb: elbv2.ApplicationLoadBalancer;

const endpointGroup = listener.addEndpointGroup('Group', {
  endpoints: [
    new ga_endpoints.ApplicationLoadBalancerEndpoint(alb, {
      preserveClientIp: true,
    }),
  ],
});

// Remember that there is only one AGA security group per VPC.
declare const vpc: ec2.Vpc;
const agaSg = endpointGroup.connectionsPeer('GlobalAcceleratorSG', vpc);

// Allow connections from the AGA to the ALB
alb.connections.allowFrom(agaSg, ec2.Port.tcp(443));
python
# listener: globalaccelerator.Listener

# Non-open ALB
# alb: elbv2.ApplicationLoadBalancer

# Remember that there is only one AGA security group per VPC.
# vpc: ec2.Vpc


endpoint_group = listener.add_endpoint_group("Group",
    endpoints=[
        ga_endpoints.ApplicationLoadBalancerEndpoint(alb,
            preserve_client_ip=True
        )
    ]
)
aga_sg = endpoint_group.connections_peer("GlobalAcceleratorSG", vpc)

# Allow connections from the AGA to the ALB
alb.connections.allow_from(aga_sg, ec2.Port.tcp(443))
java
Listener listener;

// Non-open ALB
ApplicationLoadBalancer alb;

// Remember that there is only one AGA security group per VPC.
Vpc vpc;


EndpointGroup endpointGroup = listener.addEndpointGroup("Group", EndpointGroupOptions.builder()
        .endpoints(List.of(
            ApplicationLoadBalancerEndpoint.Builder.create(alb)
                    .preserveClientIp(true)
                    .build()))
        .build());
IPeer agaSg = endpointGroup.connectionsPeer("GlobalAcceleratorSG", vpc);

// Allow connections from the AGA to the ALB
alb.connections.allowFrom(agaSg, Port.tcp(443));
csharp
// Install: dotnet add package Amazon.CDK.Lib
Listener listener;

// Non-open ALB
ApplicationLoadBalancer alb;

// Remember that there is only one AGA security group per VPC.
Vpc vpc;


var endpointGroup = listener.AddEndpointGroup("Group", new EndpointGroupOptions {
    Endpoints = new [] {
        new ApplicationLoadBalancerEndpoint(alb, new ApplicationLoadBalancerEndpointOptions {
            PreserveClientIp = true
        }) }
});
var agaSg = endpointGroup.ConnectionsPeer("GlobalAcceleratorSG", vpc);

// Allow connections from the AGA to the ALB
alb.Connections.AllowFrom(agaSg, Port.Tcp(443));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var listener Listener

// Non-open ALB
var alb ApplicationLoadBalancer

// Remember that there is only one AGA security group per VPC.
var vpc Vpc


endpointGroup := listener.AddEndpointGroup(jsii.String("Group"), &EndpointGroupOptions{
	Endpoints: []IEndpoint{
		ga_endpoints.NewApplicationLoadBalancerEndpoint(alb, &ApplicationLoadBalancerEndpointOptions{
			PreserveClientIp: jsii.Boolean(true),
		}),
	},
})
agaSg := endpointGroup.ConnectionsPeer(jsii.String("GlobalAcceleratorSG"), vpc)

// Allow connections from the AGA to the ALB
alb.Connections.AllowFrom(agaSg, ec2.Port_Tcp(jsii.Number(443)))

Initializer ​

ts
new EndpointGroup(scope: Construct, id: string, props: EndpointGroupProps)
python
EndpointGroup(scope: Construct, id: str, props: EndpointGroupProps)
java
new EndpointGroup(Construct scope, String id, EndpointGroupProps props)
csharp
new EndpointGroup(Construct scope, string id, EndpointGroupProps props)
go
NewEndpointGroup(Scope Construct, Id *string, Props EndpointGroupProps)

Construct Props ​

endpointGroupNameoptionalstringendpoint_group_nameoptionalstrendpointGroupNameoptionalStringEndpointGroupNameoptionalstringEndpointGroupNameoptional*string#
Name of the endpoint group.

Default: logical ID of the resource

endpointsoptionalIEndpoint[]endpointsoptionaltyping.List[IEndpoint]endpointsoptionalList<IEndpoint>EndpointsoptionalIEndpoint[]Endpointsoptional*[]IEndpoint#
Initial list of endpoints for this group.

Default: Group is initially empty

healthCheckIntervaloptionalDurationhealth_check_intervaloptionalDurationhealthCheckIntervaloptionalDurationHealthCheckIntervaloptionalDurationHealthCheckIntervaloptionalDuration= Duration.seconds(30)#
The time between health checks for each endpoint.

Must be either 10 or 30 seconds.

healthCheckPathoptionalstringhealth_check_pathoptionalstrhealthCheckPathoptionalStringHealthCheckPathoptionalstringHealthCheckPathoptional*string= '/'#
The ping path for health checks (if the protocol is HTTP(S)).
healthCheckPortoptionalnumberhealth_check_portoptionalint | floathealthCheckPortoptionalNumberHealthCheckPortoptionaldoubleHealthCheckPortoptional*float64#
The port used to perform health checks.

Default: The listener's port

healthCheckProtocoloptionalHealthCheckProtocolhealth_check_protocoloptionalHealthCheckProtocolhealthCheckProtocoloptionalHealthCheckProtocolHealthCheckProtocoloptionalHealthCheckProtocolHealthCheckProtocoloptionalHealthCheckProtocol= HealthCheckProtocol.TCP#
The protocol used to perform health checks.
healthCheckThresholdoptionalnumberhealth_check_thresholdoptionalint | floathealthCheckThresholdoptionalNumberHealthCheckThresholdoptionaldoubleHealthCheckThresholdoptional*float64= 3#
The number of consecutive health checks required to set the state of a healthy endpoint to unhealthy, or to set an unhealthy endpoint to healthy.
listenerIListenerReflistenerIListenerReflistenerIListenerRefListenerIListenerRefListenerIListenerRefrequired#
The Amazon Resource Name (ARN) of the listener.
portOverridesoptionalPortOverride[]port_overridesoptionaltyping.List[PortOverride]portOverridesoptionalList<PortOverride>PortOverridesoptionalPortOverride[]PortOverridesoptional*[]PortOverride#
Override the destination ports used to route traffic to an endpoint.

Default: No overrides

Unless overridden, the port used to hit the endpoint will be the same as the port that traffic arrives on at the listener.

regionoptionalstringregionoptionalstrregionoptionalStringRegionoptionalstringRegionoptional*string#
The AWS Region where the endpoint group is located.

Default: region of the first endpoint in this group, or the stack region if that region can't be determined

trafficDialPercentageoptionalnumbertraffic_dial_percentageoptionalint | floattrafficDialPercentageoptionalNumberTrafficDialPercentageoptionaldoubleTrafficDialPercentageoptional*float64= 100#
The percentage of traffic to send to this AWS Region.

The percentage is applied to the traffic that would otherwise have been routed to the Region based on optimal routing. Additional traffic is distributed to other endpoint groups for this listener.

Properties ​

endpointGroupArnstringendpoint_group_arnstrendpointGroupArnStringEndpointGroupArnstringEndpointGroupArn*string#
EndpointGroup ARN.
endpointGroupNamestringendpoint_group_namestrendpointGroupNameStringEndpointGroupNamestringEndpointGroupName*string#
The name of the endpoint group.
endpointGroupRefEndpointGroupReferenceendpoint_group_refEndpointGroupReferenceendpointGroupRefEndpointGroupReferenceEndpointGroupRefEndpointGroupReferenceEndpointGroupRefEndpointGroupReference#
A reference to a EndpointGroup resource.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.

Methods ​

addEndpoint(endpoint: IEndpoint): voiddef add_endpoint(self, endpoint: IEndpoint) -> Nonepublic void addEndpoint(IEndpoint endpoint)public void AddEndpoint(IEndpoint endpoint)func AddEndpoint(Endpoint IEndpoint)#
Add an endpoint.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

connectionsPeer(id: string, vpc: IVpc): IPeerdef connections_peer(self, id: str, vpc: IVpc) -> IPeerpublic IPeer connectionsPeer(String id, IVpc vpc)public IPeer ConnectionsPeer(string id, IVpc vpc)func ConnectionsPeer(Id *string, Vpc IVpc) IPeer#
Return an object that represents the Accelerator's Security Group.
notes

Uses a Custom Resource to look up the Security Group that Accelerator creates at deploy time. Requires your VPC ID to perform the lookup.

The Security Group will only be created if you enable Client IP Preservation on any of the endpoints.

You cannot manipulate the rules inside this security group, but you can use this security group as a Peer in Connections rules on other constructs.

fromEndpointGroupArn(scope: Construct, id: string, endpointGroupArn: string): IEndpointGroup@staticmethod def from_endpoint_group_arn(scope: Construct, id: str, endpoint_group_arn: str) -> IEndpointGrouppublic static IEndpointGroup fromEndpointGroupArn(Construct scope, String id, String endpointGroupArn)public static IEndpointGroup FromEndpointGroupArn(Construct scope, string id, string endpointGroupArn)func FromEndpointGroupArn(Scope Construct, Id *string, EndpointGroupArn *string) IEndpointGroupstatic#
import from ARN.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.