Table: aws_appautoscaling_policy - Query AWS Application Auto Scaling Policies using SQL
The AWS Application Auto Scaling Policies allow you to manage the scaling of your applications in response to their demand patterns. They enable automatic adjustments to the scalable target capacity as needed to maintain optimal resource utilization. This ensures that your applications always have the right resources at the right time, improving their performance and reducing costs.
Table Usage Guide
The aws_appautoscaling_policy
table in Steampipe provides you with information about Application Auto Scaling policies in AWS. This table allows you, as a DevOps engineer, system administrator, or other technical professional, to query policy-specific details, including the scaling target, scaling dimensions, and associated metadata. You can utilize this table to gather insights on policies, such as policy configurations, attached resources, scaling activities, and more. The schema outlines the various attributes of the Application Auto Scaling policy, including the policy ARN, policy type, creation time, and associated tags for you.
Important Notes
- You must specify
service_namespace
in awhere
clause in order to use this table. - For supported values of the service namespace, please refer Service Namespace.
- This table supports optional quals. Queries with optional quals are optimised to use additional filtering provided by the AWS API function. Optional quals are supported for the following columns:
policy_name
resource_id
Examples
Basic info
Analyze the settings to understand the policies associated with your AWS ECS service. This can help in managing the scaling behavior of the resources in the ECS service, identifying the dimensions that are scalable, and the time of policy creation.
select service_namespace, scalable_dimension, policy_type, resource_id, creation_timefrom aws_appautoscaling_policywhere service_namespace = 'ecs';
select service_namespace, scalable_dimension, policy_type, resource_id, creation_timefrom aws_appautoscaling_policywhere service_namespace = 'ecs';
List policies for ECS services with policy type Step scaling
Determine the areas in which step scaling policies are applied for ECS services. This can help in managing and optimizing resource allocation for your applications.
select resource_id, policy_typefrom aws_appautoscaling_policywhere service_namespace = 'ecs' and policy_type = 'StepScaling';
select resource_id, policy_typefrom aws_appautoscaling_policywhere service_namespace = 'ecs' and policy_type = 'StepScaling';
List policies for ECS services created in the last 30 days
Identify recent policy changes for your ECS services. This query is useful for monitoring and managing your autoscaling configuration, allowing you to track changes made within the last month.
select resource_id, policy_typefrom aws_appautoscaling_policywhere service_namespace = 'ecs' and creation_time > now() - interval '30 days';
select resource_id, policy_typefrom aws_appautoscaling_policywhere service_namespace = 'ecs' and creation_time > datetime('now', '-30 days');
Get the CloudWatch alarms associated with the Auto Scaling policy
Determine the areas in which CloudWatch alarms are linked to an Auto Scaling policy. This can be beneficial in understanding the alarm triggers and managing resources within the Elastic Container Service (ECS).
select resource_id, policy_type, jsonb_array_elements(alarms) -> 'AlarmName' as alarm_namefrom aws_appautoscaling_policywhere service_namespace = 'ecs';
select resource_id, policy_type, json_extract(json_each.value, '$.AlarmName') as alarm_namefrom aws_appautoscaling_policy, json_each(alarms)where service_namespace = 'ecs';
Get the configuration for Step scaling type policies
Explore the setup of step scaling policies within the ECS service namespace to understand how application auto scaling is configured.
select resource_id, policy_type, step_scaling_policy_configurationfrom aws_appautoscaling_policywhere service_namespace = 'ecs' and policy_type = 'StepScaling';
select resource_id, policy_type, step_scaling_policy_configurationfrom aws_appautoscaling_policywhere service_namespace = 'ecs' and policy_type = 'StepScaling';
Schema for aws_appautoscaling_policy
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
alarms | jsonb | The CloudWatch alarms associated with the scaling policy. | |
creation_time | timestamp with time zone | The Unix timestamp for when the scaling policy was created. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
policy_arn | text | The Amazon Resource Name (ARN) of the appautoscaling policy. | |
policy_name | text | = | The name of the scaling policy. |
policy_type | text | The policy type. Currently supported values are TargetTrackingScaling and StepScaling | |
region | text | The AWS Region in which the resource is located. | |
resource_id | text | = | The identifier of the resource associated with the scaling policy. |
scalable_dimension | text | The scalable dimension associated with the scaling policy. This string consists of the service namespace, resource type, and scaling property. | |
service_namespace | text | = | The namespace of the AWS service that provides the resource, or a custom-resource. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
step_scaling_policy_configuration | jsonb | The step tracking scaling policy configuration (if policy type is StepScaling). | |
target_tracking_scaling_policy_configuration | jsonb | The target tracking scaling policy configuration (if policy type is TargetTrackingScaling). | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_appautoscaling_policy