AWS Storage Gateway User Guide
Using the AWS SDK for Java
4. In the
Edit Rate Limits
dialog box, type new limit values, and then choose
Save
. Your changes
appear in the
Details
tab for your gateway.
Updating Gateway Bandwidth Rate Limits Using the
AWS SDK for Java
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 SDK for Java. To use the example code, you should be
familiar with running a Java console application. For more information, see
in the
AWS
SDK for Java Developer Guide
.
Example : Updating Gateway Bandwidth Limits Using the AWS SDK for Java
The following Java 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
.
import java.io.IOException;
import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.storagegateway.AWSStorageGatewayClient;
import com.amazonaws.services.storagegateway.model.UpdateBandwidthRateLimitRequest;
import com.amazonaws.services.storagegateway.model.UpdateBandwidthRateLimitResult;
public class UpdateBandwidthExample {
public static AWSStorageGatewayClient sgClient;
// 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
public static void main(String[] args) throws IOException {
// Create a storage gateway client
sgClient = new AWSStorageGatewayClient(new PropertiesCredentials(
ListDeleteVolumeSnapshotsExample.class.getResourceAsStream("AwsCredentials.properties")));
sgClient.setEndpoint(serviceURL);
UpdateBandwidth(gatewayARN, uploadRate, downloadRate);
}
private static void UpdateBandwidth(String gatewayARN2, long uploadRate2,
long downloadRate2) {
try
{
UpdateBandwidthRateLimitRequest updateBandwidthRateLimitRequest =
API Version 2013-06-30
225