Skip to main content

aws_application_autoscaling_scaling_policies Resource

Use the aws_application_autoscaling_scaling_policies InSpec audit resource to test properties of multiple AWS Application Auto Scaling scaling policies.

For additional information, including details on parameters and properties, see the AWS ApplicationAutoScaling ScalingPolicy documentation.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure a scaling policy exists.

describe aws_application_autoscaling_scaling_policies( service_namespace: 'SERVICE_NAMESPACE' ) do
  it { should exist }
end

Parameters

service_namespace (required)

The namespace of the AWS service that provides the resource, or a custom-resource.

Properties

policy_arns
The Amazon Resource Name (ARN) of the scaling policy.
policy_names
The name of the scaling policy.
service_namespaces
The namespace of the AWS service that provides the resource, or a custom-resource.
resource_ids
The identifier of the resource associated with the scaling policy. This string consists of the resource type and unique identifier.
scalable_dimensions
The scalable dimension. This string consists of the service namespace, resource type, and scaling property.
policy_types
The scaling policy type.
step_scaling_policy_configurations
A step scaling policy.
target_tracking_scaling_policy_configurations
A target tracking scaling policy.
alarms
The CloudWatch alarms associated with the scaling policy.
creation_times
The Unix timestamp for when the scaling policy was created.

Examples

Ensure a policy name is available.

describe aws_application_autoscaling_scaling_policies( service_namespace: 'SERVICE_NAMESPACE' ) do
  its('policy_names') { should include 'POLICY_NAME' }
end

Ensure a policy type is available.

describe aws_application_autoscaling_scaling_policies( service_namespace: 'SERVICE_NAMESPACE' ) do
    its('policy_types') { should include "POLICY_TYPE" }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

The controls will pass if the describe method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_application_autoscaling_scaling_policies( service_namespace: 'SERVICE_NAMESPACE' ) do
  it { should exist }
end

be_available

Use should to check if the scalable policy is available.

describe aws_application_autoscaling_scaling_policies( service_namespace: 'SERVICE_NAMESPACE' ) do
  it { should be_available }
end

AWS Permissions

Your Principal will need the ApplicationAutoScaling:Client:DescribeScalingPoliciesResponse action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×