@aws-sdk/client-storage-gateway

中文文档
3.1164.0发布于 2026/11/07Apache-2.0TypeScriptESM + CJS近 30 天下载 12.4万

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

原始使用文档
文档目录10 节
  1. Description
  2. Installing
  3. Getting Started
  4. Import
  5. Usage
  6. Troubleshooting
  7. Getting Help
  8. Contributing
  9. License
  10. Client Commands (Operations List)

@aws-sdk/client-storage-gateway

Description

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

Storage Gateway Service

Amazon FSx File Gateway is no longer available to new customers. Existing customers of FSx File Gateway can continue to use the service normally. For capabilities similar to FSx File Gateway, visit this blog post.

Storage Gateway is the service that connects an on-premises software appliance with cloud-based storage to provide seamless and secure integration between an organization's on-premises IT environment and the Amazon Web Services storage infrastructure. The service enables you to securely upload data to the Amazon Web Services Cloud for cost effective backup and rapid disaster recovery.

Use the following links to get started using the Storage Gateway Service API Reference:

  • Storage Gateway required request headers: Describes the required headers that you must send with every POST request to Storage Gateway.

  • Signing requests: Storage Gateway requires that you authenticate every request you send; this topic describes how sign such a request.

  • Error responses: Provides reference information about Storage Gateway errors.

  • Operations in Storage Gateway: Contains detailed descriptions of all Storage Gateway operations, their request parameters, response elements, possible errors, and examples of requests and responses.

  • Storage Gateway endpoints and quotas: Provides a list of each Amazon Web Services Region and the endpoints available for use with Storage Gateway.

Storage Gateway resource IDs are in uppercase. When you use these resource IDs with the Amazon EC2 API, EC2 expects resource IDs in lowercase. You must change your resource ID to lowercase to use it with the EC2 API. For example, in Storage Gateway the ID for a volume might be vol-AA22BB012345DAF670. When you use this ID with the EC2 API, you must change it to vol-aa22bb012345daf670. Otherwise, the EC2 API might not behave as expected.

IDs for Storage Gateway volumes and Amazon EBS snapshots created from gateway volumes are changing to a longer format. Starting in December 2016, all new volumes and snapshots will be created with a 17-character string. Starting in April 2016, you will be able to use these longer IDs so you can test your systems with the new format. For more information, see Longer EC2 and EBS resource IDs.

For example, a volume Amazon Resource Name (ARN) with the longer volume ID format looks like the following:

arn:aws:storagegateway:us-west-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABBCCDDEEFFG.

A snapshot ID with the longer ID format looks like the following: snap-78e226633445566ee.

For more information, see Announcement: Heads-up – Longer Storage Gateway volume and snapshot IDs coming in 2016.

Installing

To install this package, use the CLI of your favorite package manager:

  • npm install @aws-sdk/client-storage-gateway
  • yarn add @aws-sdk/client-storage-gateway
  • pnpm add @aws-sdk/client-storage-gateway

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the StorageGatewayClient and the commands you need, for example ListTapesCommand:

// ES5 example
const { StorageGatewayClient, ListTapesCommand } = require("@aws-sdk/client-storage-gateway");
// ES6+ example
import { StorageGatewayClient, ListTapesCommand } from "@aws-sdk/client-storage-gateway";

Usage

To send a request:

  • Instantiate a client with configuration (e.g. credentials, region).
  • Instantiate a command with input parameters.
  • Call the send operation on the client, providing the command object as input.
const client = new StorageGatewayClient({ region: "REGION" });

const params = { /** input parameters */ };
const command = new ListTapesCommand(params);

Async/await

We recommend using the 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.
}

Promises

You can also use Promise chaining.

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

Aggregated client

The aggregated client class is exported from the same package, but without the "Client" suffix.

StorageGateway extends StorageGatewayClient and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.

If you are bundling the AWS SDK, we recommend using only the bare-bones client (StorageGatewayClient). More details are in the blog post on modular packages in AWS SDK for JavaScript.

