scaling_policies
Creates, updates, deletes or gets a scaling_policy
resource or lists scaling_policies
in a region
Overview
Name | scaling_policies |
Type | Resource |
Description | Resource Type definition for AWS::ApplicationAutoScaling::ScalingPolicy |
Id | aws.applicationautoscaling.scaling_policies |
Fields
Name | Datatype | Description |
---|---|---|
policy_name | string | The name of the scaling policy. Updates to the name of a target tracking scaling policy are not supported, unless you also update the metric used for scaling. To change only a target tracking scaling policy's name, first delete the policy by removing the existing AWS::ApplicationAutoScaling::ScalingPolicy resource from the template and updating the stack. Then, recreate the resource with the same settings and a different name. |
policy_type | string | The scaling policy type. The following policy types are supported: TargetTrackingScaling Not supported for Amazon EMR StepScaling Not supported for DynamoDB, Amazon Comprehend, Lambda, Amazon Keyspaces, Amazon MSK, Amazon ElastiCache, or Neptune. |
resource_id | string | The identifier of the resource associated with the scaling policy. This string consists of the resource type and unique identifier. |
scalable_dimension | string | The scalable dimension. This string consists of the service namespace, resource type, and scaling property. |
scaling_target_id | string | The CloudFormation-generated ID of an Application Auto Scaling scalable target. For more information about the ID, see the Return Value section of the AWS::ApplicationAutoScaling::ScalableTarget resource. |
service_namespace | string | The namespace of the AWS service that provides the resource, or a custom-resource. |
step_scaling_policy_configuration | object | A step scaling policy. |
target_tracking_scaling_policy_configuration | object | A target tracking scaling policy. |
arn | string | ARN is a read only property for the resource. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | PolicyName, PolicyType, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all scaling_policies
in a region.
SELECT
region,
policy_name,
policy_type,
resource_id,
scalable_dimension,
scaling_target_id,
service_namespace,
step_scaling_policy_configuration,
target_tracking_scaling_policy_configuration,
arn
FROM aws.applicationautoscaling.scaling_policies
WHERE region = 'us-east-1';
Gets all properties from an individual scaling_policy
.
SELECT
region,
policy_name,
policy_type,
resource_id,
scalable_dimension,
scaling_target_id,
service_namespace,
step_scaling_policy_configuration,
target_tracking_scaling_policy_configuration,
arn
FROM aws.applicationautoscaling.scaling_policies
WHERE region = 'us-east-1' AND data__Identifier = '<Arn>|<ScalableDimension>';
INSERT
example
Use the following StackQL query and manifest file to create a new scaling_policy
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.applicationautoscaling.scaling_policies (
PolicyName,
PolicyType,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyType }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.applicationautoscaling.scaling_policies (
PolicyName,
PolicyType,
ResourceId,
ScalableDimension,
ScalingTargetId,
ServiceNamespace,
StepScalingPolicyConfiguration,
TargetTrackingScalingPolicyConfiguration,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyType }}',
'{{ ResourceId }}',
'{{ ScalableDimension }}',
'{{ ScalingTargetId }}',
'{{ ServiceNamespace }}',
'{{ StepScalingPolicyConfiguration }}',
'{{ TargetTrackingScalingPolicyConfiguration }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: scaling_policy
props:
- name: PolicyName
value: '{{ PolicyName }}'
- name: PolicyType
value: '{{ PolicyType }}'
- name: ResourceId
value: '{{ ResourceId }}'
- name: ScalableDimension
value: '{{ ScalableDimension }}'
- name: ScalingTargetId
value: '{{ ScalingTargetId }}'
- name: ServiceNamespace
value: '{{ ServiceNamespace }}'
- name: StepScalingPolicyConfiguration
value:
AdjustmentType: '{{ AdjustmentType }}'
Cooldown: '{{ Cooldown }}'
MetricAggregationType: '{{ MetricAggregationType }}'
MinAdjustmentMagnitude: '{{ MinAdjustmentMagnitude }}'
StepAdjustments:
- MetricIntervalLowerBound: null
MetricIntervalUpperBound: null
ScalingAdjustment: '{{ ScalingAdjustment }}'
- name: TargetTrackingScalingPolicyConfiguration
value:
CustomizedMetricSpecification:
Dimensions:
- Name: '{{ Name }}'
Value: '{{ Value }}'
MetricName: '{{ MetricName }}'
Namespace: '{{ Namespace }}'
Statistic: '{{ Statistic }}'
Unit: '{{ Unit }}'
Metrics:
- Expression: '{{ Expression }}'
Id: '{{ Id }}'
Label: '{{ Label }}'
ReturnData: '{{ ReturnData }}'
MetricStat:
Metric:
Dimensions:
- Name: '{{ Name }}'
Value: '{{ Value }}'
MetricName: '{{ MetricName }}'
Namespace: '{{ Namespace }}'
Stat: '{{ Stat }}'
Unit: '{{ Unit }}'
DisableScaleIn: '{{ DisableScaleIn }}'
PredefinedMetricSpecification:
PredefinedMetricType: '{{ PredefinedMetricType }}'
ResourceLabel: '{{ ResourceLabel }}'
ScaleInCooldown: '{{ ScaleInCooldown }}'
ScaleOutCooldown: '{{ ScaleOutCooldown }}'
TargetValue: null
DELETE
example
/*+ delete */
DELETE FROM aws.applicationautoscaling.scaling_policies
WHERE data__Identifier = '<Arn|ScalableDimension>'
AND region = 'us-east-1';
Permissions
To operate on the scaling_policies
resource, the following permissions are required:
Create
application-autoscaling:DescribeScalingPolicies,
application-autoscaling:PutScalingPolicy
Read
application-autoscaling:DescribeScalingPolicies
Update
application-autoscaling:DescribeScalingPolicies,
application-autoscaling:PutScalingPolicy
Delete
application-autoscaling:DescribeScalingPolicies,
application-autoscaling:DeleteScalingPolicy
List
application-autoscaling:DescribeScalingPolicies