Skip to main content

Module: global-accelerator

This module provisions AWS Global Accelerator. Multiple listeners can be specified when instantiating this module. The endpoint-group submodule provisions a Global Accelerator Endpoint Group for a listener created by this module and can be instantiated multiple times in order to provision multiple Endpoint Groups.

The reason why endpoint-group is its own submodule is because an AWS Provider needs to be instantiated for the region the Endpoint Group's endpoints reside in. For more information, see the endpoint-group documentation.

Usage

For a complete examples, see examples/.

The following deploys Global Accelerator with endpoints in a single region:

module "global_accelerator" {
source = "cloudposse/global-accelerator/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

ip_address_type = "IPV4"
flow_logs_enabled = true
flow_logs_s3_prefix = "logs/"
flow_logs_s3_bucket = module.s3_bucket.bucket_id

listeners = [
{
client_affinity = "NONE"
protocol = "TCP"
port_ranges = [
{
from_port = 80
to_port = 80
}
]
}
]

context = module.this.context
}

module "endpoint_group" {
source = "cloudposse/global-accelerator/aws//modules/endpoint-group"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

listener_arn = module.global_accelerator.listener_ids[0]
config = {
endpoint_region = "us-east-2"
endpoint_configuration = [
{
endpoint_lb_name = "my-load-balancer"
}
]
}

context = module.this.context
}

The following deploys Global Accelerator with endpoints in multiple regions:

module "global_accelerator" {
source = "cloudposse/global-accelerator/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

ip_address_type = "IPV4"
flow_logs_enabled = true
flow_logs_s3_prefix = "logs/"
flow_logs_s3_bucket = module.s3_bucket.bucket_id

listeners = [
{
client_affinity = "NONE"
protocol = "TCP"
port_ranges = [
{
from_port = 80
to_port = 80
}
]
}
]

context = module.this.context
}

module "endpoint_group" {
source = "cloudposse/global-accelerator/aws//modules/endpoint-group"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

listener_arn = module.global_accelerator.listener_ids[0]
config = {
endpoint_region = "us-east-2"
endpoint_configuration = [
{
endpoint_lb_name = "my-load-balancer"
}
]
}

context = module.this.context
}

module "endpoint_group_failover" {
source = "cloudposse/global-accelerator/aws//modules/endpoint-group"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

listener_arn = module.global_accelerator.listener_ids[0]
config = {
endpoint_region = "us-west-2"
endpoint_configuration = [
{
endpoint_lb_name = "my-failover-load-balancer"
}
]
}

providers = {
aws = aws.failover
}

context = module.failover_label.context
}

Examples

Here are some examples of using this module: