AWS Storage Gateway User Guide
Using the AWS Tools for Windows PowerShell
public static void Main(string[] args)
{
// Create a storage gateway client
sgConfig = new AmazonStorageGatewayConfig();
sgConfig.ServiceURL = serviceURL;
sgClient = new AmazonStorageGatewayClient(sgConfig);
UpdateBandwidth(gatewayARN, uploadRate, downloadRate);
Console.WriteLine("\nTo continue, press Enter.");
Console.Read();
}
public static void UpdateBandwidth(string gatewayARN, long uploadRate, long
downloadRate)
{
try
{
UpdateBandwidthRateLimitRequest updateBandwidthRateLimitRequest =
new UpdateBandwidthRateLimitRequest()
.WithGatewayARN(gatewayARN)
.WithAverageDownloadRateLimitInBitsPerSec(downloadRate)
.WithAverageUploadRateLimitInBitsPerSec(uploadRate);
UpdateBandwidthRateLimitResponse updateBandwidthRateLimitResponse =
sgClient.UpdateBandwidthRateLimit(updateBandwidthRateLimitRequest);
String returnGatewayARN =
updateBandwidthRateLimitResponse.UpdateBandwidthRateLimitResult.GatewayARN;
Console.WriteLine("Updated the bandwidth rate limits of " +
returnGatewayARN);
Console.WriteLine("Upload bandwidth limit = " + uplo " bits per
second");
Console.WriteLine("Download bandwidth limit = " + downlo " bits per
second");
}
catch (AmazonStorageGatewayException ex)
{
Console.WriteLine("Error updating gateway bandwith.\n" + ex.ToString());
}
}
}
}
Updating Gateway Bandwidth Rate Limits Using the
AWS Tools for Windows PowerShell
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 using the AWS Tools for Windows PowerShell. To use the example code,
you should be familiar with running a PowerShell script. For more information, see
AWS Tools for Windows PowerShell User Guide
.
Example : Updating Gateway Bandwidth Limits by Using the AWS Tools for Windows
PowerShell
The following PowerShell script example updates a gateway's bandwidth rate limits. You need to update
the script and provide your gateway Amazon Resource Name (ARN), and the upload and download limits.
<#
.DESCRIPTION
Update Gateway bandwidth limits.
API Version 2013-06-30
227