Show / Hide Table of Contents

Class Policy

Provides an Application AutoScaling Policy resource.

Example Usage

DynamoDB Table Autoscaling

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var dynamodbTableReadTarget = new Aws.AppAutoScaling.Target("dynamodbTableReadTarget", new Aws.AppAutoScaling.TargetArgs
    {
        MaxCapacity = 100,
        MinCapacity = 5,
        ResourceId = "table/tableName",
        ScalableDimension = "dynamodb:table:ReadCapacityUnits",
        ServiceNamespace = "dynamodb",
    });
    var dynamodbTableReadPolicy = new Aws.AppAutoScaling.Policy("dynamodbTableReadPolicy", new Aws.AppAutoScaling.PolicyArgs
    {
        PolicyType = "TargetTrackingScaling",
        ResourceId = dynamodbTableReadTarget.ResourceId,
        ScalableDimension = dynamodbTableReadTarget.ScalableDimension,
        ServiceNamespace = dynamodbTableReadTarget.ServiceNamespace,
        TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
        {
            PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
            {
                PredefinedMetricType = "DynamoDBReadCapacityUtilization",
            },
            TargetValue = 70,
        },
    });
}

}

ECS Service Autoscaling

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var ecsTarget = new Aws.AppAutoScaling.Target("ecsTarget", new Aws.AppAutoScaling.TargetArgs
    {
        MaxCapacity = 4,
        MinCapacity = 1,
        ResourceId = "service/clusterName/serviceName",
        ScalableDimension = "ecs:service:DesiredCount",
        ServiceNamespace = "ecs",
    });
    var ecsPolicy = new Aws.AppAutoScaling.Policy("ecsPolicy", new Aws.AppAutoScaling.PolicyArgs
    {
        PolicyType = "StepScaling",
        ResourceId = ecsTarget.ResourceId,
        ScalableDimension = ecsTarget.ScalableDimension,
        ServiceNamespace = ecsTarget.ServiceNamespace,
        StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs
        {
            AdjustmentType = "ChangeInCapacity",
            Cooldown = 60,
            MetricAggregationType = "Maximum",
            StepAdjustment = 
            {

                {
                    { "metricIntervalUpperBound", 0 },
                    { "scalingAdjustment", -1 },
                },
            },
        },
    });
}

}

Aurora Read Replica Autoscaling

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var replicasTarget = new Aws.AppAutoScaling.Target("replicasTarget", new Aws.AppAutoScaling.TargetArgs
    {
        MaxCapacity = 15,
        MinCapacity = 1,
        ResourceId = $"cluster:{aws_rds_cluster.Example.Id}",
        ScalableDimension = "rds:cluster:ReadReplicaCount",
        ServiceNamespace = "rds",
    });
    var replicasPolicy = new Aws.AppAutoScaling.Policy("replicasPolicy", new Aws.AppAutoScaling.PolicyArgs
    {
        PolicyType = "TargetTrackingScaling",
        ResourceId = replicasTarget.ResourceId,
        ScalableDimension = replicasTarget.ScalableDimension,
        ServiceNamespace = replicasTarget.ServiceNamespace,
        TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
        {
            PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
            {
                PredefinedMetricType = "RDSReaderAverageCPUUtilization",
            },
            ScaleInCooldown = 300,
            ScaleOutCooldown = 300,
            TargetValue = 75,
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Policy
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.AppAutoScaling
Assembly: Pulumi.Aws.dll
Syntax
public class Policy : CustomResource

Constructors

View Source

Policy(String, PolicyArgs, CustomResourceOptions)

Create a Policy resource with the given unique name, arguments, and options.

Declaration
public Policy(string name, PolicyArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

PolicyArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Arn

The ARN assigned by AWS to the scaling policy.

Declaration
public Output<string> Arn { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name of the policy.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

PolicyType

The policy type. Valid values are StepScaling and TargetTrackingScaling. Defaults to StepScaling. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation.

Declaration
public Output<string> PolicyType { get; }
Property Value
Type Description
Output<System.String>
View Source

ResourceId

The resource type and unique identifier string for the resource associated with the scaling policy. Documentation can be found in the ResourceId parameter at: AWS Application Auto Scaling API Reference

Declaration
public Output<string> ResourceId { get; }
Property Value
Type Description
Output<System.String>
View Source

ScalableDimension

The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference

Declaration
public Output<string> ScalableDimension { get; }
Property Value
Type Description
Output<System.String>
View Source

ServiceNamespace

The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference

Declaration
public Output<string> ServiceNamespace { get; }
Property Value
Type Description
Output<System.String>
View Source

StepScalingPolicyConfiguration

Step scaling policy configuration, requires policy_type = &quot;StepScaling&quot; (default). See supported fields below.

Declaration
public Output<PolicyStepScalingPolicyConfiguration> StepScalingPolicyConfiguration { get; }
Property Value
Type Description
Output<PolicyStepScalingPolicyConfiguration>
View Source

TargetTrackingScalingPolicyConfiguration

A target tracking policy, requires policy_type = &quot;TargetTrackingScaling&quot;. See supported fields below.

Declaration
public Output<PolicyTargetTrackingScalingPolicyConfiguration> TargetTrackingScalingPolicyConfiguration { get; }
Property Value
Type Description
Output<PolicyTargetTrackingScalingPolicyConfiguration>

Methods

View Source

Get(String, Input<String>, PolicyState, CustomResourceOptions)

Get an existing Policy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Policy Get(string name, Input<string> id, PolicyState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

PolicyState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Policy
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.