创建具有自动缩放组警报的扩展策略时出现以下错误。
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);
这里遗漏的是什么?请帮忙!