aws-cdk-lib.aws_globalaccelerator.EndpointGroup

class EndpointGroup (construct)

LanguageType name
.NETAmazon.CDK.AWS.GlobalAccelerator.EndpointGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsglobalaccelerator#EndpointGroup
Javasoftware.amazon.awscdk.services.globalaccelerator.EndpointGroup
Pythonaws_cdk.aws_globalaccelerator.EndpointGroup
TypeScript (source)aws-cdk-lib » aws_globalaccelerator » EndpointGroup

Implements IConstruct, IDependable, IResource, IEndpointGroup

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));

Initializer

new EndpointGroup(scope: Construct, id: string, props: EndpointGroupProps)

Parameters

  • scope Construct
  • id string
  • props EndpointGroupProps

Construct Props

NameTypeDescription
listenerIListenerThe Amazon Resource Name (ARN) of the listener.
endpointGroupName?stringName of the endpoint group.
endpoints?IEndpoint[]Initial list of endpoints for this group.
healthCheckInterval?DurationThe time between health checks for each endpoint.
healthCheckPath?stringThe ping path for health checks (if the protocol is HTTP(S)).
healthCheckPort?numberThe port used to perform health checks.
healthCheckProtocol?HealthCheckProtocolThe protocol used to perform health checks.
healthCheckThreshold?numberThe number of consecutive health checks required to set the state of a healthy endpoint to unhealthy, or to set an unhealthy endpoint to healthy.
portOverrides?PortOverride[]Override the destination ports used to route traffic to an endpoint.
region?stringThe AWS Region where the endpoint group is located.
trafficDialPercentage?numberThe percentage of traffic to send to this AWS Region.

listener

Type: IListener

The Amazon Resource Name (ARN) of the listener.


endpointGroupName?

Type: string (optional, default: logical ID of the resource)

Name of the endpoint group.


endpoints?

Type: IEndpoint[] (optional, default: Group is initially empty)

Initial list of endpoints for this group.


healthCheckInterval?

Type: Duration (optional, default: Duration.seconds(30))

The time between health checks for each endpoint.

Must be either 10 or 30 seconds.


healthCheckPath?

Type: string (optional, default: '/')

The ping path for health checks (if the protocol is HTTP(S)).


healthCheckPort?

Type: number (optional, default: The listener's port)

The port used to perform health checks.


healthCheckProtocol?

Type: HealthCheckProtocol (optional, default: HealthCheckProtocol.TCP)

The protocol used to perform health checks.


healthCheckThreshold?

Type: number (optional, default: 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.


portOverrides?

Type: PortOverride[] (optional, default: No overrides)

Override the destination ports used to route traffic to an endpoint.

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


region?

Type: string (optional, default: region of the first endpoint in this group, or the stack region if that region can't be determined)

The AWS Region where the endpoint group is located.


trafficDialPercentage?

Type: number (optional, default: 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

NameTypeDescription
endpointGroupArnstringEndpointGroup ARN.
endpointGroupNamestringThe name of the endpoint group.
endpointsIEndpoint[]The array of the endpoints in this endpoint group.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

endpointGroupArn

Type: string

EndpointGroup ARN.


endpointGroupName

Type: string

The name of the endpoint group.


endpoints

Type: IEndpoint[]

The array of the endpoints in this endpoint group.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addEndpoint(endpoint)Add an endpoint.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
connectionsPeer(id, vpc)Return an object that represents the Accelerator's Security Group.
toString()Returns a string representation of this construct.
static fromEndpointGroupArn(scope, id, endpointGroupArn)import from ARN.

addEndpoint(endpoint)

public addEndpoint(endpoint: IEndpoint): void

Parameters

  • endpoint IEndpoint

Add an endpoint.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

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, vpc)

public connectionsPeer(id: string, vpc: IVpc): IPeer

Parameters

  • id string
  • vpc IVpc

Returns

  • IPeer

Return an object that represents the Accelerator's Security Group.

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.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromEndpointGroupArn(scope, id, endpointGroupArn)

public static fromEndpointGroupArn(scope: Construct, id: string, endpointGroupArn: string): IEndpointGroup

Parameters

  • scope Construct
  • id string
  • endpointGroupArn string

Returns

  • IEndpointGroup

import from ARN.