class EndpointGroup (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.GlobalAccelerator.EndpointGroup |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsglobalaccelerator#EndpointGroup |
Java | software.amazon.awscdk.services.globalaccelerator.EndpointGroup |
Python | aws_cdk.aws_globalaccelerator.EndpointGroup |
TypeScript (source) | aws-cdk-lib » aws_globalaccelerator » EndpointGroup |
Implements
IConstruct
, IDependable
, IResource
, IEndpoint
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
Endpoint
Group Props
Construct Props
Name | Type | Description |
---|---|---|
listener | IListener | The Amazon Resource Name (ARN) of the listener. |
endpoint | string | Name of the endpoint group. |
endpoints? | IEndpoint [] | Initial list of endpoints for this group. |
health | Duration | The time between health checks for each endpoint. |
health | string | The ping path for health checks (if the protocol is HTTP(S)). |
health | number | The port used to perform health checks. |
health | Health | The protocol used to perform health checks. |
health | number | 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. |
port | Port [] | Override the destination ports used to route traffic to an endpoint. |
region? | string | The AWS Region where the endpoint group is located. |
traffic | number | The 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:
Health
(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:
Port
[]
(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
Name | Type | Description |
---|---|---|
endpoint | string | EndpointGroup ARN. |
endpoint | string | The name of the endpoint group. |
endpoints | IEndpoint [] | The array of the endpoints in this endpoint group. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The 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:
Resource
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
Name | Description |
---|---|
add | Add an endpoint. |
apply | Apply the given removal policy to this resource. |
connections | Return an object that represents the Accelerator's Security Group. |
to | Returns a string representation of this construct. |
static from | 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
Removal
Policy
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
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
import from ARN.