steampipe plugin install aws

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.

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_time
from
aws_appautoscaling_policy
where
service_namespace = 'ecs';
select
service_namespace,
scalable_dimension,
policy_type,
resource_id,
creation_time
from
aws_appautoscaling_policy
where
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_type
from
aws_appautoscaling_policy
where
service_namespace = 'ecs'
and policy_type = 'StepScaling';
select
resource_id,
policy_type
from
aws_appautoscaling_policy
where
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_type
from
aws_appautoscaling_policy
where
service_namespace = 'ecs'
and creation_time > now() - interval '30 days';
select
resource_id,
policy_type
from
aws_appautoscaling_policy
where
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_name
from
aws_appautoscaling_policy
where
service_namespace = 'ecs';
select
resource_id,
policy_type,
json_extract(json_each.value, '$.AlarmName') as alarm_name
from
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_configuration
from
aws_appautoscaling_policy
where
service_namespace = 'ecs'
and policy_type = 'StepScaling';
select
resource_id,
policy_type,
step_scaling_policy_configuration
from
aws_appautoscaling_policy
where
service_namespace = 'ecs'
and policy_type = 'StepScaling';

Schema for aws_appautoscaling_policy

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
alarmsjsonbThe CloudWatch alarms associated with the scaling policy.
creation_timetimestamp with time zoneThe Unix timestamp for when the scaling policy was created.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
policy_arntextThe Amazon Resource Name (ARN) of the appautoscaling policy.
policy_nametext=The name of the scaling policy.
policy_typetextThe policy type. Currently supported values are TargetTrackingScaling and StepScaling
regiontextThe AWS Region in which the resource is located.
resource_idtext=The identifier of the resource associated with the scaling policy.
scalable_dimensiontextThe scalable dimension associated with the scaling policy. This string consists of the service namespace, resource type, and scaling property.
service_namespacetext=The namespace of the AWS service that provides the resource, or a custom-resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
step_scaling_policy_configurationjsonbThe step tracking scaling policy configuration (if policy type is StepScaling).
target_tracking_scaling_policy_configurationjsonbThe target tracking scaling policy configuration (if policy type is TargetTrackingScaling).
titletextTitle 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