AWS SDK for JavaScript Storage Gateway Client for Node.js, Browser and React Native
npm install @aws-sdk/client-storage-gatewayAWS SDK for JavaScript StorageGateway Client for Node.js, Browser and React Native.
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.
npm install @aws-sdk/client-storage-gatewayyarn add @aws-sdk/client-storage-gatewaypnpm add @aws-sdk/client-storage-gatewayThe 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:
``js`
// ES5 example
const { StorageGatewayClient, ListTapesCommand } = require("@aws-sdk/client-storage-gateway");
`ts`
// ES6+ example
import { StorageGatewayClient, ListTapesCommand } from "@aws-sdk/client-storage-gateway";
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 StorageGatewayClient({ region: "REGION" });
const params = { /* input parameters / };
const command = new ListTapesCommand(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-storage-gateway";
const client = new AWS.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.
client.listTapes(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-storage-gateway` 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.
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