@aws-sdk/client-global-accelerator-browser
Description
AWS Global Accelerator
This is the AWS Global Accelerator API Reference. This guide is for developers who need detailed information about AWS Global Accelerator API actions, data types, and errors. For more information about Global Accelerator features, see the AWS Global Accelerator Developer Guide.
AWS Global Accelerator is a network layer service in which you create accelerators to improve availability and performance for internet applications used by a global audience.
Global Accelerator provides you with static IP addresses that you associate with your accelerator. These IP addresses are anycast from the AWS edge network and distribute incoming application traffic across multiple endpoint resources in multiple AWS Regions, which increases the availability of your applications. Endpoints can be Elastic IP addresses, Network Load Balancers, and Application Load Balancers that are located in one AWS Region or multiple Regions.
Global Accelerator uses the AWS global network to route traffic to the optimal regional endpoint based on health, client location, and policies that you configure. The service reacts instantly to changes in health or configuration to ensure that internet traffic from clients is directed to only healthy endpoints.
Global Accelerator includes components that work together to help you improve performance and availability for your applications:
- Static IP address
-
AWS Global Accelerator provides you with a set of static IP addresses which are anycast from the AWS edge network and serve as the single fixed entry points for your clients. If you already have Elastic Load Balancing or Elastic IP address resources set up for your applications, you can easily add those to Global Accelerator to allow the resources to be accessed by a Global Accelerator static IP address.
- Accelerator
-
An accelerator directs traffic to optimal endpoints over the AWS global network to improve availability and performance for your internet applications that have a global audience. Each accelerator includes one or more listeners.
- Network zone
-
A network zone services the static IP addresses for your accelerator from a unique IP subnet. Similar to an AWS Availability Zone, a network zone is an isolated unit with its own set of physical infrastructure. When you configure an accelerator, Global Accelerator allocates two IPv4 addresses for it. If one IP address from a network zone becomes unavailable due to IP address blocking by certain client networks, or network disruptions, then client applications can retry on the healthy static IP address from the other isolated network zone.
- Listener
-
A listener processes inbound connections from clients to Global Accelerator, based on the protocol and port that you configure. Each listener has one or more endpoint groups associated with it, and traffic is forwarded to endpoints in one of the groups. You associate endpoint groups with listeners by specifying the Regions that you want to distribute traffic to. Traffic is distributed to optimal endpoints within the endpoint groups associated with a listener.
- Endpoint group
-
Each endpoint group is associated with a specific AWS Region. Endpoint groups include one or more endpoints in the Region. You can increase or reduce the percentage of traffic that would be otherwise directed to an endpoint group by adjusting a setting called a traffic dial. The traffic dial lets you easily do performance testing or blue/green deployment testing for new releases across different AWS Regions, for example.
- Endpoint
-
An endpoint is an Elastic IP address, Network Load Balancer, or Application Load Balancer. Traffic is routed to endpoints based on several factors, including the geo-proximity to the user, the health of the endpoint, and the configuration options that you choose, such as endpoint weights. For each endpoint, you can configure weights, which are numbers that you can use to specify the proportion of traffic to route to each one. This can be useful, for example, to do performance testing within a Region.
Installing
To install the this package using NPM, simply type the following into a terminal window:
npm install @aws-sdk/client-global-accelerator-browser
Getting Started
Import
The AWS SDK is modulized by clients and commands in CommonJS modules. To send a request, you only need to import the client(GlobalAcceleratorClient
) and the commands you need, for example CreateAcceleratorCommand
:
//JavaScript
const {
GlobalAcceleratorClient
} = require("@aws-sdk/client-global-accelerator-browser/GlobalAcceleratorClient");
const {
CreateAcceleratorCommand
} = require("@aws-sdk/client-global-accelerator-browser/commands/CreateAcceleratorCommand");
//TypeScript
import { GlobalAcceleratorClient } from "@aws-sdk/client-global-accelerator-browser/GlobalAcceleratorClient";
import { CreateAcceleratorCommand } from "@aws-sdk/client-global-accelerator-browser/commands/CreateAcceleratorCommand";
Usage
To send a request, you:
- Initiate client with configuration (e.g. credentials, region). For more information you can refer to the API reference.
- Initiate command with input parameters.
- Call
send
operation on client with command object as input. - If you are using a custom http handler, you may call
destroy()
to close open connections.
const globalAccelerator = new GlobalAcceleratorClient({region: 'region'});
//clients can be shared by different commands
const params = {
Name: /**a string value*/,
IdempotencyToken: /**a string value*/,
};
const createAcceleratorCommand = new CreateAcceleratorCommand(params);
globalAccelerator.send(createAcceleratorCommand).then(data => {
// do something
}).catch(error => {
// error handling
})
In addition to using promises, there are 2 other ways to send a request:
// async/await
try {
const data = await globalAccelerator.send(createAcceleratorCommand);
// do something
} catch (error) {
// error handling
}
// callback
globalAccelerator.send(createAcceleratorCommand, (err, data) => {
//do something
});
The SDK can also send requests using the simplified callback style from version 2 of the SDK.
import * as AWS from "@aws-sdk/@aws-sdk/client-global-accelerator-browser/GlobalAccelerator";
const globalAccelerator = new AWS.GlobalAccelerator({ region: "region" });
globalAccelerator.createAccelerator(params, (err, data) => {
//do something
});
Troubleshooting
When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).
try {
const data = await globalAccelerator.send(createAcceleratorCommand);
// do something
} catch (error) {
const metadata = error.$metadata;
console.log(
`requestId: ${metadata.requestId}
cfId: ${metadata.cfId}
extendedRequestId: ${metadata.extendedRequestId}`
);
/*
The keys within exceptions are also parsed. You can access them by specifying exception names:
if(error.name === 'SomeServiceException') {
const value = error.specialKeyInException;
}
*/
}
Getting Help
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
- Ask a question on StackOverflow and tag it with
aws-sdk-js
- Come join the AWS JavaScript community on gitter
- If it turns out that you may have found a bug, please open an issue
Contributing
This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/@aws-sdk/client-global-accelerator-browser' package is updated. To contribute to SDK you can checkout our code generator package.
License
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.