- 最新
- 投票最多
- 评论最多
Perhaps you could use AWS CLI to execute the creation. https://docs.aws.amazon.com/cli/latest/reference/autoscaling/index.html
What I want is the Lambda function uploading metrics to CloudWatch, and then a scaling policy which is reacting to those metrics. Particularly, I was clarifying my problem according to Shahad_C answer.
Based on your followup comment, it sounds like you might be mentally combining a few different things which are separate processes
The lambda function is going to push metrics to CloudWatch, creating a Custom Metric. When pushing the values, you'll set the Namespace, MetricName, and optionally set a unit and dimension(s). That's one isolated process
Now in the AutoScaling Group (ASG), you can create one or more scaling policies which can react to those metrics, with a CloudWatch alarm acting as the glue to tie the two together for a dynamic scaling policy. You mentioned a Predictive Scaling Policy, but keep in mind those are running once a day, and then create capacity predictions for entire hours. So while you can use one if your load has a cyclical pattern, you should also use a dynamic scaling policy either way to react to real time changes in the metric.
The simplest Dynamic Scaling policy to setup is Target Tracking. Make sure the metric meets the Target Tracking requirements listed in that doc (changes proportionally to the load and instances, liner, etc). For both Target Tracking and Predictive Scaling, you'll define the Custom Metric Specification based on the Namespace, MetricName, and (if set when uploading the metric) a unit and dimension(s)
Predictive Scaling needs 2 metrics defined, the load metric (something representing the total load on the entire ASG), and the scaling metric (something representing the change as scaling happens). For example, if scaling on CPU, then the SUM of the CPU metric would be the Load metric (totaling the CPU usage of every instance int the ASG); and the AVERAGE of the CPU metric would be the Scaling metric (as more instances are added with a constant load, average CPU would go down as the load is spread between more instances)
相关内容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 7 个月前
There's some conflicting information here. Are you creating a new ASG (AutoScaling Group) every time the Lambda runs? Are you creating a new scaling policy? Or is the Lambda function uploading metrics to CloudWatch, and you need a scaling policy which is reacting to those metrics?