AWS SDK for JavaScript Global Accelerator Client for Node.js, Browser and React Native
npm install @aws-sdk/client-global-acceleratorAWS SDK for JavaScript GlobalAccelerator Client for Node.js, Browser and React Native.
This is the Global Accelerator API Reference. This guide is for developers who need detailed information about
Global Accelerator API actions, data types, and errors. For more information about Global Accelerator features, see the
Global Accelerator Developer Guide.
Global Accelerator is a service in which you create accelerators to improve the performance
of your applications for local and global users. Depending on the type of accelerator you choose, you can
gain additional benefits.
By using a standard accelerator, you can improve availability of your internet applications
that are used by a global audience. With a standard accelerator, Global Accelerator directs traffic to optimal endpoints over the Amazon Web Services
global network.
For other scenarios, you might choose a custom routing accelerator. With a custom routing accelerator, you
can use application logic to directly map one or more users to a specific endpoint among many endpoints.
Global Accelerator is a global service that supports endpoints in multiple Amazon Web Services Regions but you must specify the
US West (Oregon) Region to create, update, or otherwise work with accelerators. That is, for example, specify --region us-west-2
on Amazon Web Services CLI commands.
By default, Global Accelerator provides you with static IP addresses that you associate with your accelerator. The static IP addresses
are anycast from the Amazon Web Services edge network. For IPv4, Global Accelerator provides two static IPv4 addresses. For dual-stack,
Global Accelerator provides a total of four addresses: two static IPv4 addresses and two static IPv6 addresses.
With a standard accelerator for IPv4, instead of using the addresses that Global Accelerator provides, you can configure
these entry points to be IPv4 addresses from your own IP address ranges that you bring to Global Accelerator (BYOIP).
For a standard accelerator,
they distribute incoming application traffic across multiple endpoint resources in multiple Amazon Web Services Regions , which increases
the availability of your applications. Endpoints for standard accelerators can be Network Load Balancers, Application Load Balancers,
Amazon EC2 instances, or Elastic IP addresses that are located in one Amazon Web Services Region or multiple Amazon Web Services Regions. For custom routing
accelerators, you map traffic that arrives to the static IP addresses to specific Amazon EC2 servers in endpoints that
are virtual private cloud (VPC) subnets.
The static IP addresses remain assigned to your accelerator for as long as it exists, even if you
disable the accelerator and it no longer accepts or routes traffic. However, when you
delete an accelerator, you lose the static IP addresses that
are assigned to it, so you can no longer route traffic by using them. You can use
IAM policies like tag-based permissions with Global Accelerator to limit the users who have
permissions to delete an accelerator. For more information, see Tag-based policies.
For standard accelerators, Global Accelerator uses the Amazon Web Services 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 always
directed to healthy endpoints.
For more information about understanding and using Global Accelerator, see the
Global Accelerator Developer Guide.
npm install @aws-sdk/client-global-acceleratoryarn add @aws-sdk/client-global-acceleratorpnpm add @aws-sdk/client-global-acceleratorThe AWS SDK is modulized by clients and commands.
To send a request, you only need to import the GlobalAcceleratorClient and
the commands you need, for example ListAcceleratorsCommand:
``js`
// ES5 example
const { GlobalAcceleratorClient, ListAcceleratorsCommand } = require("@aws-sdk/client-global-accelerator");
`ts`
// ES6+ example
import { GlobalAcceleratorClient, ListAcceleratorsCommand } from "@aws-sdk/client-global-accelerator";
To send a request, you:
- Initiate client with configuration (e.g. credentials, region).
- Initiate command with input parameters.
- Call send operation on client with command object as input.destroy()
- If you are using a custom http handler, you may call to close open connections.
`js
// a client can be shared by different commands.
const client = new GlobalAcceleratorClient({ region: "REGION" });
const params = { /* input parameters / };
const command = new ListAcceleratorsCommand(params);
`
#### Async/await
We recommend using await
operator to wait for the promise returned by send operation as follows:
`js`
// async/await.
try {
const data = await client.send(command);
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
Async-await is clean, concise, intuitive, easy to debug and has better error handling
as compared to using Promise chains or callbacks.
#### Promises
You can also use Promise chaining
to execute send operation.
`js`
client.send(command).then(
(data) => {
// process data.
},
(error) => {
// error handling.
}
);
Promises can also be called using .catch() and .finally() as follows:
`js`
client
.send(command)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
#### Callbacks
We do not recommend using callbacks because of callback hell,
but they are supported by the send operation.
`js`
// callbacks.
client.send(command, (err, data) => {
// process err and data.
});
#### v2 compatible style
The client can also send requests using v2 compatible style.
However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post
on modular packages in AWS SDK for JavaScript
`ts
import * as AWS from "@aws-sdk/client-global-accelerator";
const client = new AWS.GlobalAccelerator({ region: "REGION" });
// async/await.
try {
const data = await client.listAccelerators(params);
// process data.
} catch (error) {
// error handling.
}
// Promises.
client
.listAccelerators(params)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
});
// callbacks.
client.listAccelerators(params, (err, data) => {
// process err and data.
});
`
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
`js`
try {
const data = await client.send(command);
// process data.
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
/**
* The keys within exceptions are also parsed.
* You can access them by specifying exception names:
* if (error.name === 'SomeServiceException') {
* const value = error.specialKeyInException;
* }
*/
}
Please use these community resources for getting help.
We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
- Visit Developer Guide
or API Reference.
- Check out the blog posts tagged with aws-sdk-js
on AWS Developer Blog.
- Ask a question on StackOverflow and tag it with aws-sdk-js.
- Join the AWS JavaScript community on gitter.
- If it turns out that you may have found a bug, please open an issue.
To test your universal JavaScript code in Node.js, browser and react-native environments,
visit our code samples repo.
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-global-accelerator` package is updated.
To contribute to client you can check our generate clients scripts.
This SDK is distributed under the
Apache License, Version 2.0,
see LICENSE for more information.
AddCustomRoutingEndpoints
Command API Reference / Input / Output
AddEndpoints
Command API Reference / Input / Output
AdvertiseByoipCidr
Command API Reference / Input / Output
AllowCustomRoutingTraffic
Command API Reference / Input / Output
CreateAccelerator
Command API Reference / Input / Output
CreateCrossAccountAttachment
Command API Reference / Input / Output
CreateCustomRoutingAccelerator
Command API Reference / Input / Output
CreateCustomRoutingEndpointGroup
Command API Reference / Input / Output
CreateCustomRoutingListener
Command API Reference / Input / Output
CreateEndpointGroup
Command API Reference / Input / Output
CreateListener
Command API Reference / Input / Output
DeleteAccelerator
Command API Reference / Input / Output
DeleteCrossAccountAttachment
Command API Reference / Input / Output
DeleteCustomRoutingAccelerator
Command API Reference / Input / Output
DeleteCustomRoutingEndpointGroup
Command API Reference / Input / Output
DeleteCustomRoutingListener
Command API Reference / Input / Output
DeleteEndpointGroup
Command API Reference / Input / Output
DeleteListener
Command API Reference / Input / Output
DenyCustomRoutingTraffic
Command API Reference / Input / Output
DeprovisionByoipCidr
Command API Reference / Input / Output
DescribeAccelerator
Command API Reference / Input / Output
DescribeAcceleratorAttributes
Command API Reference / Input / Output
DescribeCrossAccountAttachment
Command API Reference / Input / Output
DescribeCustomRoutingAccelerator
Command API Reference / Input / Output
DescribeCustomRoutingAcceleratorAttributes
Command API Reference / Input / Output
DescribeCustomRoutingEndpointGroup
Command API Reference / Input / Output
DescribeCustomRoutingListener
Command API Reference / Input / Output
DescribeEndpointGroup
Command API Reference / Input / Output
DescribeListener
Command API Reference / Input / Output
ListAccelerators
Command API Reference / Input / Output
ListByoipCidrs
Command API Reference / Input / Output
ListCrossAccountAttachments
Command API Reference / Input / Output
ListCrossAccountResourceAccounts
Command API Reference / Input / Output
ListCrossAccountResources
Command API Reference / Input / Output
ListCustomRoutingAccelerators
Command API Reference / Input / Output
ListCustomRoutingEndpointGroups
Command API Reference / Input / Output
ListCustomRoutingListeners
Command API Reference / Input / Output
ListCustomRoutingPortMappings
Command API Reference / Input / Output
ListCustomRoutingPortMappingsByDestination
Command API Reference / Input / Output
ListEndpointGroups
Command API Reference / Input / Output
ListListeners
Command API Reference / Input / Output
ListTagsForResource
Command API Reference / Input / Output
ProvisionByoipCidr
Command API Reference / Input / Output
RemoveCustomRoutingEndpoints
Command API Reference / Input / Output
RemoveEndpoints
Command API Reference / Input / Output
TagResource
Command API Reference / Input / Output
UntagResource
Command API Reference / Input / Output
UpdateAccelerator
Command API Reference / Input / Output
UpdateAcceleratorAttributes
Command API Reference / Input / Output
UpdateCrossAccountAttachment
Command API Reference / Input / Output
UpdateCustomRoutingAccelerator
Command API Reference / Input / Output
UpdateCustomRoutingAcceleratorAttributes
Command API Reference / Input / Output
UpdateCustomRoutingListener
Command API Reference / Input / Output
UpdateEndpointGroup
Command API Reference / Input / Output
UpdateListener
Command API Reference / Input / Output
WithdrawByoipCidr