Ejemplo n.º 1
0
 public MyStack()
 {
     var ecsTarget = new Aws.AppAutoScaling.Target("ecsTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 4,
         MinCapacity       = 1,
         ResourceId        = "service/clusterName/serviceName",
         ScalableDimension = "ecs:service:DesiredCount",
         ServiceNamespace  = "ecs",
     });
     var ecsPolicy = new Aws.AppAutoScaling.Policy("ecsPolicy", new Aws.AppAutoScaling.PolicyArgs
     {
         PolicyType        = "StepScaling",
         ResourceId        = ecsTarget.ResourceId,
         ScalableDimension = ecsTarget.ScalableDimension,
         ServiceNamespace  = ecsTarget.ServiceNamespace,
         StepScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyStepScalingPolicyConfigurationArgs
         {
             AdjustmentType        = "ChangeInCapacity",
             Cooldown              = 60,
             MetricAggregationType = "Maximum",
             StepAdjustment        =
             {
                 {
                     { "metricIntervalUpperBound",  0 },
Ejemplo n.º 2
0
 public MyStack()
 {
     var replicasTarget = new Aws.AppAutoScaling.Target("replicasTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 15,
         MinCapacity       = 1,
         ResourceId        = $"cluster:{aws_rds_cluster.Example.Id}",
         ScalableDimension = "rds:cluster:ReadReplicaCount",
         ServiceNamespace  = "rds",
     });
     var replicasPolicy = new Aws.AppAutoScaling.Policy("replicasPolicy", new Aws.AppAutoScaling.PolicyArgs
     {
         PolicyType        = "TargetTrackingScaling",
         ResourceId        = replicasTarget.ResourceId,
         ScalableDimension = replicasTarget.ScalableDimension,
         ServiceNamespace  = replicasTarget.ServiceNamespace,
         TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
         {
             PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
             {
                 PredefinedMetricType = "RDSReaderAverageCPUUtilization",
             },
             ScaleInCooldown  = 300,
             ScaleOutCooldown = 300,
             TargetValue      = 75,
         },
     });
 }
Ejemplo n.º 3
0
 public MyStack()
 {
     var dynamodbTableReadTarget = new Aws.AppAutoScaling.Target("dynamodbTableReadTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 100,
         MinCapacity       = 5,
         ResourceId        = "table/tableName",
         ScalableDimension = "dynamodb:table:ReadCapacityUnits",
         ServiceNamespace  = "dynamodb",
     });
     var dynamodbTableReadPolicy = new Aws.AppAutoScaling.Policy("dynamodbTableReadPolicy", new Aws.AppAutoScaling.PolicyArgs
     {
         PolicyType        = "TargetTrackingScaling",
         ResourceId        = dynamodbTableReadTarget.ResourceId,
         ScalableDimension = dynamodbTableReadTarget.ScalableDimension,
         ServiceNamespace  = dynamodbTableReadTarget.ServiceNamespace,
         TargetTrackingScalingPolicyConfiguration = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationArgs
         {
             PredefinedMetricSpecification = new Aws.AppAutoScaling.Inputs.PolicyTargetTrackingScalingPolicyConfigurationPredefinedMetricSpecificationArgs
             {
                 PredefinedMetricType = "DynamoDBReadCapacityUtilization",
             },
             TargetValue = 70,
         },
     });
 }
Ejemplo n.º 4
0
 public MyStack()
 {
     var dynamodbTableReadTarget = new Aws.AppAutoScaling.Target("dynamodbTableReadTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 100,
         MinCapacity       = 5,
         ResourceId        = $"table/{aws_dynamodb_table.Example.Name}",
         ScalableDimension = "dynamodb:table:ReadCapacityUnits",
         ServiceNamespace  = "dynamodb",
     });
 }
Ejemplo n.º 5
0
 public MyStack()
 {
     var ecsTarget = new Aws.AppAutoScaling.Target("ecsTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 4,
         MinCapacity       = 1,
         ResourceId        = $"service/{aws_ecs_cluster.Example.Name}/{aws_ecs_service.Example.Name}",
         ScalableDimension = "ecs:service:DesiredCount",
         ServiceNamespace  = "ecs",
     });
 }
Ejemplo n.º 6
0
 public MyStack()
 {
     var replicas = new Aws.AppAutoScaling.Target("replicas", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 15,
         MinCapacity       = 1,
         ResourceId        = $"cluster:{aws_rds_cluster.Example.Id}",
         ScalableDimension = "rds:cluster:ReadReplicaCount",
         ServiceNamespace  = "rds",
     });
 }
Ejemplo n.º 7
0
 public MyStack()
 {
     var ecsTarget = new Aws.AppAutoScaling.Target("ecsTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 4,
         MinCapacity       = 1,
         ResourceId        = "service/clusterName/serviceName",
         ScalableDimension = "ecs:service:DesiredCount",
         ServiceNamespace  = "ecs",
     });
     var ecsScheduledAction = new Aws.AppAutoScaling.ScheduledAction("ecsScheduledAction", new Aws.AppAutoScaling.ScheduledActionArgs
     {
         ResourceId           = ecsTarget.ResourceId,
         ScalableDimension    = ecsTarget.ScalableDimension,
         ScalableTargetAction = new Aws.AppAutoScaling.Inputs.ScheduledActionScalableTargetActionArgs
         {
             MaxCapacity = 10,
             MinCapacity = 1,
         },
         Schedule         = "at(2006-01-02T15:04:05)",
         ServiceNamespace = ecsTarget.ServiceNamespace,
     });
 }
Ejemplo n.º 8
0
 public MyStack()
 {
     var dynamodbTarget = new Aws.AppAutoScaling.Target("dynamodbTarget", new Aws.AppAutoScaling.TargetArgs
     {
         MaxCapacity       = 100,
         MinCapacity       = 5,
         ResourceId        = "table/tableName",
         ScalableDimension = "dynamodb:table:ReadCapacityUnits",
         ServiceNamespace  = "dynamodb",
     });
     var dynamodbScheduledAction = new Aws.AppAutoScaling.ScheduledAction("dynamodbScheduledAction", new Aws.AppAutoScaling.ScheduledActionArgs
     {
         ResourceId           = dynamodbTarget.ResourceId,
         ScalableDimension    = dynamodbTarget.ScalableDimension,
         ScalableTargetAction = new Aws.AppAutoScaling.Inputs.ScheduledActionScalableTargetActionArgs
         {
             MaxCapacity = 200,
             MinCapacity = 1,
         },
         Schedule         = "at(2006-01-02T15:04:05)",
         ServiceNamespace = dynamodbTarget.ServiceNamespace,
     });
 }