import { StorageGateway } from "@aws-sdk/client-storage-gateway";

const client = new StorageGateway({ region: "REGION" });

// async/await.
try {
  const data = await client.listTapes(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listTapes(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.listTapes(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;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

Please use these community resources for getting help. We use 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-storage-gateway 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)

ActivateGateway

Command API Reference / Input / Output

AddCache

Command API Reference / Input / Output

AddTagsToResource

Command API Reference / Input / Output

AddUploadBuffer

Command API Reference / Input / Output

AddWorkingStorage

Command API Reference / Input / Output

AssignTapePool

Command API Reference / Input / Output

AssociateFileSystem

Command API Reference / Input / Output

AttachVolume

Command API Reference / Input / Output

CancelArchival

Command API Reference / Input / Output

CancelCacheReport

Command API Reference / Input / Output

CancelRetrieval

Command API Reference / Input / Output

CreateCachediSCSIVolume

Command API Reference / Input / Output

CreateNFSFileShare

Command API Reference / Input / Output

CreateSMBFileShare

Command API Reference / Input / Output

CreateSnapshot

Command API Reference / Input / Output

CreateSnapshotFromVolumeRecoveryPoint

Command API Reference / Input / Output

CreateStorediSCSIVolume

Command API Reference / Input / Output

CreateTapePool

Command API Reference / Input / Output

CreateTapes

Command API Reference / Input / Output

CreateTapeWithBarcode

Command API Reference / Input / Output

DeleteAutomaticTapeCreationPolicy

Command API Reference / Input / Output

DeleteBandwidthRateLimit

Command API Reference / Input / Output

DeleteCacheReport

Command API Reference / Input / Output

DeleteChapCredentials

Command API Reference / Input / Output

DeleteFileShare

Command API Reference / Input / Output

DeleteGateway

Command API Reference / Input / Output

DeleteSnapshotSchedule

Command API Reference / Input / Output

DeleteTape

Command API Reference / Input / Output

DeleteTapeArchive

Command API Reference / Input / Output

DeleteTapePool

Command API Reference / Input / Output

DeleteVolume

Command API Reference / Input / Output

DescribeAvailabilityMonitorTest

Command API Reference / Input / Output

DescribeBandwidthRateLimit

Command API Reference / Input / Output

DescribeBandwidthRateLimitSchedule

Command API Reference / Input / Output

DescribeCache

Command API Reference / Input / Output

DescribeCachediSCSIVolumes

Command API Reference / Input / Output

DescribeCacheReport

Command API Reference / Input / Output

DescribeChapCredentials

Command API Reference / Input / Output

DescribeFileSystemAssociations

Command API Reference / Input / Output

DescribeGatewayInformation

Command API Reference / Input / Output

DescribeMaintenanceStartTime

Command API Reference / Input / Output

DescribeNFSFileShares

Command API Reference / Input / Output

DescribeSMBFileShares

Command API Reference / Input / Output

DescribeSMBSettings

Command API Reference / Input / Output

DescribeSnapshotSchedule

Command API Reference / Input / Output

DescribeStorediSCSIVolumes

Command API Reference / Input / Output

DescribeTapeArchives

Command API Reference / Input / Output

DescribeTapeRecoveryPoints

Command API Reference / Input / Output

DescribeTapes

Command API Reference / Input / Output

DescribeUploadBuffer

Command API Reference / Input / Output

DescribeVTLDevices

Command API Reference / Input / Output

DescribeWorkingStorage

Command API Reference / Input / Output

DetachVolume

Command API Reference / Input / Output

DisableGateway

Command API Reference / Input / Output

DisassociateFileSystem

Command API Reference / Input / Output

EvictFilesFailingUpload

Command API Reference / Input / Output

JoinDomain

Command API Reference / Input / Output

ListAutomaticTapeCreationPolicies

Command API Reference / Input / Output

ListCacheReports

Command API Reference / Input / Output

ListFileShares

Command API Reference / Input / Output

ListFileSystemAssociations

Command API Reference / Input / Output

ListGateways

Command API Reference / Input / Output

ListLocalDisks

Command API Reference / Input / Output

ListTagsForResource

Command API Reference / Input / Output

ListTapePools

Command API Reference / Input / Output

ListTapes

Command API Reference / Input / Output

ListVolumeInitiators

Command API Reference / Input / Output

ListVolumeRecoveryPoints

Command API Reference / Input / Output

ListVolumes

Command API Reference / Input / Output

NotifyWhenUploaded

Command API Reference / Input / Output

RefreshCache

Command API Reference / Input / Output

RemoveTagsFromResource

Command API Reference / Input / Output

ResetCache

Command API Reference / Input / Output

RetrieveTapeArchive

Command API Reference / Input / Output

RetrieveTapeRecoveryPoint

Command API Reference / Input / Output

SetLocalConsolePassword

Command API Reference / Input / Output

SetSMBGuestPassword

Command API Reference / Input / Output

ShutdownGateway

Command API Reference / Input / Output

StartAvailabilityMonitorTest

Command API Reference / Input / Output

StartCacheReport

Command API Reference / Input / Output

StartGateway

Command API Reference / Input / Output

UpdateAutomaticTapeCreationPolicy

Command API Reference / Input / Output

UpdateBandwidthRateLimit

Command API Reference / Input / Output

UpdateBandwidthRateLimitSchedule

Command API Reference / Input / Output

UpdateChapCredentials

Command API Reference / Input / Output

UpdateFileSystemAssociation

Command API Reference / Input / Output

UpdateGatewayInformation

Command API Reference / Input / Output

UpdateGatewaySoftwareNow

Command API Reference / Input / Output

UpdateMaintenanceStartTime

Command API Reference / Input / Output

UpdateNFSFileShare

Command API Reference / Input / Output

UpdateSMBFileShare

Command API Reference / Input / Output

UpdateSMBFileShareVisibility

Command API Reference / Input / Output

UpdateSMBLocalGroups

Command API Reference / Input / Output

UpdateSMBSecurityStrategy

Command API Reference / Input / Output

UpdateSnapshotSchedule

Command API Reference / Input / Output

UpdateVTLDeviceType

Command API Reference / Input / Output

版本与发布记录

@aws-sdk/client-storage-gateway 共发布 738 个版本,首次发布于 2020/01/08;过去 12 个月发布了 220 个版本。

版本发布日期距今
3.1164.0latest2026/11/071 天前
3.1163.02026/11/062 天前
3.1162.02026/11/052 天前
3.1161.02026/10/318 天前
3.1160.02026/10/309 天前
3.1159.02026/10/2910 天前

其他发布通道:alpha → 1.0.0-alpha.26,beta → 1.0.0-beta.5,gamma → 1.0.0-gamma.11,rc → 3.5.1-rc.0。

关于 @aws-sdk/client-storage-gateway 的常见问题

@aws-sdk/client-storage-gateway 是什么?

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

如何安装 @aws-sdk/client-storage-gateway?

在项目目录运行 npm install @aws-sdk/client-storage-gateway,或使用 pnpm add / yarn add / bun add。

@aws-sdk/client-storage-gateway 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aws-sdk/client-storage-gateway 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@aws-sdk/client-storage-gateway 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aws-sdk/client-storage-gateway 可以商用吗?

@aws-sdk/client-storage-gateway 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aws-sdk/client-storage-gateway 的下载量有多少?

根据 npm 官方下载统计,@aws-sdk/client-storage-gateway 在 2026/10/08 – 2026/11/06 这 30 天内被下载 123,544 次,日均约 4,118 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aws-sdk/client-storage-gateway 还在维护吗?

最新版本 3.1164.0 发布于 2026/11/07(1 天前);至今共发布 738 个版本,其中过去 12 个月发布了 220 个;首次发布于 2020/01/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。