@aws-sdk/client-global-accelerator
TypeScript icon, indicating that this package has built-in type declarations

3.556.0 • Public • Published

@aws-sdk/client-global-accelerator

Description

AWS SDK for JavaScript GlobalAccelerator Client for Node.js, Browser and React Native.

Global Accelerator

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.

Installing

To install the this package, simply type add or install @aws-sdk/client-global-accelerator using your favorite package manager:

  • npm install @aws-sdk/client-global-accelerator
  • yarn add @aws-sdk/client-global-accelerator
  • pnpm add @aws-sdk/client-global-accelerator

Getting Started

Import

The 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:

// ES5 example
const { GlobalAcceleratorClient, ListAcceleratorsCommand } = require("@aws-sdk/client-global-accelerator");
// ES6+ example
import { GlobalAcceleratorClient, ListAcceleratorsCommand } from "@aws-sdk/client-global-accelerator";

Usage

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.
  • If you are using a custom http handler, you may call destroy() to close open connections.
// 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:

// 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.

client.send(command).then(
  (data) => {
    // process data.
  },
  (error) => {
    // error handling.
  }
);

Promises can also be called using .catch() and .finally() as follows:

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.

// 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

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.
});

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 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;
   * }
   */
}

Getting Help

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.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

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.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

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

Command API Reference / Input / Output

Readme

Keywords

none

Package Sidebar

Install

npm i @aws-sdk/client-global-accelerator

Weekly Downloads

84,751

Version

3.556.0

License

Apache-2.0

Unpacked Size

1.09 MB

Total Files

275

Last publish

Collaborators

  • mattsb42-aws
  • kuhe
  • amzn-oss
  • aws-sdk-bot
  • trivikr-aws