Try AWS Native preview for resources not in the classic version.
aws.appautoscaling.Policy
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides an Application AutoScaling Policy resource.
Example Usage
DynamoDB Table Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const dynamodbTableReadTarget = new aws.appautoscaling.Target("dynamodb_table_read_target", {
maxCapacity: 100,
minCapacity: 5,
resourceId: "table/tableName",
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});
const dynamodbTableReadPolicy = new aws.appautoscaling.Policy("dynamodb_table_read_policy", {
name: pulumi.interpolate`DynamoDBReadCapacityUtilization:${dynamodbTableReadTarget.resourceId}`,
policyType: "TargetTrackingScaling",
resourceId: dynamodbTableReadTarget.resourceId,
scalableDimension: dynamodbTableReadTarget.scalableDimension,
serviceNamespace: dynamodbTableReadTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "DynamoDBReadCapacityUtilization",
},
targetValue: 70,
},
});
import pulumi
import pulumi_aws as aws
dynamodb_table_read_target = aws.appautoscaling.Target("dynamodb_table_read_target",
max_capacity=100,
min_capacity=5,
resource_id="table/tableName",
scalable_dimension="dynamodb:table:ReadCapacityUnits",
service_namespace="dynamodb")
dynamodb_table_read_policy = aws.appautoscaling.Policy("dynamodb_table_read_policy",
name=dynamodb_table_read_target.resource_id.apply(lambda resource_id: f"DynamoDBReadCapacityUtilization:{resource_id}"),
policy_type="TargetTrackingScaling",
resource_id=dynamodb_table_read_target.resource_id,
scalable_dimension=dynamodb_table_read_target.scalable_dimension,
service_namespace=dynamodb_table_read_target.service_namespace,
target_tracking_scaling_policy_configuration={
"predefinedMetricSpecification": {
"predefinedMetricType": "DynamoDBReadCapacityUtilization",
},
"targetValue": 70,
})
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
dynamodbTableReadTarget, err := appautoscaling.NewTarget(ctx, "dynamodb_table_read_target", &appautoscaling.TargetArgs{
MaxCapacity: pulumi.Int(100),
MinCapacity: pulumi.Int(5),
ResourceId: pulumi.String("table/tableName"),
ScalableDimension: pulumi.String("dynamodb:table:ReadCapacityUnits"),
ServiceNamespace: pulumi.String("dynamodb"),
})
if err != nil {
return err
}
_, err = appautoscaling.NewPolicy(ctx, "dynamodb_table_read_policy", &appautoscaling.PolicyArgs{
Name: dynamodbTableReadTarget.ResourceId.ApplyT(func(resourceId string) (string, error) {
return fmt.Sprintf("DynamoDBReadCapacityUtilization:%v", resourceId), nil
}).(pulumi.StringOutput),
PolicyType: pulumi.String("TargetTrackingScaling"),
ResourceId: dynamodbTableReadTarget.ResourceId,
ScalableDimension: dynamodbTableReadTarget.ScalableDimension,
ServiceNamespace: dynamodbTableReadTarget.ServiceNamespace,
TargetTrackingScalingPolicyConfiguration: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationArgs{
PredefinedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs{
PredefinedMetricType: pulumi.String("DynamoDBReadCapacityUtilization"),
},
TargetValue: pulumi.Float64(70),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var dynamodbTableReadTarget = new Aws.AppAutoScaling.Target("dynamodb_table_read_target", new()
{
MaxCapacity = 100,
MinCapacity = 5,
ResourceId = "table/tableName",
ScalableDimension = "dynamodb:table:ReadCapacityUnits",
ServiceNamespace = "dynamodb",
});
var dynamodbTableReadPolicy = new Aws.AppAutoScaling.Policy("dynamodb_table_read_policy", new()
{
Name = dynamodbTableReadTarget.ResourceId.Apply(resourceId => $"DynamoDBReadCapacityUtilization:{resourceId}"),
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,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import com.pulumi.aws.appautoscaling.Policy;
import com.pulumi.aws.appautoscaling.PolicyArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dynamodbTableReadTarget = new Target("dynamodbTableReadTarget", TargetArgs.builder()
.maxCapacity(100)
.minCapacity(5)
.resourceId("table/tableName")
.scalableDimension("dynamodb:table:ReadCapacityUnits")
.serviceNamespace("dynamodb")
.build());
var dynamodbTableReadPolicy = new Policy("dynamodbTableReadPolicy", PolicyArgs.builder()
.name(dynamodbTableReadTarget.resourceId().applyValue(resourceId -> String.format("DynamoDBReadCapacityUtilization:%s", resourceId)))
.policyType("TargetTrackingScaling")
.resourceId(dynamodbTableReadTarget.resourceId())
.scalableDimension(dynamodbTableReadTarget.scalableDimension())
.serviceNamespace(dynamodbTableReadTarget.serviceNamespace())
.targetTrackingScalingPolicyConfiguration(PolicyTargetTrackingScalingPolicyConfigurationArgs.builder()
.predefinedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs.builder()
.predefinedMetricType("DynamoDBReadCapacityUtilization")
.build())
.targetValue(70)
.build())
.build());
}
}
resources:
dynamodbTableReadTarget:
type: aws:appautoscaling:Target
name: dynamodb_table_read_target
properties:
maxCapacity: 100
minCapacity: 5
resourceId: table/tableName
scalableDimension: dynamodb:table:ReadCapacityUnits
serviceNamespace: dynamodb
dynamodbTableReadPolicy:
type: aws:appautoscaling:Policy
name: dynamodb_table_read_policy
properties:
name: DynamoDBReadCapacityUtilization:${dynamodbTableReadTarget.resourceId}
policyType: TargetTrackingScaling
resourceId: ${dynamodbTableReadTarget.resourceId}
scalableDimension: ${dynamodbTableReadTarget.scalableDimension}
serviceNamespace: ${dynamodbTableReadTarget.serviceNamespace}
targetTrackingScalingPolicyConfiguration:
predefinedMetricSpecification:
predefinedMetricType: DynamoDBReadCapacityUtilization
targetValue: 70
ECS Service Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecs_target", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {
name: "scale-down",
policyType: "StepScaling",
resourceId: ecsTarget.resourceId,
scalableDimension: ecsTarget.scalableDimension,
serviceNamespace: ecsTarget.serviceNamespace,
stepScalingPolicyConfiguration: {
adjustmentType: "ChangeInCapacity",
cooldown: 60,
metricAggregationType: "Maximum",
stepAdjustments: [{
metricIntervalUpperBound: "0",
scalingAdjustment: -1,
}],
},
});
import pulumi
import pulumi_aws as aws
ecs_target = aws.appautoscaling.Target("ecs_target",
max_capacity=4,
min_capacity=1,
resource_id="service/clusterName/serviceName",
scalable_dimension="ecs:service:DesiredCount",
service_namespace="ecs")
ecs_policy = aws.appautoscaling.Policy("ecs_policy",
name="scale-down",
policy_type="StepScaling",
resource_id=ecs_target.resource_id,
scalable_dimension=ecs_target.scalable_dimension,
service_namespace=ecs_target.service_namespace,
step_scaling_policy_configuration={
"adjustmentType": "ChangeInCapacity",
"cooldown": 60,
"metricAggregationType": "Maximum",
"stepAdjustments": [{
"metricIntervalUpperBound": "0",
"scalingAdjustment": -1,
}],
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ecsTarget, err := appautoscaling.NewTarget(ctx, "ecs_target", &appautoscaling.TargetArgs{
MaxCapacity: pulumi.Int(4),
MinCapacity: pulumi.Int(1),
ResourceId: pulumi.String("service/clusterName/serviceName"),
ScalableDimension: pulumi.String("ecs:service:DesiredCount"),
ServiceNamespace: pulumi.String("ecs"),
})
if err != nil {
return err
}
_, err = appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{
Name: pulumi.String("scale-down"),
PolicyType: pulumi.String("StepScaling"),
ResourceId: ecsTarget.ResourceId,
ScalableDimension: ecsTarget.ScalableDimension,
ServiceNamespace: ecsTarget.ServiceNamespace,
StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{
AdjustmentType: pulumi.String("ChangeInCapacity"),
Cooldown: pulumi.Int(60),
MetricAggregationType: pulumi.String("Maximum"),
StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{
&appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{
MetricIntervalUpperBound: pulumi.String("0"),
ScalingAdjustment: -1,
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ecsTarget = new Aws.AppAutoScaling.Target("ecs_target", new()
{
MaxCapacity = 4,
MinCapacity = 1,
ResourceId = "service/clusterName/serviceName",
ScalableDimension = "ecs:service:DesiredCount",
ServiceNamespace = "ecs",
});
var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new()
{
Name = "scale-down",
PolicyType = "StepScaling",
ResourceId = ecsTarget.ResourceId,
ScalableDimension = ecsTarget.ScalableDimension,
ServiceNamespace = ecsTarget.ServiceNamespace,
StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs
{
AdjustmentType = "ChangeInCapacity",
Cooldown = 60,
MetricAggregationType = "Maximum",
StepAdjustments = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs
{
MetricIntervalUpperBound = "0",
ScalingAdjustment = -1,
},
},
},
});
});
Coming soon!
resources:
ecsTarget:
type: aws:appautoscaling:Target
name: ecs_target
properties:
maxCapacity: 4
minCapacity: 1
resourceId: service/clusterName/serviceName
scalableDimension: ecs:service:DesiredCount
serviceNamespace: ecs
ecsPolicy:
type: aws:appautoscaling:Policy
name: ecs_policy
properties:
name: scale-down
policyType: StepScaling
resourceId: ${ecsTarget.resourceId}
scalableDimension: ${ecsTarget.scalableDimension}
serviceNamespace: ${ecsTarget.serviceNamespace}
stepScalingPolicyConfiguration:
adjustmentType: ChangeInCapacity
cooldown: 60
metricAggregationType: Maximum
stepAdjustments:
- metricIntervalUpperBound: 0
scalingAdjustment: -1
Preserve desired count when updating an autoscaled ECS Service
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsService = new aws.ecs.Service("ecs_service", {
name: "serviceName",
cluster: "clusterName",
taskDefinition: "taskDefinitionFamily:1",
desiredCount: 2,
});
import pulumi
import pulumi_aws as aws
ecs_service = aws.ecs.Service("ecs_service",
name="serviceName",
cluster="clusterName",
task_definition="taskDefinitionFamily:1",
desired_count=2)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ecs.NewService(ctx, "ecs_service", &ecs.ServiceArgs{
Name: pulumi.String("serviceName"),
Cluster: pulumi.String("clusterName"),
TaskDefinition: pulumi.String("taskDefinitionFamily:1"),
DesiredCount: pulumi.Int(2),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ecsService = new Aws.Ecs.Service("ecs_service", new()
{
Name = "serviceName",
Cluster = "clusterName",
TaskDefinition = "taskDefinitionFamily:1",
DesiredCount = 2,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ecs.Service;
import com.pulumi.aws.ecs.ServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ecsService = new Service("ecsService", ServiceArgs.builder()
.name("serviceName")
.cluster("clusterName")
.taskDefinition("taskDefinitionFamily:1")
.desiredCount(2)
.build());
}
}
resources:
ecsService:
type: aws:ecs:Service
name: ecs_service
properties:
name: serviceName
cluster: clusterName
taskDefinition: taskDefinitionFamily:1
desiredCount: 2
Aurora Read Replica Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const replicas = new aws.appautoscaling.Target("replicas", {
serviceNamespace: "rds",
scalableDimension: "rds:cluster:ReadReplicaCount",
resourceId: `cluster:${example.id}`,
minCapacity: 1,
maxCapacity: 15,
});
const replicasPolicy = new aws.appautoscaling.Policy("replicas", {
name: "cpu-auto-scaling",
serviceNamespace: replicas.serviceNamespace,
scalableDimension: replicas.scalableDimension,
resourceId: replicas.resourceId,
policyType: "TargetTrackingScaling",
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "RDSReaderAverageCPUUtilization",
},
targetValue: 75,
scaleInCooldown: 300,
scaleOutCooldown: 300,
},
});
import pulumi
import pulumi_aws as aws
replicas = aws.appautoscaling.Target("replicas",
service_namespace="rds",
scalable_dimension="rds:cluster:ReadReplicaCount",
resource_id=f"cluster:{example['id']}",
min_capacity=1,
max_capacity=15)
replicas_policy = aws.appautoscaling.Policy("replicas",
name="cpu-auto-scaling",
service_namespace=replicas.service_namespace,
scalable_dimension=replicas.scalable_dimension,
resource_id=replicas.resource_id,
policy_type="TargetTrackingScaling",
target_tracking_scaling_policy_configuration={
"predefinedMetricSpecification": {
"predefinedMetricType": "RDSReaderAverageCPUUtilization",
},
"targetValue": 75,
"scaleInCooldown": 300,
"scaleOutCooldown": 300,
})
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
replicas, err := appautoscaling.NewTarget(ctx, "replicas", &appautoscaling.TargetArgs{
ServiceNamespace: pulumi.String("rds"),
ScalableDimension: pulumi.String("rds:cluster:ReadReplicaCount"),
ResourceId: pulumi.String(fmt.Sprintf("cluster:%v", example.Id)),
MinCapacity: pulumi.Int(1),
MaxCapacity: pulumi.Int(15),
})
if err != nil {
return err
}
_, err = appautoscaling.NewPolicy(ctx, "replicas", &appautoscaling.PolicyArgs{
Name: pulumi.String("cpu-auto-scaling"),
ServiceNamespace: replicas.ServiceNamespace,
ScalableDimension: replicas.ScalableDimension,
ResourceId: replicas.ResourceId,
PolicyType: pulumi.String("TargetTrackingScaling"),
TargetTrackingScalingPolicyConfiguration: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationArgs{
PredefinedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs{
PredefinedMetricType: pulumi.String("RDSReaderAverageCPUUtilization"),
},
TargetValue: pulumi.Float64(75),
ScaleInCooldown: pulumi.Int(300),
ScaleOutCooldown: pulumi.Int(300),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var replicas = new Aws.AppAutoScaling.Target("replicas", new()
{
ServiceNamespace = "rds",
ScalableDimension = "rds:cluster:ReadReplicaCount",
ResourceId = $"cluster:{example.Id}",
MinCapacity = 1,
MaxCapacity = 15,
});
var replicasPolicy = new Aws.AppAutoScaling.Policy("replicas", new()
{
Name = "cpu-auto-scaling",
ServiceNamespace = replicas.ServiceNamespace,
ScalableDimension = replicas.ScalableDimension,
ResourceId = replicas.ResourceId,
PolicyType = "TargetTrackingScaling",
TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
{
PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
{
PredefinedMetricType = "RDSReaderAverageCPUUtilization",
},
TargetValue = 75,
ScaleInCooldown = 300,
ScaleOutCooldown = 300,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import com.pulumi.aws.appautoscaling.Policy;
import com.pulumi.aws.appautoscaling.PolicyArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var replicas = new Target("replicas", TargetArgs.builder()
.serviceNamespace("rds")
.scalableDimension("rds:cluster:ReadReplicaCount")
.resourceId(String.format("cluster:%s", example.id()))
.minCapacity(1)
.maxCapacity(15)
.build());
var replicasPolicy = new Policy("replicasPolicy", PolicyArgs.builder()
.name("cpu-auto-scaling")
.serviceNamespace(replicas.serviceNamespace())
.scalableDimension(replicas.scalableDimension())
.resourceId(replicas.resourceId())
.policyType("TargetTrackingScaling")
.targetTrackingScalingPolicyConfiguration(PolicyTargetTrackingScalingPolicyConfigurationArgs.builder()
.predefinedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs.builder()
.predefinedMetricType("RDSReaderAverageCPUUtilization")
.build())
.targetValue(75)
.scaleInCooldown(300)
.scaleOutCooldown(300)
.build())
.build());
}
}
resources:
replicas:
type: aws:appautoscaling:Target
properties:
serviceNamespace: rds
scalableDimension: rds:cluster:ReadReplicaCount
resourceId: cluster:${example.id}
minCapacity: 1
maxCapacity: 15
replicasPolicy:
type: aws:appautoscaling:Policy
name: replicas
properties:
name: cpu-auto-scaling
serviceNamespace: ${replicas.serviceNamespace}
scalableDimension: ${replicas.scalableDimension}
resourceId: ${replicas.resourceId}
policyType: TargetTrackingScaling
targetTrackingScalingPolicyConfiguration:
predefinedMetricSpecification:
predefinedMetricType: RDSReaderAverageCPUUtilization
targetValue: 75
scaleInCooldown: 300
scaleOutCooldown: 300
Create target tracking scaling policy using metric math
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecs_target", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const example = new aws.appautoscaling.Policy("example", {
name: "foo",
policyType: "TargetTrackingScaling",
resourceId: ecsTarget.resourceId,
scalableDimension: ecsTarget.scalableDimension,
serviceNamespace: ecsTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
targetValue: 100,
customizedMetricSpecification: {
metrics: [
{
label: "Get the queue size (the number of messages waiting to be processed)",
id: "m1",
metricStat: {
metric: {
metricName: "ApproximateNumberOfMessagesVisible",
namespace: "AWS/SQS",
dimensions: [{
name: "QueueName",
value: "my-queue",
}],
},
stat: "Sum",
},
returnData: false,
},
{
label: "Get the ECS running task count (the number of currently running tasks)",
id: "m2",
metricStat: {
metric: {
metricName: "RunningTaskCount",
namespace: "ECS/ContainerInsights",
dimensions: [
{
name: "ClusterName",
value: "default",
},
{
name: "ServiceName",
value: "web-app",
},
],
},
stat: "Average",
},
returnData: false,
},
{
label: "Calculate the backlog per instance",
id: "e1",
expression: "m1 / m2",
returnData: true,
},
],
},
},
});
import pulumi
import pulumi_aws as aws
ecs_target = aws.appautoscaling.Target("ecs_target",
max_capacity=4,
min_capacity=1,
resource_id="service/clusterName/serviceName",
scalable_dimension="ecs:service:DesiredCount",
service_namespace="ecs")
example = aws.appautoscaling.Policy("example",
name="foo",
policy_type="TargetTrackingScaling",
resource_id=ecs_target.resource_id,
scalable_dimension=ecs_target.scalable_dimension,
service_namespace=ecs_target.service_namespace,
target_tracking_scaling_policy_configuration={
"targetValue": 100,
"customizedMetricSpecification": {
"metrics": [
{
"label": "Get the queue size (the number of messages waiting to be processed)",
"id": "m1",
"metricStat": {
"metric": {
"metricName": "ApproximateNumberOfMessagesVisible",
"namespace": "AWS/SQS",
"dimensions": [{
"name": "QueueName",
"value": "my-queue",
}],
},
"stat": "Sum",
},
"returnData": False,
},
{
"label": "Get the ECS running task count (the number of currently running tasks)",
"id": "m2",
"metricStat": {
"metric": {
"metricName": "RunningTaskCount",
"namespace": "ECS/ContainerInsights",
"dimensions": [
{
"name": "ClusterName",
"value": "default",
},
{
"name": "ServiceName",
"value": "web-app",
},
],
},
"stat": "Average",
},
"returnData": False,
},
{
"label": "Calculate the backlog per instance",
"id": "e1",
"expression": "m1 / m2",
"returnData": True,
},
],
},
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ecsTarget, err := appautoscaling.NewTarget(ctx, "ecs_target", &appautoscaling.TargetArgs{
MaxCapacity: pulumi.Int(4),
MinCapacity: pulumi.Int(1),
ResourceId: pulumi.String("service/clusterName/serviceName"),
ScalableDimension: pulumi.String("ecs:service:DesiredCount"),
ServiceNamespace: pulumi.String("ecs"),
})
if err != nil {
return err
}
_, err = appautoscaling.NewPolicy(ctx, "example", &appautoscaling.PolicyArgs{
Name: pulumi.String("foo"),
PolicyType: pulumi.String("TargetTrackingScaling"),
ResourceId: ecsTarget.ResourceId,
ScalableDimension: ecsTarget.ScalableDimension,
ServiceNamespace: ecsTarget.ServiceNamespace,
TargetTrackingScalingPolicyConfiguration: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationArgs{
TargetValue: pulumi.Float64(100),
CustomizedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs{
Metrics: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs{
Label: pulumi.String("Get the queue size (the number of messages waiting to be processed)"),
Id: pulumi.String("m1"),
MetricStat: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs{
Metric: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs{
MetricName: pulumi.String("ApproximateNumberOfMessagesVisible"),
Namespace: pulumi.String("AWS/SQS"),
Dimensions: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{
Name: pulumi.String("QueueName"),
Value: pulumi.String("my-queue"),
},
},
},
Stat: pulumi.String("Sum"),
},
ReturnData: pulumi.Bool(false),
},
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs{
Label: pulumi.String("Get the ECS running task count (the number of currently running tasks)"),
Id: pulumi.String("m2"),
MetricStat: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs{
Metric: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs{
MetricName: pulumi.String("RunningTaskCount"),
Namespace: pulumi.String("ECS/ContainerInsights"),
Dimensions: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{
Name: pulumi.String("ClusterName"),
Value: pulumi.String("default"),
},
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{
Name: pulumi.String("ServiceName"),
Value: pulumi.String("web-app"),
},
},
},
Stat: pulumi.String("Average"),
},
ReturnData: pulumi.Bool(false),
},
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs{
Label: pulumi.String("Calculate the backlog per instance"),
Id: pulumi.String("e1"),
Expression: pulumi.String("m1 / m2"),
ReturnData: pulumi.Bool(true),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ecsTarget = new Aws.AppAutoScaling.Target("ecs_target", new()
{
MaxCapacity = 4,
MinCapacity = 1,
ResourceId = "service/clusterName/serviceName",
ScalableDimension = "ecs:service:DesiredCount",
ServiceNamespace = "ecs",
});
var example = new Aws.AppAutoScaling.Policy("example", new()
{
Name = "foo",
PolicyType = "TargetTrackingScaling",
ResourceId = ecsTarget.ResourceId,
ScalableDimension = ecsTarget.ScalableDimension,
ServiceNamespace = ecsTarget.ServiceNamespace,
TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
{
TargetValue = 100,
CustomizedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs
{
Metrics = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs
{
Label = "Get the queue size (the number of messages waiting to be processed)",
Id = "m1",
MetricStat = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs
{
Metric = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs
{
MetricName = "ApproximateNumberOfMessagesVisible",
Namespace = "AWS/SQS",
Dimensions = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs
{
Name = "QueueName",
Value = "my-queue",
},
},
},
Stat = "Sum",
},
ReturnData = false,
},
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs
{
Label = "Get the ECS running task count (the number of currently running tasks)",
Id = "m2",
MetricStat = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs
{
Metric = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs
{
MetricName = "RunningTaskCount",
Namespace = "ECS/ContainerInsights",
Dimensions = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs
{
Name = "ClusterName",
Value = "default",
},
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs
{
Name = "ServiceName",
Value = "web-app",
},
},
},
Stat = "Average",
},
ReturnData = false,
},
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs
{
Label = "Calculate the backlog per instance",
Id = "e1",
Expression = "m1 / m2",
ReturnData = true,
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import com.pulumi.aws.appautoscaling.Policy;
import com.pulumi.aws.appautoscaling.PolicyArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ecsTarget = new Target("ecsTarget", TargetArgs.builder()
.maxCapacity(4)
.minCapacity(1)
.resourceId("service/clusterName/serviceName")
.scalableDimension("ecs:service:DesiredCount")
.serviceNamespace("ecs")
.build());
var example = new Policy("example", PolicyArgs.builder()
.name("foo")
.policyType("TargetTrackingScaling")
.resourceId(ecsTarget.resourceId())
.scalableDimension(ecsTarget.scalableDimension())
.serviceNamespace(ecsTarget.serviceNamespace())
.targetTrackingScalingPolicyConfiguration(PolicyTargetTrackingScalingPolicyConfigurationArgs.builder()
.targetValue(100)
.customizedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs.builder()
.metrics(
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs.builder()
.label("Get the queue size (the number of messages waiting to be processed)")
.id("m1")
.metricStat(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs.builder()
.metric(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs.builder()
.metricName("ApproximateNumberOfMessagesVisible")
.namespace("AWS/SQS")
.dimensions(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs.builder()
.name("QueueName")
.value("my-queue")
.build())
.build())
.stat("Sum")
.build())
.returnData(false)
.build(),
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs.builder()
.label("Get the ECS running task count (the number of currently running tasks)")
.id("m2")
.metricStat(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs.builder()
.metric(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs.builder()
.metricName("RunningTaskCount")
.namespace("ECS/ContainerInsights")
.dimensions(
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs.builder()
.name("ClusterName")
.value("default")
.build(),
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs.builder()
.name("ServiceName")
.value("web-app")
.build())
.build())
.stat("Average")
.build())
.returnData(false)
.build(),
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs.builder()
.label("Calculate the backlog per instance")
.id("e1")
.expression("m1 / m2")
.returnData(true)
.build())
.build())
.build())
.build());
}
}
resources:
ecsTarget:
type: aws:appautoscaling:Target
name: ecs_target
properties:
maxCapacity: 4
minCapacity: 1
resourceId: service/clusterName/serviceName
scalableDimension: ecs:service:DesiredCount
serviceNamespace: ecs
example:
type: aws:appautoscaling:Policy
properties:
name: foo
policyType: TargetTrackingScaling
resourceId: ${ecsTarget.resourceId}
scalableDimension: ${ecsTarget.scalableDimension}
serviceNamespace: ${ecsTarget.serviceNamespace}
targetTrackingScalingPolicyConfiguration:
targetValue: 100
customizedMetricSpecification:
metrics:
- label: Get the queue size (the number of messages waiting to be processed)
id: m1
metricStat:
metric:
metricName: ApproximateNumberOfMessagesVisible
namespace: AWS/SQS
dimensions:
- name: QueueName
value: my-queue
stat: Sum
returnData: false
- label: Get the ECS running task count (the number of currently running tasks)
id: m2
metricStat:
metric:
metricName: RunningTaskCount
namespace: ECS/ContainerInsights
dimensions:
- name: ClusterName
value: default
- name: ServiceName
value: web-app
stat: Average
returnData: false
- label: Calculate the backlog per instance
id: e1
expression: m1 / m2
returnData: true
MSK / Kafka Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const mskTarget = new aws.appautoscaling.Target("msk_target", {
serviceNamespace: "kafka",
scalableDimension: "kafka:broker-storage:VolumeSize",
resourceId: example.arn,
minCapacity: 1,
maxCapacity: 8,
});
const targets = new aws.appautoscaling.Policy("targets", {
name: "storage-size-auto-scaling",
serviceNamespace: mskTarget.serviceNamespace,
scalableDimension: mskTarget.scalableDimension,
resourceId: mskTarget.resourceId,
policyType: "TargetTrackingScaling",
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "KafkaBrokerStorageUtilization",
},
targetValue: 55,
},
});
import pulumi
import pulumi_aws as aws
msk_target = aws.appautoscaling.Target("msk_target",
service_namespace="kafka",
scalable_dimension="kafka:broker-storage:VolumeSize",
resource_id=example["arn"],
min_capacity=1,
max_capacity=8)
targets = aws.appautoscaling.Policy("targets",
name="storage-size-auto-scaling",
service_namespace=msk_target.service_namespace,
scalable_dimension=msk_target.scalable_dimension,
resource_id=msk_target.resource_id,
policy_type="TargetTrackingScaling",
target_tracking_scaling_policy_configuration={
"predefinedMetricSpecification": {
"predefinedMetricType": "KafkaBrokerStorageUtilization",
},
"targetValue": 55,
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mskTarget, err := appautoscaling.NewTarget(ctx, "msk_target", &appautoscaling.TargetArgs{
ServiceNamespace: pulumi.String("kafka"),
ScalableDimension: pulumi.String("kafka:broker-storage:VolumeSize"),
ResourceId: pulumi.Any(example.Arn),
MinCapacity: pulumi.Int(1),
MaxCapacity: pulumi.Int(8),
})
if err != nil {
return err
}
_, err = appautoscaling.NewPolicy(ctx, "targets", &appautoscaling.PolicyArgs{
Name: pulumi.String("storage-size-auto-scaling"),
ServiceNamespace: mskTarget.ServiceNamespace,
ScalableDimension: mskTarget.ScalableDimension,
ResourceId: mskTarget.ResourceId,
PolicyType: pulumi.String("TargetTrackingScaling"),
TargetTrackingScalingPolicyConfiguration: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationArgs{
PredefinedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs{
PredefinedMetricType: pulumi.String("KafkaBrokerStorageUtilization"),
},
TargetValue: pulumi.Float64(55),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var mskTarget = new Aws.AppAutoScaling.Target("msk_target", new()
{
ServiceNamespace = "kafka",
ScalableDimension = "kafka:broker-storage:VolumeSize",
ResourceId = example.Arn,
MinCapacity = 1,
MaxCapacity = 8,
});
var targets = new Aws.AppAutoScaling.Policy("targets", new()
{
Name = "storage-size-auto-scaling",
ServiceNamespace = mskTarget.ServiceNamespace,
ScalableDimension = mskTarget.ScalableDimension,
ResourceId = mskTarget.ResourceId,
PolicyType = "TargetTrackingScaling",
TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
{
PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
{
PredefinedMetricType = "KafkaBrokerStorageUtilization",
},
TargetValue = 55,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import com.pulumi.aws.appautoscaling.Policy;
import com.pulumi.aws.appautoscaling.PolicyArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs;
import com.pulumi.aws.appautoscaling.inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mskTarget = new Target("mskTarget", TargetArgs.builder()
.serviceNamespace("kafka")
.scalableDimension("kafka:broker-storage:VolumeSize")
.resourceId(example.arn())
.minCapacity(1)
.maxCapacity(8)
.build());
var targets = new Policy("targets", PolicyArgs.builder()
.name("storage-size-auto-scaling")
.serviceNamespace(mskTarget.serviceNamespace())
.scalableDimension(mskTarget.scalableDimension())
.resourceId(mskTarget.resourceId())
.policyType("TargetTrackingScaling")
.targetTrackingScalingPolicyConfiguration(PolicyTargetTrackingScalingPolicyConfigurationArgs.builder()
.predefinedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs.builder()
.predefinedMetricType("KafkaBrokerStorageUtilization")
.build())
.targetValue(55)
.build())
.build());
}
}
resources:
mskTarget:
type: aws:appautoscaling:Target
name: msk_target
properties:
serviceNamespace: kafka
scalableDimension: kafka:broker-storage:VolumeSize
resourceId: ${example.arn}
minCapacity: 1
maxCapacity: 8
targets:
type: aws:appautoscaling:Policy
properties:
name: storage-size-auto-scaling
serviceNamespace: ${mskTarget.serviceNamespace}
scalableDimension: ${mskTarget.scalableDimension}
resourceId: ${mskTarget.resourceId}
policyType: TargetTrackingScaling
targetTrackingScalingPolicyConfiguration:
predefinedMetricSpecification:
predefinedMetricType: KafkaBrokerStorageUtilization
targetValue: 55
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
@overload
def Policy(resource_name: str,
args: PolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
opts: Optional[ResourceOptions] = None,
resource_id: Optional[str] = None,
scalable_dimension: Optional[str] = None,
service_namespace: Optional[str] = None,
name: Optional[str] = None,
policy_type: Optional[str] = None,
step_scaling_policy_configuration: Optional[PolicyStepScalingPolicyConfigurationArgs] = None,
target_tracking_scaling_policy_configuration: Optional[PolicyTargetTrackingScalingPolicyConfigurationArgs] = None)
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: aws:appautoscaling:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var awsPolicyResource = new Aws.AppAutoScaling.Policy("awsPolicyResource", new()
{
ResourceId = "string",
ScalableDimension = "string",
ServiceNamespace = "string",
Name = "string",
PolicyType = "string",
StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs
{
AdjustmentType = "string",
Cooldown = 0,
MetricAggregationType = "string",
MinAdjustmentMagnitude = 0,
StepAdjustments = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs
{
ScalingAdjustment = 0,
MetricIntervalLowerBound = "string",
MetricIntervalUpperBound = "string",
},
},
},
TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
{
TargetValue = 0,
CustomizedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs
{
Dimensions = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimensionArgs
{
Name = "string",
Value = "string",
},
},
MetricName = "string",
Metrics = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs
{
Id = "string",
Expression = "string",
Label = "string",
MetricStat = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs
{
Metric = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs
{
MetricName = "string",
Namespace = "string",
Dimensions = new[]
{
new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs
{
Name = "string",
Value = "string",
},
},
},
Stat = "string",
Unit = "string",
},
ReturnData = false,
},
},
Namespace = "string",
Statistic = "string",
Unit = "string",
},
DisableScaleIn = false,
PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
{
PredefinedMetricType = "string",
ResourceLabel = "string",
},
ScaleInCooldown = 0,
ScaleOutCooldown = 0,
},
});
example, err := appautoscaling.NewPolicy(ctx, "awsPolicyResource", &appautoscaling.PolicyArgs{
ResourceId: pulumi.String("string"),
ScalableDimension: pulumi.String("string"),
ServiceNamespace: pulumi.String("string"),
Name: pulumi.String("string"),
PolicyType: pulumi.String("string"),
StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{
AdjustmentType: pulumi.String("string"),
Cooldown: pulumi.Int(0),
MetricAggregationType: pulumi.String("string"),
MinAdjustmentMagnitude: pulumi.Int(0),
StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{
&appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{
ScalingAdjustment: pulumi.Int(0),
MetricIntervalLowerBound: pulumi.String("string"),
MetricIntervalUpperBound: pulumi.String("string"),
},
},
},
TargetTrackingScalingPolicyConfiguration: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationArgs{
TargetValue: pulumi.Float64(0),
CustomizedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs{
Dimensions: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimensionArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimensionArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
MetricName: pulumi.String("string"),
Metrics: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs{
Id: pulumi.String("string"),
Expression: pulumi.String("string"),
Label: pulumi.String("string"),
MetricStat: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs{
Metric: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs{
MetricName: pulumi.String("string"),
Namespace: pulumi.String("string"),
Dimensions: appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArray{
&appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
},
Stat: pulumi.String("string"),
Unit: pulumi.String("string"),
},
ReturnData: pulumi.Bool(false),
},
},
Namespace: pulumi.String("string"),
Statistic: pulumi.String("string"),
Unit: pulumi.String("string"),
},
DisableScaleIn: pulumi.Bool(false),
PredefinedMetricSpecification: &appautoscaling.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs{
PredefinedMetricType: pulumi.String("string"),
ResourceLabel: pulumi.String("string"),
},
ScaleInCooldown: pulumi.Int(0),
ScaleOutCooldown: pulumi.Int(0),
},
})
var awsPolicyResource = new Policy("awsPolicyResource", PolicyArgs.builder()
.resourceId("string")
.scalableDimension("string")
.serviceNamespace("string")
.name("string")
.policyType("string")
.stepScalingPolicyConfiguration(PolicyStepScalingPolicyConfigurationArgs.builder()
.adjustmentType("string")
.cooldown(0)
.metricAggregationType("string")
.minAdjustmentMagnitude(0)
.stepAdjustments(PolicyStepScalingPolicyConfigurationStepAdjustmentArgs.builder()
.scalingAdjustment(0)
.metricIntervalLowerBound("string")
.metricIntervalUpperBound("string")
.build())
.build())
.targetTrackingScalingPolicyConfiguration(PolicyTargetTrackingScalingPolicyConfigurationArgs.builder()
.targetValue(0)
.customizedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs.builder()
.dimensions(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimensionArgs.builder()
.name("string")
.value("string")
.build())
.metricName("string")
.metrics(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs.builder()
.id("string")
.expression("string")
.label("string")
.metricStat(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs.builder()
.metric(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs.builder()
.metricName("string")
.namespace("string")
.dimensions(PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs.builder()
.name("string")
.value("string")
.build())
.build())
.stat("string")
.unit("string")
.build())
.returnData(false)
.build())
.namespace("string")
.statistic("string")
.unit("string")
.build())
.disableScaleIn(false)
.predefinedMetricSpecification(PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs.builder()
.predefinedMetricType("string")
.resourceLabel("string")
.build())
.scaleInCooldown(0)
.scaleOutCooldown(0)
.build())
.build());
aws_policy_resource = aws.appautoscaling.Policy("awsPolicyResource",
resource_id="string",
scalable_dimension="string",
service_namespace="string",
name="string",
policy_type="string",
step_scaling_policy_configuration={
"adjustmentType": "string",
"cooldown": 0,
"metricAggregationType": "string",
"minAdjustmentMagnitude": 0,
"stepAdjustments": [{
"scalingAdjustment": 0,
"metricIntervalLowerBound": "string",
"metricIntervalUpperBound": "string",
}],
},
target_tracking_scaling_policy_configuration={
"targetValue": 0,
"customizedMetricSpecification": {
"dimensions": [{
"name": "string",
"value": "string",
}],
"metricName": "string",
"metrics": [{
"id": "string",
"expression": "string",
"label": "string",
"metricStat": {
"metric": {
"metricName": "string",
"namespace": "string",
"dimensions": [{
"name": "string",
"value": "string",
}],
},
"stat": "string",
"unit": "string",
},
"returnData": False,
}],
"namespace": "string",
"statistic": "string",
"unit": "string",
},
"disableScaleIn": False,
"predefinedMetricSpecification": {
"predefinedMetricType": "string",
"resourceLabel": "string",
},
"scaleInCooldown": 0,
"scaleOutCooldown": 0,
})
const awsPolicyResource = new aws.appautoscaling.Policy("awsPolicyResource", {
resourceId: "string",
scalableDimension: "string",
serviceNamespace: "string",
name: "string",
policyType: "string",
stepScalingPolicyConfiguration: {
adjustmentType: "string",
cooldown: 0,
metricAggregationType: "string",
minAdjustmentMagnitude: 0,
stepAdjustments: [{
scalingAdjustment: 0,
metricIntervalLowerBound: "string",
metricIntervalUpperBound: "string",
}],
},
targetTrackingScalingPolicyConfiguration: {
targetValue: 0,
customizedMetricSpecification: {
dimensions: [{
name: "string",
value: "string",
}],
metricName: "string",
metrics: [{
id: "string",
expression: "string",
label: "string",
metricStat: {
metric: {
metricName: "string",
namespace: "string",
dimensions: [{
name: "string",
value: "string",
}],
},
stat: "string",
unit: "string",
},
returnData: false,
}],
namespace: "string",
statistic: "string",
unit: "string",
},
disableScaleIn: false,
predefinedMetricSpecification: {
predefinedMetricType: "string",
resourceLabel: "string",
},
scaleInCooldown: 0,
scaleOutCooldown: 0,
},
});
type: aws:appautoscaling:Policy
properties:
name: string
policyType: string
resourceId: string
scalableDimension: string
serviceNamespace: string
stepScalingPolicyConfiguration:
adjustmentType: string
cooldown: 0
metricAggregationType: string
minAdjustmentMagnitude: 0
stepAdjustments:
- metricIntervalLowerBound: string
metricIntervalUpperBound: string
scalingAdjustment: 0
targetTrackingScalingPolicyConfiguration:
customizedMetricSpecification:
dimensions:
- name: string
value: string
metricName: string
metrics:
- expression: string
id: string
label: string
metricStat:
metric:
dimensions:
- name: string
value: string
metricName: string
namespace: string
stat: string
unit: string
returnData: false
namespace: string
statistic: string
unit: string
disableScaleIn: false
predefinedMetricSpecification:
predefinedMetricType: string
resourceLabel: string
scaleInCooldown: 0
scaleOutCooldown: 0
targetValue: 0
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Policy resource accepts the following input properties:
- Resource
Id string - 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 - Scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - Service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - Name string
- Name of the policy. Must be between 1 and 255 characters in length.
- Policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - Step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - Target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- Resource
Id string - 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 - Scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - Service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - Name string
- Name of the policy. Must be between 1 and 255 characters in length.
- Policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - Step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration Args - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - Target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration Args - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- resource
Id String - 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 - scalable
Dimension String - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace String - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - name String
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type String - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- resource
Id string - 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 - scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - name string
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- resource_
id str - 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 - scalable_
dimension str - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service_
namespace str - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - name str
- Name of the policy. Must be between 1 and 255 characters in length.
- policy_
type str - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - step_
scaling_ Policypolicy_ configuration Step Scaling Policy Configuration Args - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target_
tracking_ Policyscaling_ policy_ configuration Target Tracking Scaling Policy Configuration Args - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- resource
Id String - 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 - scalable
Dimension String - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace String - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - name String
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type String - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - step
Scaling Property MapPolicy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking Property MapScaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
- alarm_
arns Sequence[str] - List of CloudWatch alarm ARNs associated with the scaling policy.
- arn str
- ARN assigned by AWS to the scaling policy.
- id str
- The provider-assigned unique ID for this managed resource.
Look up Existing Policy Resource
Get an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PolicyState, opts?: CustomResourceOptions): Policy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
alarm_arns: Optional[Sequence[str]] = None,
arn: Optional[str] = None,
name: Optional[str] = None,
policy_type: Optional[str] = None,
resource_id: Optional[str] = None,
scalable_dimension: Optional[str] = None,
service_namespace: Optional[str] = None,
step_scaling_policy_configuration: Optional[PolicyStepScalingPolicyConfigurationArgs] = None,
target_tracking_scaling_policy_configuration: Optional[PolicyTargetTrackingScalingPolicyConfigurationArgs] = None) -> Policy
func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Alarm
Arns List<string> - List of CloudWatch alarm ARNs associated with the scaling policy.
- Arn string
- ARN assigned by AWS to the scaling policy.
- Name string
- Name of the policy. Must be between 1 and 255 characters in length.
- Policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - Resource
Id string - 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 - Scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - Service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - Step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - Target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- Alarm
Arns []string - List of CloudWatch alarm ARNs associated with the scaling policy.
- Arn string
- ARN assigned by AWS to the scaling policy.
- Name string
- Name of the policy. Must be between 1 and 255 characters in length.
- Policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - Resource
Id string - 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 - Scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - Service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - Step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration Args - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - Target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration Args - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- alarm
Arns List<String> - List of CloudWatch alarm ARNs associated with the scaling policy.
- arn String
- ARN assigned by AWS to the scaling policy.
- name String
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type String - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - resource
Id String - 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 - scalable
Dimension String - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace String - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- alarm
Arns string[] - List of CloudWatch alarm ARNs associated with the scaling policy.
- arn string
- ARN assigned by AWS to the scaling policy.
- name string
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type string - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - resource
Id string - 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 - scalable
Dimension string - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace string - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - step
Scaling PolicyPolicy Configuration Step Scaling Policy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking PolicyScaling Policy Configuration Target Tracking Scaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- alarm_
arns Sequence[str] - List of CloudWatch alarm ARNs associated with the scaling policy.
- arn str
- ARN assigned by AWS to the scaling policy.
- name str
- Name of the policy. Must be between 1 and 255 characters in length.
- policy_
type str - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - resource_
id str - 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 - scalable_
dimension str - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service_
namespace str - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - step_
scaling_ Policypolicy_ configuration Step Scaling Policy Configuration Args - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target_
tracking_ Policyscaling_ policy_ configuration Target Tracking Scaling Policy Configuration Args - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
- alarm
Arns List<String> - List of CloudWatch alarm ARNs associated with the scaling policy.
- arn String
- ARN assigned by AWS to the scaling policy.
- name String
- Name of the policy. Must be between 1 and 255 characters in length.
- policy
Type String - Policy type. Valid values are
StepScaling
andTargetTrackingScaling
. Defaults toStepScaling
. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation. - resource
Id String - 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 - scalable
Dimension String - Scalable dimension of the scalable target. Documentation can be found in the
ScalableDimension
parameter at: AWS Application Auto Scaling API Reference - service
Namespace String - AWS service namespace of the scalable target. Documentation can be found in the
ServiceNamespace
parameter at: AWS Application Auto Scaling API Reference - step
Scaling Property MapPolicy Configuration - Step scaling policy configuration, requires
policy_type = "StepScaling"
(default). See supported fields below. - target
Tracking Property MapScaling Policy Configuration - Target tracking policy, requires
policy_type = "TargetTrackingScaling"
. See supported fields below.
Supporting Types
PolicyStepScalingPolicyConfiguration, PolicyStepScalingPolicyConfigurationArgs
- Adjustment
Type string - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - Cooldown int
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- Metric
Aggregation stringType - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- Min
Adjustment intMagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- Step
Adjustments List<PolicyStep Scaling Policy Configuration Step Adjustment> - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
- Adjustment
Type string - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - Cooldown int
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- Metric
Aggregation stringType - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- Min
Adjustment intMagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- Step
Adjustments []PolicyStep Scaling Policy Configuration Step Adjustment - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
- adjustment
Type String - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - cooldown Integer
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- metric
Aggregation StringType - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- min
Adjustment IntegerMagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- step
Adjustments List<PolicyStep Scaling Policy Configuration Step Adjustment> - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
- adjustment
Type string - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - cooldown number
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- metric
Aggregation stringType - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- min
Adjustment numberMagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- step
Adjustments PolicyStep Scaling Policy Configuration Step Adjustment[] - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
- adjustment_
type str - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - cooldown int
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- metric_
aggregation_ strtype - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- min_
adjustment_ intmagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- step_
adjustments Sequence[PolicyStep Scaling Policy Configuration Step Adjustment] - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
- adjustment
Type String - Whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. - cooldown Number
- Amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
- metric
Aggregation StringType - Aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
- min
Adjustment NumberMagnitude - Minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount.
- step
Adjustments List<Property Map> - Set of adjustments that manage scaling. These have the following structure:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws";
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {stepScalingPolicyConfiguration: { stepAdjustments: [ { metricIntervalLowerBound: "1", metricIntervalUpperBound: "2", scalingAdjustment: -1, }, { metricIntervalLowerBound: "2", metricIntervalUpperBound: "3", scalingAdjustment: 1, }, ], }});
import pulumi import pulumi_aws as aws ecs_policy = aws.appautoscaling.Policy("ecs_policy", step_scaling_policy_configuration={ "stepAdjustments": [ { "metricIntervalLowerBound": "1", "metricIntervalUpperBound": "2", "scalingAdjustment": -1, }, { "metricIntervalLowerBound": "2", "metricIntervalUpperBound": "3", "scalingAdjustment": 1, }, ], })
using System.Collections.Generic; using System.Linq; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var ecsPolicy = new Aws.AppAutoScaling.Policy("ecs_policy", new() { StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs { StepAdjustments = new[] { new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "1", MetricIntervalUpperBound = "2", ScalingAdjustment = -1, }, new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs { MetricIntervalLowerBound = "2", MetricIntervalUpperBound = "3", ScalingAdjustment = 1, }, }, }, }); });
package main import ( "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appautoscaling" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := appautoscaling.NewPolicy(ctx, "ecs_policy", &appautoscaling.PolicyArgs{ StepScalingPolicyConfiguration: &appautoscaling.PolicyStepScalingPolicyConfigurationArgs{ StepAdjustments: appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArray{ &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("1"), MetricIntervalUpperBound: pulumi.String("2"), ScalingAdjustment: -1, }, &appautoscaling.PolicyStepScalingPolicyConfigurationStepAdjustmentArgs{ MetricIntervalLowerBound: pulumi.String("2"), MetricIntervalUpperBound: pulumi.String("3"), ScalingAdjustment: pulumi.Int(1), }, }, }, }) if err != nil { return err } return nil }) }
resources: ecsPolicy: type: aws:appautoscaling:Policy name: ecs_policy properties: stepScalingPolicyConfiguration: stepAdjustments: - metricIntervalLowerBound: 1 metricIntervalUpperBound: 2 scalingAdjustment: -1 - metricIntervalLowerBound: 2 metricIntervalUpperBound: 3 scalingAdjustment: 1
PolicyStepScalingPolicyConfigurationStepAdjustment, PolicyStepScalingPolicyConfigurationStepAdjustmentArgs
- Scaling
Adjustment int - Metric
Interval stringLower Bound - Metric
Interval stringUpper Bound
- Scaling
Adjustment int - Metric
Interval stringLower Bound - Metric
Interval stringUpper Bound
- scaling
Adjustment Integer - metric
Interval StringLower Bound - metric
Interval StringUpper Bound
- scaling
Adjustment number - metric
Interval stringLower Bound - metric
Interval stringUpper Bound
- scaling
Adjustment Number - metric
Interval StringLower Bound - metric
Interval StringUpper Bound
PolicyTargetTrackingScalingPolicyConfiguration, PolicyTargetTrackingScalingPolicyConfigurationArgs
- Target
Value double - Target value for the metric.
- Customized
Metric PolicySpecification Target Tracking Scaling Policy Configuration Customized Metric Specification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- Disable
Scale boolIn - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - Predefined
Metric PolicySpecification Target Tracking Scaling Policy Configuration Predefined Metric Specification - Predefined metric. See supported fields below.
- Scale
In intCooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- Scale
Out intCooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
- Target
Value float64 - Target value for the metric.
- Customized
Metric PolicySpecification Target Tracking Scaling Policy Configuration Customized Metric Specification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- Disable
Scale boolIn - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - Predefined
Metric PolicySpecification Target Tracking Scaling Policy Configuration Predefined Metric Specification - Predefined metric. See supported fields below.
- Scale
In intCooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- Scale
Out intCooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
- target
Value Double - Target value for the metric.
- customized
Metric PolicySpecification Target Tracking Scaling Policy Configuration Customized Metric Specification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- disable
Scale BooleanIn - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - predefined
Metric PolicySpecification Target Tracking Scaling Policy Configuration Predefined Metric Specification - Predefined metric. See supported fields below.
- scale
In IntegerCooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- scale
Out IntegerCooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
- target
Value number - Target value for the metric.
- customized
Metric PolicySpecification Target Tracking Scaling Policy Configuration Customized Metric Specification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- disable
Scale booleanIn - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - predefined
Metric PolicySpecification Target Tracking Scaling Policy Configuration Predefined Metric Specification - Predefined metric. See supported fields below.
- scale
In numberCooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- scale
Out numberCooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
- target_
value float - Target value for the metric.
- customized_
metric_ Policyspecification Target Tracking Scaling Policy Configuration Customized Metric Specification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- disable_
scale_ boolin - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - predefined_
metric_ Policyspecification Target Tracking Scaling Policy Configuration Predefined Metric Specification - Predefined metric. See supported fields below.
- scale_
in_ intcooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- scale_
out_ intcooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
- target
Value Number - Target value for the metric.
- customized
Metric Property MapSpecification - Custom CloudWatch metric. Documentation can be found at: AWS Customized Metric Specification. See supported fields below.
- disable
Scale BooleanIn - Whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. The default value is
false
. - predefined
Metric Property MapSpecification - Predefined metric. See supported fields below.
- scale
In NumberCooldown - Amount of time, in seconds, after a scale in activity completes before another scale in activity can start.
- scale
Out NumberCooldown - Amount of time, in seconds, after a scale out activity completes before another scale out activity can start.
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecification, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationArgs
- Dimensions
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Dimension> - Dimensions of the metric.
- Metric
Name string - Name of the metric.
- Metrics
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric> - Metrics to include, as a metric data query.
- Namespace string
- Namespace of the metric.
- Statistic string
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - Unit string
- Unit of the metrics to return.
- Dimensions
[]Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Dimension - Dimensions of the metric.
- Metric
Name string - Name of the metric.
- Metrics
[]Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric - Metrics to include, as a metric data query.
- Namespace string
- Namespace of the metric.
- Statistic string
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - Unit string
- Unit of the metrics to return.
- dimensions
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Dimension> - Dimensions of the metric.
- metric
Name String - Name of the metric.
- metrics
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric> - Metrics to include, as a metric data query.
- namespace String
- Namespace of the metric.
- statistic String
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - unit String
- Unit of the metrics to return.
- dimensions
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Dimension[] - Dimensions of the metric.
- metric
Name string - Name of the metric.
- metrics
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric[] - Metrics to include, as a metric data query.
- namespace string
- Namespace of the metric.
- statistic string
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - unit string
- Unit of the metrics to return.
- dimensions
Sequence[Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Dimension] - Dimensions of the metric.
- metric_
name str - Name of the metric.
- metrics
Sequence[Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric] - Metrics to include, as a metric data query.
- namespace str
- Namespace of the metric.
- statistic str
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - unit str
- Unit of the metrics to return.
- dimensions List<Property Map>
- Dimensions of the metric.
- metric
Name String - Name of the metric.
- metrics List<Property Map>
- Metrics to include, as a metric data query.
- namespace String
- Namespace of the metric.
- statistic String
- Statistic of the metric. Valid values:
Average
,Minimum
,Maximum
,SampleCount
, andSum
. - unit String
- Unit of the metrics to return.
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimension, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationDimensionArgs
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetric, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricArgs
- Id string
- Short name for the metric used in target tracking scaling policy.
- Expression string
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - Label string
- Human-readable label for this metric or expression.
- Metric
Stat PolicyTarget Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - Return
Data bool - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
- Id string
- Short name for the metric used in target tracking scaling policy.
- Expression string
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - Label string
- Human-readable label for this metric or expression.
- Metric
Stat PolicyTarget Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - Return
Data bool - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
- id String
- Short name for the metric used in target tracking scaling policy.
- expression String
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - label String
- Human-readable label for this metric or expression.
- metric
Stat PolicyTarget Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - return
Data Boolean - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
- id string
- Short name for the metric used in target tracking scaling policy.
- expression string
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - label string
- Human-readable label for this metric or expression.
- metric
Stat PolicyTarget Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - return
Data boolean - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
- id str
- Short name for the metric used in target tracking scaling policy.
- expression str
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - label str
- Human-readable label for this metric or expression.
- metric_
stat PolicyTarget Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - return_
data bool - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
- id String
- Short name for the metric used in target tracking scaling policy.
- expression String
- Math expression used on the returned metric. You must specify either
expression
ormetric_stat
, but not both. - label String
- Human-readable label for this metric or expression.
- metric
Stat Property Map - Structure that defines CloudWatch metric to be used in target tracking scaling policy. You must specify either
expression
ormetric_stat
, but not both. - return
Data Boolean - Boolean that indicates whether to return the timestamps and raw data values of this metric, the default is true
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStat, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatArgs
- Metric
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric - Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- Stat string
- Statistic of the metrics to return.
- Unit string
- Unit of the metrics to return.
- Metric
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric - Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- Stat string
- Statistic of the metrics to return.
- Unit string
- Unit of the metrics to return.
- metric
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric - Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- stat String
- Statistic of the metrics to return.
- unit String
- Unit of the metrics to return.
- metric
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric - Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- stat string
- Statistic of the metrics to return.
- unit string
- Unit of the metrics to return.
- metric
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric - Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- stat str
- Statistic of the metrics to return.
- unit str
- Unit of the metrics to return.
- metric Property Map
- Structure that defines the CloudWatch metric to return, including the metric name, namespace, and dimensions.
- stat String
- Statistic of the metrics to return.
- unit String
- Unit of the metrics to return.
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetric, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricArgs
- Metric
Name string - Name of the metric.
- Namespace string
- Namespace of the metric.
- Dimensions
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric Dimension> - Dimensions of the metric.
- Metric
Name string - Name of the metric.
- Namespace string
- Namespace of the metric.
- Dimensions
[]Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric Dimension - Dimensions of the metric.
- metric
Name String - Name of the metric.
- namespace String
- Namespace of the metric.
- dimensions
List<Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric Dimension> - Dimensions of the metric.
- metric
Name string - Name of the metric.
- namespace string
- Namespace of the metric.
- dimensions
Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric Dimension[] - Dimensions of the metric.
- metric_
name str - Name of the metric.
- namespace str
- Namespace of the metric.
- dimensions
Sequence[Policy
Target Tracking Scaling Policy Configuration Customized Metric Specification Metric Metric Stat Metric Dimension] - Dimensions of the metric.
- metric
Name String - Name of the metric.
- namespace String
- Namespace of the metric.
- dimensions List<Property Map>
- Dimensions of the metric.
PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimension, PolicyTargetTrackingScalingPolicyConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArgs
PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecification, PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
- Predefined
Metric stringType - Metric type.
- Resource
Label string - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
- Predefined
Metric stringType - Metric type.
- Resource
Label string - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
- predefined
Metric StringType - Metric type.
- resource
Label String - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
- predefined
Metric stringType - Metric type.
- resource
Label string - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
- predefined_
metric_ strtype - Metric type.
- resource_
label str - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
- predefined
Metric StringType - Metric type.
- resource
Label String - Reserved for future use if the
predefined_metric_type
is notALBRequestCountPerTarget
. If thepredefined_metric_type
isALBRequestCountPerTarget
, you must specify this argument. Documentation can be found at: AWS Predefined Scaling Metric Specification. Must be less than or equal to 1023 characters in length.
Import
Using pulumi import
, import Application AutoScaling Policy using the service-namespace
, resource-id
, scalable-dimension
and policy-name
separated by /
. For example:
$ pulumi import aws:appautoscaling/policy:Policy test-policy service-namespace/resource-id/scalable-dimension/policy-name
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.