AmazonServiceException:指定了无效的区域us-west-2。仅支持us-east-1

时间:2016-07-20 10:17:35

标签: java amazon-web-services aws-sdk autoscaling

创建具有自动缩放组警报的扩展策略时出现以下错误。

com.amazonaws.AmazonServiceException: Invalid region us-west-2 specified. Only us-east-1 is supported. (Service: AmazonCloudWatch; Status Code: 400; Error Code: ValidationError; Request ID: 7582...

扩展政策

for (AutoScalingGroup asg: autoScalingGroups){
PutScalingPolicyRequest spr = new PutScalingPolicyRequest();
        spr.setAutoScalingGroupName(asg.getAutoScalingGroupName());
        spr.setPolicyName("testautoscalePolicy");
        spr.setAdjustmentType("ChangeInCapacity");
        spr.setScalingAdjustment(2);
PutScalingPolicyResult result1 = autoClient.putScalingPolicy(spr);

警报

 PutMetricAlarmRequest putMetricAlarmRequest = new PutMetricAlarmRequest();
        putMetricAlarmRequest.setAlarmName("Scaleup-alarm");
        putMetricAlarmRequest.setMetricName("CPUUtilization");
        putMetricAlarmRequest.setComparisonOperator(ComparisonOperator.GreaterThanOrEqualToThreshold);
        putMetricAlarmRequest.setStatistic(Statistic.Sum);
        putMetricAlarmRequest.setUnit(StandardUnit.Percent);
        putMetricAlarmRequest.setThreshold(40.0);
        putMetricAlarmRequest.setPeriod(60);
        putMetricAlarmRequest.setEvaluationPeriods(1);
List actions = new ArrayList();
actions.add(result1.getPolicyARN());
putMetricAlarmRequest.setAlarmActions(actions);

AmazonCloudWatchClient amazonCloudWatchClient = new AmazonCloudWatchClient(awscredentials);
PutMetricAlarmResult alarmResult = amazonCloudWatchClient.putMetricAlarm(putMetricAlarmRequest);

这里遗漏的是什么?请帮忙!

0 个答案:

没有答案