Class: AWSCDK::ECS::CfnExpressGatewayService::ExpressGatewayScalingTargetProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/cfn_express_gateway_service.rb

Overview

Defines the auto-scaling configuration for an Express service.

This determines how the service automatically adjusts the number of running tasks based on demand metrics such as CPU utilization, memory utilization, or request count per target.

Auto-scaling helps ensure your application can handle varying levels of traffic while optimizing costs by scaling down during low-demand periods. You can specify the minimum and maximum number of tasks, the scaling metric, and the target value for that metric.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auto_scaling_metric: nil, auto_scaling_target_value: nil, max_task_count: nil, min_task_count: nil) ⇒ ExpressGatewayScalingTargetProperty

Returns a new instance of ExpressGatewayScalingTargetProperty.

Parameters:

  • auto_scaling_metric (String, nil) (defaults to: nil)

    The metric used for auto-scaling decisions.

  • auto_scaling_target_value (Numeric, nil) (defaults to: nil)

    The target value for the auto-scaling metric.

  • max_task_count (Numeric, nil) (defaults to: nil)

    The maximum number of tasks to run in the Express service.

  • min_task_count (Numeric, nil) (defaults to: nil)

    The minimum number of tasks to run in the Express service.



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
# File 'ecs/cfn_express_gateway_service.rb', line 1058

def initialize(auto_scaling_metric: nil, auto_scaling_target_value: nil, max_task_count: nil, min_task_count: nil)
  @auto_scaling_metric = auto_scaling_metric
  Jsii::Type.check_type(@auto_scaling_metric, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "autoScalingMetric") unless @auto_scaling_metric.nil?
  @auto_scaling_target_value = auto_scaling_target_value
  Jsii::Type.check_type(@auto_scaling_target_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "autoScalingTargetValue") unless @auto_scaling_target_value.nil?
  @max_task_count = max_task_count
  Jsii::Type.check_type(@max_task_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxTaskCount") unless @max_task_count.nil?
  @min_task_count = min_task_count
  Jsii::Type.check_type(@min_task_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minTaskCount") unless @min_task_count.nil?
end

Instance Attribute Details

#auto_scaling_metricString? (readonly)

Note:

Default: - "AVERAGE_CPU"

The metric used for auto-scaling decisions.

The default metric used for an Express service is CPUUtilization .



1076
1077
1078
# File 'ecs/cfn_express_gateway_service.rb', line 1076

def auto_scaling_metric
  @auto_scaling_metric
end

#auto_scaling_target_valueNumeric? (readonly)

Note:

Default: - 60

The target value for the auto-scaling metric.

The default value for an Express service is 60.



1084
1085
1086
# File 'ecs/cfn_express_gateway_service.rb', line 1084

def auto_scaling_target_value
  @auto_scaling_target_value
end

#max_task_countNumeric? (readonly)

Note:

Default: - 1

The maximum number of tasks to run in the Express service.



1090
1091
1092
# File 'ecs/cfn_express_gateway_service.rb', line 1090

def max_task_count
  @max_task_count
end

#min_task_countNumeric? (readonly)

Note:

Default: - 1

The minimum number of tasks to run in the Express service.



1096
1097
1098
# File 'ecs/cfn_express_gateway_service.rb', line 1096

def min_task_count
  @min_task_count
end

Class Method Details

.jsii_propertiesObject



1098
1099
1100
1101
1102
1103
1104
1105
# File 'ecs/cfn_express_gateway_service.rb', line 1098

def self.jsii_properties
  {
    :auto_scaling_metric => "autoScalingMetric",
    :auto_scaling_target_value => "autoScalingTargetValue",
    :max_task_count => "maxTaskCount",
    :min_task_count => "minTaskCount",
  }
end

Instance Method Details

#to_jsiiObject



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
# File 'ecs/cfn_express_gateway_service.rb', line 1107

def to_jsii
  result = {}
  result.merge!({
    "autoScalingMetric" => @auto_scaling_metric,
    "autoScalingTargetValue" => @auto_scaling_target_value,
    "maxTaskCount" => @max_task_count,
    "minTaskCount" => @min_task_count,
  })
  result.compact
end