Under IAM enforcement, Application Auto Scaling requests were checked on
`*`, so a grant scoped to a scalable target was refused and a deny
scoped to one never applied.
A scalable target's ARN ends in a unique id the service assigns,
`scalable-target/<id>` ("The unique ID ... is a value assigned by
Application Auto Scaling to the scalable target"), which the Service
Reference names ${ResourceId}, while requests name the target by
ServiceNamespace, ResourceId and ScalableDimension. Read as the table
reads other services, ResourceId (`service/<cluster>/<service>`) would
have filled that id, so the namespace was left out until the table could
look the ARN up.
The generator's new FOUND_BY gives a type whose ARN is all an id its
service mints, with the members a request names it by. An operation
whose request has them all names the type by them (`find`), generated
rather than corrected, and the reader asks the service for the ARN they
find through StoredResourceArns, the lookup EventBridge's connections
already use, or else checks the ARN with its id open, as for a create.
StoredResourceArns.find now takes the values a request names the
resource by, in the table's order: one name for EventBridge, the three
members for Application Auto Scaling, whose service now implements it
from the store its handlers read. A member left out or given a JSON
null names none, as the handler reads it.
Application Auto Scaling joins the table (14 operations, 1036 over 25
namespaces): RegisterScalableTarget, DeregisterScalableTarget,
PutScalingPolicy, DeleteScalingPolicy, PutScheduledAction and
DeleteScheduledAction are checked on the target's stored ARN, and a
RegisterScalableTarget registering a new one, its tags included, on
`scalable-target/*`; TagResource, UntagResource and
ListTagsForResource on the ARN their ResourceARN gives; the Describe
operations and GetPredictiveScalingForecast on `*`, as AWS checks them.
* fix(applicationautoscaling): target-tracking alarms watch the real metric, not the policy type name
CustomizedMetricSpecification passes Namespace, MetricName, Dimensions,
Statistic and Unit onto the AlarmHigh and AlarmLow alarms as given, and
the ECSServiceAverageCPUUtilization, ECSServiceAverageMemoryUtilization
and ALBRequestCountPerTarget predefined types map onto the documented
AWS/ECS and AWS/ApplicationELB metric identities, so the alarms see data
published the way AWS (or the caller) publishes it.
Closes#6853
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(applicationautoscaling): read ALB target-tracking alarms through Sum
RequestCountPerTarget data points already carry the per-minute average
across the target group, and CloudWatch names Sum as the only valid
statistic for the metric, so an Average alarm compares the target
against a second average and misses scale-outs (two samples of 600
read 600 instead of 1200 against a target of 1000). The statistic now
travels with each predefined metric mapping, keeping Average for the
ECS utilisation gauges.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
Querying exactly EvaluationPeriods buckets fell back to TreatMissingData as soon
as one was empty. Real datapoints reaching further back now decide the state
first, and the premature-transition rule is honored.
Fixes#2700
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
Adds a generic CloudWatch alarm evaluator plus an ECS CapacityAdjuster,
so a firing policy calls UpdateService to change desiredCount instead
of sitting inert. Adds DescribeScalingActivities to observe the result.
Closes#2565
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* feat(applicationautoscaling): add Application Auto Scaling control plane
Adds a services/applicationautoscaling package emulating the Application
Auto Scaling API (JSON 1.1, AnyScaleFrontendService. target prefix,
application-autoscaling signing name). This is a distinct service from the
existing EC2 Auto Scaling package, which speaks Query under the
autoscaling signing name.
Implements the nine actions Terraform exercises: RegisterScalableTarget,
DescribeScalableTargets, DeregisterScalableTarget, PutScalingPolicy,
DescribeScalingPolicies, DeleteScalingPolicy, and the ListTagsForResource
/ TagResource / UntagResource trio.
Notable behaviours:
- Identity is the (ServiceNamespace, ResourceId, ScalableDimension)
triple; RegisterScalableTarget upserts on it and leaves unsupplied
parameters unchanged, matching AWS.
- ScalableTargetARN uses the application-autoscaling service name while
PolicyARN uses plain autoscaling and embeds the resource path and policy
name — the two ARN families genuinely differ.
- Tagging resolves by ScalableTargetARN because the Terraform provider's
transparent-tagging interceptor calls ListTagsForResource on every read,
keyed on the ARN it reads from DescribeScalableTargets.
- Target-tracking policies create the real pair of CloudWatch alarms AWS
creates on the caller's behalf; deregistering a scalable target deletes
its policies and their alarms.
- Optional configuration fields are only echoed back when supplied, so
Terraform never sees a value it did not configure.
Scaling policies are stored and described but inert: nothing evaluates
them and no capacity is adjusted, mirroring EC2 Auto Scaling's existing
PutScalingPolicy. This is documented in docs/services/applicationautoscaling.md.
Closes#2157
* refactor(applicationautoscaling): stop exposing the scalable target's tag map
getTags() handed out the live internal map, and the service mutated it in
place at three call sites. listTagsForResource also returned that same
live reference out to the handler layer, so a caller could alter stored
state without going through the service.
getTags() now returns an unmodifiable view, with putTags/removeTags for
the mutations the service actually needs, and a test pins the read-only
contract.
Reported by github-code-quality on #2159.