See: Description
| Interface | Description |
|---|---|
| AcceleratorAttributes |
(experimental) Attributes required to import an existing accelerator to the stack.
|
| AcceleratorProps |
(experimental) Construct properties of the Accelerator.
|
| CfnAcceleratorProps |
Properties for defining a `AWS::GlobalAccelerator::Accelerator`.
|
| CfnEndpointGroup.EndpointConfigurationProperty | |
| CfnEndpointGroup.PortOverrideProperty | |
| CfnEndpointGroupProps |
Properties for defining a `AWS::GlobalAccelerator::EndpointGroup`.
|
| CfnListener.PortRangeProperty | |
| CfnListenerProps |
Properties for defining a `AWS::GlobalAccelerator::Listener`.
|
| Ec2Instance |
(experimental) EC2 Instance interface.
|
| ElasticIpAddress |
(experimental) EIP Interface.
|
| EndpointConfigurationOptions |
(experimental) Options for `addLoadBalancer`, `addElasticIpAddress` and `addEc2Instance` to add endpoints into the endpoint group.
|
| EndpointConfigurationProps |
(experimental) Properties to create EndpointConfiguration.
|
| EndpointGroupProps |
(experimental) Property of the EndpointGroup.
|
| IAccelerator |
(experimental) The interface of the Accelerator.
|
| IAccelerator.Jsii$Default |
Internal default implementation for
IAccelerator. |
| IEndpointGroup |
(experimental) The interface of the EndpointGroup.
|
| IEndpointGroup.Jsii$Default |
Internal default implementation for
IEndpointGroup. |
| IListener |
(experimental) Interface of the Listener.
|
| IListener.Jsii$Default |
Internal default implementation for
IListener. |
| ListenerProps |
(experimental) construct properties for Listener.
|
| LoadBalancer |
(experimental) LoadBalancer Interface.
|
| PortRange |
(experimental) The list of port ranges for the connections from clients to the accelerator.
|
| Enum | Description |
|---|---|
| ClientAffinity |
(experimental) Client affinity lets you direct all requests from a user to the same endpoint, if you have stateful applications, regardless of the port and protocol of the client request.
|
| ConnectionProtocol |
(experimental) The protocol for the connections from clients to the accelerator.
|
---
All classes with the
Cfnprefix in this module (CFN Resources) are always stable and safe to use.
The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
AWS Global Accelerator (AGA) is a service that improves the availability and performance of your applications with local or global users. It provides static IP addresses that act as a fixed entry point to your application endpoints in a single or multiple AWS Regions, such as your Application Load Balancers, Network Load Balancers or Amazon EC2 instances.
This module supports features under AWS Global Accelerator that allows users set up resources using the @aws-cdk/aws-globalaccelerator module.
The Accelerator resource is a Global Accelerator resource type that contains information about how you create an accelerator. An accelerator includes one or more listeners that process inbound connections and direct traffic to one or more endpoint groups, each of which includes endpoints, such as Application Load Balancers, Network Load Balancers, and Amazon EC2 instances.
To create the Accelerator:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 import software.amazon.awscdk.services.globalaccelerator.*; new Accelerator(stack, "Accelerator");
The Listener resource is a Global Accelerator resource type that contains information about how you create a listener to process inbound connections from clients to an accelerator. Connections arrive to assigned static IP addresses on a port, port range, or list of port ranges that you specify.
To create the Listener listening on TCP 80:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Listener.Builder.create(stack, "Listener")
.accelerator(accelerator)
.portRanges(asList(Map.of(
"fromPort", 80,
"toPort", 80)))
.build();
The EndpointGroup resource is a Global Accelerator resource type that contains information about how you create an endpoint group for the specified listener. An endpoint group is a collection of endpoints in one AWS Region.
To create the EndpointGroup:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 EndpointGroup.Builder.create(stack, "Group").listener(listener).build();
You may use the following methods to add endpoints into the EndpointGroup:
addEndpoint to add a generic endpoint into the EndpointGroup.addLoadBalancer to add an Application Load Balancer or Network Load Balancer.addEc2Instance to add an EC2 Instance.addElasticIpAddress to add an Elastic IP Address.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object endpointGroup = EndpointGroup.Builder.create(stack, "Group").listener(listener).build();
Object alb = ApplicationLoadBalancer.Builder.create(stack, "ALB").vpc(vpc).internetFacing(true).build();
Object nlb = NetworkLoadBalancer.Builder.create(stack, "NLB").vpc(vpc).internetFacing(true).build();
Object eip = new CfnEIP(stack, "ElasticIpAddress");
Array instances = new Array();for ( let i = 0; i < 2; i++) {
instances.push(new ec2.Instance(stack, `Instance${i}`, {
vpc,
machineImage: new ec2.AmazonLinuxImage(),
instanceType: new ec2.InstanceType('t3.small'),
}));
}
endpointGroup.addLoadBalancer("AlbEndpoint", alb);
endpointGroup.addLoadBalancer("NlbEndpoint", nlb);
endpointGroup.addElasticIpAddress("EipEndpoint", eip);
endpointGroup.addEc2Instance("InstanceEndpoint", instances[0]);
endpointGroup.addEndpoint("InstanceEndpoint2", instances[1].getInstanceId());
When using certain AGA features (client IP address preservation), AGA creates elastic network interfaces (ENI) in your AWS account which are
associated with a Security Group, and which are reused for all AGAs associated with that VPC. Per the
best practices page, AGA creates a specific security group
called GlobalAccelerator for each VPC it has an ENI in. You can use the security group created by AGA as a source group in other security
groups, such as those for EC2 instances or Elastic Load Balancers, in order to implement least-privilege security group rules.
CloudFormation doesn't support referencing the security group created by AGA. CDK has a library that enables you to reference the AGA security group for a VPC using an AwsCustomResource.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object vpc = Vpc.Builder.create(stack, "VPC").build();
Object alb = ApplicationLoadBalancer.Builder.create(stack, "ALB").vpc(vpc).internetFacing(false).build();
Object accelerator = new Accelerator(stack, "Accelerator");
Object listener = Listener.Builder.create(stack, "Listener")
.accelerator(accelerator)
.portRanges(asList(Map.of(
"fromPort", 443,
"toPort", 443)))
.build();
Object endpointGroup = EndpointGroup.Builder.create(stack, "Group").listener(listener).build();
endpointGroup.addLoadBalancer("AlbEndpoint", alb);
// Remember that there is only one AGA security group per VPC.
// This code will fail at CloudFormation deployment time if you do not have an AGA
Object agaSg = ga.AcceleratorSecurityGroup.fromVpc(stack, "GlobalAcceleratorSG", vpc);
// Allow connections from the AGA to the ALB
alb.connections.allowFrom(agaSg, Port.tcp(443));
Copyright © 2021. All rights reserved.