Registry /
aws / aws-cdk-aws-globalaccelerator
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 57MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 7.1s · import 0.000s · 57MB
59MB installed
● package 59MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Accelerator
✓ from aws_cdk import aws_globalaccelerator as ga
✗ from aws_cdk.aws_globalaccelerator import Accelerator
While direct import works, aliasing to 'ga' is the community standard for brevity and consistency in CDK v1.
PortRange
✓ from aws_cdk import aws_globalaccelerator as ga
ApplicationLoadBalancerEndpoint
✓ from aws_cdk import aws_globalaccelerator_endpoints as ga_endpoints
✗ from aws_cdk.aws_globalaccelerator import ApplicationLoadBalancerEndpoint
Endpoint-specific constructs are often in `aws_globalaccelerator_endpoints` for clarity, not directly in `aws_globalaccelerator`.
This quickstart demonstrates how to create a basic Global Accelerator with a listener and an empty endpoint group. It's runnable and will synthesize a CloudFormation template. To make it functional, you would typically add actual application endpoints (like Application Load Balancers or EC2 instances) to the `endpoint_group`.
import os
from aws_cdk import (
core as cdk,
aws_globalaccelerator as ga
)
class GlobalAcceleratorStack(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Create a Global Accelerator
accelerator = ga.Accelerator(self, "MyGlobalAccelerator",
accelerator_name="MyWebAppAccelerator"
)
# Add a Listener for HTTP traffic on port 80
# GA listeners are always TCP or UDP. HTTP/S is handled by the endpoints.
listener = ga.Listener(self, "HttpListener",
accelerator=accelerator,
port_ranges=[ga.PortRange(from_port=80, to_port=80)],
protocol=ga.ConnectionProtocol.TCP
)
# Add an Endpoint Group for a specific region
# This group is initially empty; you would add actual endpoints to it.
endpoint_group = ga.EndpointGroup(self, "UsEast1EndpointGroup",
listener=listener,
endpoint_group_region="us-east-1" # The region where your application endpoints reside
)
# To add actual endpoints (e.g., an Application Load Balancer):
# from aws_cdk import aws_globalaccelerator_endpoints as ga_endpoints
# from aws_cdk import aws_elasticloadbalancingv2 as elbv2
# alb = elbv2.ApplicationLoadBalancer.from_lookup(...)
# endpoint_group.add_endpoint(ga_endpoints.ApplicationLoadBalancerEndpoint(alb))
app = cdk.App()
GlobalAcceleratorStack(app, "GlobalAcceleratorQuickstartStack",
env=cdk.Environment(
account=os.environ.get("CDK_DEFAULT_ACCOUNT"),
region=os.environ.get("CDK_DEFAULT_REGION", "us-east-1") # GA itself is global, but stack needs a region for deployment
)
)
app.synth()
cdk --version
Debug
Known issues
breakingThis library is for AWS CDK v1 (version 1.x.x). AWS CDK v2 has significant breaking changes, including module names (e.g., `aws_cdk.aws_globalaccelerator` vs `aws_cdk.aws_globalaccelerator` in v2 but with different class properties/methods) and construct patterns. Do not mix v1 and v2 libraries.fixEnsure all CDK libraries in your project are either v1.x.x or v2.x.x. If migrating to v2, consult the official CDK v2 upgrade guide for `aws-globalaccelerator` changes.
affects: CDK v1.x.x when attempting to use v2 constructs/patterns
gotchaGlobal Accelerator endpoint groups require a specified `endpoint_group_region`. While Global Accelerator itself is a global service, its endpoint groups must be associated with a specific AWS region where your application endpoints (e.g., ALBs, EC2 instances) reside.fixAlways specify the `endpoint_group_region` property when creating an `EndpointGroup`. Ensure this region matches the region where the actual endpoints are deployed.
affects: All versions of `aws-cdk-aws-globalaccelerator`
gotchaGlobal Accelerator listeners require a list of `PortRange` objects, not just integers or tuples. Forgetting to wrap port numbers in `ga.PortRange()` is a common mistake.fixWhen defining `port_ranges` for a `Listener`, always use `[ga.PortRange(from_port=X, to_port=Y)]`.
affects: All versions of `aws-cdk-aws-globalaccelerator`
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredThis package is a CDK construct library and depends on aws-cdk.core for foundational CDK constructs and functionalities. This version specifically requires `aws-cdk.core (>=1.204.0,<2.0.0)`.