EndpointGroup L2 construct
EndpointGroup construct.
Example
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));
# 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))
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));
// 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));
// 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
new EndpointGroup(scope: Construct, id: string, props: EndpointGroupProps)
EndpointGroup(scope: Construct, id: str, props: EndpointGroupProps)
new EndpointGroup(Construct scope, String id, EndpointGroupProps props)
new EndpointGroup(Construct scope, string id, EndpointGroupProps props)
NewEndpointGroup(Scope Construct, Id *string, Props EndpointGroupProps)
Construct Props
endpointGroupNameoptionalstringendpoint_group_nameoptionalstrendpointGroupNameoptionalStringEndpointGroupNameoptionalstringEndpointGroupNameoptional*string#Default: logical ID of the resource
endpointsoptionalIEndpoint[]endpointsoptionaltyping.List[IEndpoint]endpointsoptionalList<IEndpoint>EndpointsoptionalIEndpoint[]Endpointsoptional*[]IEndpoint#Default: Group is initially empty
healthCheckIntervaloptionalDurationhealth_check_intervaloptionalDurationhealthCheckIntervaloptionalDurationHealthCheckIntervaloptionalDurationHealthCheckIntervaloptionalDuration= Duration.seconds(30)#Must be either 10 or 30 seconds.
healthCheckPathoptionalstringhealth_check_pathoptionalstrhealthCheckPathoptionalStringHealthCheckPathoptionalstringHealthCheckPathoptional*string= '/'#healthCheckPortoptionalnumberhealth_check_portoptionalint | floathealthCheckPortoptionalNumberHealthCheckPortoptionaldoubleHealthCheckPortoptional*float64#Default: The listener's port
healthCheckProtocoloptionalHealthCheckProtocolhealth_check_protocoloptionalHealthCheckProtocolhealthCheckProtocoloptionalHealthCheckProtocolHealthCheckProtocoloptionalHealthCheckProtocolHealthCheckProtocoloptionalHealthCheckProtocol= HealthCheckProtocol.TCP#healthCheckThresholdoptionalnumberhealth_check_thresholdoptionalint | floathealthCheckThresholdoptionalNumberHealthCheckThresholdoptionaldoubleHealthCheckThresholdoptional*float64= 3#listenerIListenerReflistenerIListenerReflistenerIListenerRefListenerIListenerRefListenerIListenerRefrequired#portOverridesoptionalPortOverride[]port_overridesoptionaltyping.List[PortOverride]portOverridesoptionalList<PortOverride>PortOverridesoptionalPortOverride[]PortOverridesoptional*[]PortOverride#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.
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 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#endpointGroupNamestringendpoint_group_namestrendpointGroupNameStringEndpointGroupNamestringEndpointGroupName*string#endpointGroupRefEndpointGroupReferenceendpoint_group_refEndpointGroupReferenceendpointGroupRefEndpointGroupReferenceEndpointGroupRefEndpointGroupReferenceEndpointGroupRefEndpointGroupReference#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment#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.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#Methods
addEndpoint(endpoint: IEndpoint): voiddef add_endpoint(self, endpoint: IEndpoint) -> Nonepublic void addEndpoint(IEndpoint endpoint)public void AddEndpoint(IEndpoint endpoint)func AddEndpoint(Endpoint IEndpoint)#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)#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)#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#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#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#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#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#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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.