AWS Storage Gateway User Guide
Using the AWS SDK for .NET
new UpdateBandwidthRateLimitRequest()
.withGatewayARN(gatewayARN)
.withAverageDownloadRateLimitInBitsPerSec(downloadRate)
.withAverageUploadRateLimitInBitsPerSec(uploadRate);
UpdateBandwidthRateLimitResult updateBandwidthRateLimitResult =
sgClient.updateBandwidthRateLimit(updateBandwidthRateLimitRequest);
String returnGatewayARN = updateBandwidthRateLimitResult.getGatewayARN();
System.out.println("Updated the bandwidth rate limits of " + returnGatewayARN);
System.out.println("Upload bandwidth limit = " + uplo " bits per
second");
System.out.println("Download bandwidth limit = " + downlo " bits per
second");
}
catch (AmazonClientException ex)
{
System.err.println("Error updating gateway bandwith.\n" + ex.toString());
}
}
}
Updating Gateway Bandwidth Rate Limits Using the
AWS SDK for .NET
By updating bandwidth rate limits programmatically, you can adjust limits automatically over a period
of time—for example, by using scheduled tasks. The following example demonstrates how to update a
gateway's bandwidth rate limits by using the AWS Software Development Kit (SDK) for .NET. To use the
example code, you should be familiar with running a .NET console application. For more information, see
AWS SDK for .NET Developer Guide
.
Example : Updating Gateway Bandwidth Limits by Using the AWS SDK for .NET
The following C# code example updates a gateway's bandwidth rate limits. You need to update the code
and provide the service endpoint, your gateway Amazon Resource Name (ARN), and the upload and
download limits. For a list of AWS service endpoints you can use with AWS Storage Gateway, see
in the
AWS General Reference
.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Amazon.StorageGateway;
using Amazon.StorageGateway.Model;
namespace AWSStorageGateway
{
class UpdateBandwidthExample
{
static AmazonStorageGatewayClient sgClient;
static AmazonStorageGatewayConfig sgConfig;
// The gatewayARN
public static String gatewayARN = "*** provide gateway ARN ***";
// The endpoint
static String serviceURL = "https://storagegateway.us-east-1.amazonaws.com";
// Rates
static long uploadRate = 51200; // Bits per second, minimum 51200
static long downloadRate = 102400; // Bits per second, minimum 102400
API Version 2013-06-30
226