Quickly Set Up AWS Global Accelerator Distribution for EC2 & ALB

Amazon Web Services (AWS) Global Accelerator is a powerful service designed to improve the availability and performance of your cloud applications by routing traffic over the AWS global network. Whether you’re using Application Load Balancers (ALB) or Elastic Compute Cloud (EC2) instances as endpoints, this guide provides clear, step-by-step instructions for setting up AWS Global Accelerator.

Setting up AWS Global Accelerator for EC2 instances or Elastic IP addresses

In some cases, you may want to route traffic directly to EC2 instances or Elastic IP (EIP) addresses. Here’s how to set up AWS Global Accelerator for these endpoints. 

Architecture diagram of AWS Global Accelerator with EC2
Architecture diagram of AWS Global Accelerator with EC2

Step 1: Creating an EC2 Instance in two different regions 

Make sure you have at least two EC2 instances set up in various regions before you start. You can create one instance in the US region and another in the Singapore region. This way, when users make requests, they will automatically be directed to the nearest AWS region. 

Go to EC2 services.

Click on Launch Instances.

Configure your instance settings.

Launch the EC2 instance.

I have two instances in two different regions.  

Instance One in the US region
Instance One in the US region
Instance Two in the Singapore region
Instance Two in the Singapore region

Step 2: Creating a Global Accelerator

Navigate to the AWS Global Accelerator console.

Accessing the AWS Global Accelerator service

Click on “Create accelerator”.

Creating global accelerator

Choose a name for your accelerator.

Select “Standard” as the Accelerator type.

(If you want a simple, automated solution to direct traffic to the nearest healthy endpoint, go with the “Standard” accelerator. If you need more control to route different types of traffic to specific EC2 instances based on custom criteria, then the “Custom Routing” accelerator is the choice for you.)

Select the IP address type as IPV4. 

Adding global accelerator basic configuration

Click on Next.

Step 3: Adding Listeners on AWS Global Accelerator. 

Then we have to set up a listener which is the port. 

Add “80” in the port and select “TCP” as the protocol because we will have the HTTP traffic which is built on top of TCP.  Also, select Client affinity as “NONE”. 

Then click on “Next”.

Adding global accelerator listeners

Step 4: Adding Endpoint groups on AWS Global Accelerator. 

In the endpoints group, select the instances that you have created. Select the region in which you have your first instance. In my case, it’s us-east-1. 

In the traffic dial choose “100”. Which means 100% of the traffic will go to that region.

Adding the first endpoint group

In the configure health checks tab. Add health check port as “80”, health check protocol as “HTTP”, health check path as “/”, health check interval as “10” and threshold count as “3”. 

Configuring health check

Now, click on “Add endpoint group” as we are going to add a second EC2 in another region. 

Adding a second endpoint group

Select the region in which you have your second instance. In my case, it’s ap-southeast-1.

Configure the health check which will be the same as above. 

If you have more EC2 in different regions then you can again click on “Add endpoint group” and repeat the same step as above. 

Then click on “Next.”

Adding second endpoint group details

Step 5: Adding endpoints on AWS Global Accelerator. 

Now we will have two endpoint groups. In the endpoint group 1, click on ”Add endpoint.”

Adding endpoint in first endpoint group

Select the endpoint type as “EC2 instance”. (If you have an elastic IP address then select “Elastic IP address” as an endpoint type and choose your elastic IP as an endpoint.)

Select your EC2 instance in Endpoint.