Class: AWSCDK::ECSPatterns::QueueProcessingEC2ServiceProps

Inherits:
QueueProcessingServiceBaseProps
  • Object
show all
Defined in:
ecs_patterns/queue_processing_ec2_service_props.rb

Overview

The properties for the QueueProcessingEc2Service service.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(capacity_provider_strategies: nil, circuit_breaker: nil, cluster: nil, command: nil, cooldown: nil, cpu_target_utilization_percent: nil, deployment_controller: nil, disable_cpu_based_scaling: nil, enable_ecs_managed_tags: nil, enable_execute_command: nil, enable_logging: nil, environment: nil, family: nil, image: nil, log_driver: nil, max_healthy_percent: nil, max_receive_count: nil, max_scaling_capacity: nil, min_healthy_percent: nil, min_scaling_capacity: nil, propagate_tags: nil, queue: nil, retention_period: nil, scaling_steps: nil, secrets: nil, service_name: nil, visibility_timeout: nil, vpc: nil, container_name: nil, cpu: nil, gpu_count: nil, memory_limit_mib: nil, memory_reservation_mib: nil, placement_constraints: nil, placement_strategies: nil) ⇒ QueueProcessingEC2ServiceProps

Returns a new instance of QueueProcessingEC2ServiceProps.

Parameters:

  • capacity_provider_strategies (Array<AWSCDK::ECS::CapacityProviderStrategy>, nil) (defaults to: nil)

    A list of Capacity Provider strategies used to place a service.

  • circuit_breaker (AWSCDK::ECS::DeploymentCircuitBreaker, nil) (defaults to: nil)

    Whether to enable the deployment circuit breaker.

  • cluster (AWSCDK::ECS::ICluster, nil) (defaults to: nil)

    The name of the cluster that hosts the service.

  • command (Array<String>, nil) (defaults to: nil)

    The command that is passed to the container.

  • cooldown (AWSCDK::Duration, nil) (defaults to: nil)

    Grace period after scaling activity in seconds.

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

    The target CPU utilization percentage for CPU based scaling strategy when enabled.

  • deployment_controller (AWSCDK::ECS::DeploymentController, nil) (defaults to: nil)

    Specifies which deployment controller to use for the service.

  • disable_cpu_based_scaling (Boolean, nil) (defaults to: nil)

    Flag to disable CPU based auto scaling strategy on the service.

  • enable_ecs_managed_tags (Boolean, nil) (defaults to: nil)

    Specifies whether to enable Amazon ECS managed tags for the tasks within the service.

  • enable_execute_command (Boolean, nil) (defaults to: nil)

    Whether ECS Exec should be enabled.

  • enable_logging (Boolean, nil) (defaults to: nil)

    Flag to indicate whether to enable logging.

  • environment (Hash{String => String}, nil) (defaults to: nil)

    The environment variables to pass to the container.

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

    The name of a family that the task definition is registered to.

  • image (AWSCDK::ECS::ContainerImage, nil) (defaults to: nil)

    The image used to start a container.

  • log_driver (AWSCDK::ECS::LogDriver, nil) (defaults to: nil)

    The log driver to use.

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

    The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment.

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

    The maximum number of times that a message can be received by consumers.

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

    Maximum capacity to scale to.

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

    The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment.

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

    Minimum capacity to scale to.

  • propagate_tags (AWSCDK::ECS::PropagatedTagSource, nil) (defaults to: nil)

    Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

  • queue (AWSCDK::SQS::IQueue, nil) (defaults to: nil)

    A queue for which to process items from.

  • retention_period (AWSCDK::Duration, nil) (defaults to: nil)

    The number of seconds that Dead Letter Queue retains a message.

  • scaling_steps (Array<AWSCDK::ApplicationAutoScaling::ScalingInterval>, nil) (defaults to: nil)

    The intervals for scaling based on the SQS queue's ApproximateNumberOfMessagesVisible metric.

  • secrets (Hash{String => AWSCDK::ECS::Secret}, nil) (defaults to: nil)

    The secret to expose to the container as an environment variable.

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

    The name of the service.

  • visibility_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    Timeout of processing a single message.

  • vpc (AWSCDK::EC2::IVPC, nil) (defaults to: nil)

    The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

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

    Optional name for the container added.

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

    The number of cpu units used by the task.

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

    Gpu count for container in task definition.

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

    The hard limit (in MiB) of memory to present to the container.

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

    The soft limit (in MiB) of memory to reserve for the container.

  • placement_constraints (Array<AWSCDK::ECS::PlacementConstraint>, nil) (defaults to: nil)

    The placement constraints to use for tasks in the service.

  • placement_strategies (Array<AWSCDK::ECS::PlacementStrategy>, nil) (defaults to: nil)

    The placement strategies to use for tasks in the service.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 42

def initialize(capacity_provider_strategies: nil, circuit_breaker: nil, cluster: nil, command: nil, cooldown: nil, cpu_target_utilization_percent: nil, deployment_controller: nil, disable_cpu_based_scaling: nil, enable_ecs_managed_tags: nil, enable_execute_command: nil, enable_logging: nil, environment: nil, family: nil, image: nil, log_driver: nil, max_healthy_percent: nil, max_receive_count: nil, max_scaling_capacity: nil, min_healthy_percent: nil, min_scaling_capacity: nil, propagate_tags: nil, queue: nil, retention_period: nil, scaling_steps: nil, secrets: nil, service_name: nil, visibility_timeout: nil, vpc: nil, container_name: nil, cpu: nil, gpu_count: nil, memory_limit_mib: nil, memory_reservation_mib: nil, placement_constraints: nil, placement_strategies: nil)
  @capacity_provider_strategies = capacity_provider_strategies.is_a?(Array) ? capacity_provider_strategies.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CapacityProviderStrategy.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : capacity_provider_strategies
  Jsii::Type.check_type(@capacity_provider_strategies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2FwYWNpdHlQcm92aWRlclN0cmF0ZWd5In0sImtpbmQiOiJhcnJheSJ9fQ==")), "capacityProviderStrategies") unless @capacity_provider_strategies.nil?
  @circuit_breaker = circuit_breaker.is_a?(Hash) ? ::AWSCDK::ECS::DeploymentCircuitBreaker.new(**circuit_breaker.transform_keys(&:to_sym)) : circuit_breaker
  Jsii::Type.check_type(@circuit_breaker, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRDaXJjdWl0QnJlYWtlciJ9")), "circuitBreaker") unless @circuit_breaker.nil?
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklDbHVzdGVyIn0=")), "cluster") unless @cluster.nil?
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "cooldown") unless @cooldown.nil?
  @cpu_target_utilization_percent = cpu_target_utilization_percent
  Jsii::Type.check_type(@cpu_target_utilization_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpuTargetUtilizationPercent") unless @cpu_target_utilization_percent.nil?
  @deployment_controller = deployment_controller.is_a?(Hash) ? ::AWSCDK::ECS::DeploymentController.new(**deployment_controller.transform_keys(&:to_sym)) : deployment_controller
  Jsii::Type.check_type(@deployment_controller, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRDb250cm9sbGVyIn0=")), "deploymentController") unless @deployment_controller.nil?
  @disable_cpu_based_scaling = disable_cpu_based_scaling
  Jsii::Type.check_type(@disable_cpu_based_scaling, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableCpuBasedScaling") unless @disable_cpu_based_scaling.nil?
  @enable_ecs_managed_tags = enable_ecs_managed_tags
  Jsii::Type.check_type(@enable_ecs_managed_tags, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableECSManagedTags") unless @enable_ecs_managed_tags.nil?
  @enable_execute_command = enable_execute_command
  Jsii::Type.check_type(@enable_execute_command, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableExecuteCommand") unless @enable_execute_command.nil?
  @enable_logging = enable_logging
  Jsii::Type.check_type(@enable_logging, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableLogging") unless @enable_logging.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.nil?
  @family = family
  Jsii::Type.check_type(@family, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "family") unless @family.nil?
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckltYWdlIn0=")), "image") unless @image.nil?
  @log_driver = log_driver
  Jsii::Type.check_type(@log_driver, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvZ0RyaXZlciJ9")), "logDriver") unless @log_driver.nil?
  @max_healthy_percent = max_healthy_percent
  Jsii::Type.check_type(@max_healthy_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxHealthyPercent") unless @max_healthy_percent.nil?
  @max_receive_count = max_receive_count
  Jsii::Type.check_type(@max_receive_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxReceiveCount") unless @max_receive_count.nil?
  @max_scaling_capacity = max_scaling_capacity
  Jsii::Type.check_type(@max_scaling_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxScalingCapacity") unless @max_scaling_capacity.nil?
  @min_healthy_percent = min_healthy_percent
  Jsii::Type.check_type(@min_healthy_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minHealthyPercent") unless @min_healthy_percent.nil?
  @min_scaling_capacity = min_scaling_capacity
  Jsii::Type.check_type(@min_scaling_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minScalingCapacity") unless @min_scaling_capacity.nil?
  @propagate_tags = propagate_tags
  Jsii::Type.check_type(@propagate_tags, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3BhZ2F0ZWRUYWdTb3VyY2UifQ==")), "propagateTags") unless @propagate_tags.nil?
  @queue = queue
  Jsii::Type.check_type(@queue, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3FzLklRdWV1ZSJ9")), "queue") unless @queue.nil?
  @retention_period = retention_period
  Jsii::Type.check_type(@retention_period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "retentionPeriod") unless @retention_period.nil?
  @scaling_steps = scaling_steps.is_a?(Array) ? scaling_steps.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::ScalingInterval.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : scaling_steps
  Jsii::Type.check_type(@scaling_steps, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcHBsaWNhdGlvbmF1dG9zY2FsaW5nLlNjYWxpbmdJbnRlcnZhbCJ9LCJraW5kIjoiYXJyYXkifX0=")), "scalingSteps") unless @scaling_steps.nil?
  @secrets = secrets
  Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuU2VjcmV0In0sImtpbmQiOiJtYXAifX0=")), "secrets") unless @secrets.nil?
  @service_name = service_name
  Jsii::Type.check_type(@service_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceName") unless @service_name.nil?
  @visibility_timeout = visibility_timeout
  Jsii::Type.check_type(@visibility_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "visibilityTimeout") unless @visibility_timeout.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
  @container_name = container_name
  Jsii::Type.check_type(@container_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerName") unless @container_name.nil?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.nil?
  @gpu_count = gpu_count
  Jsii::Type.check_type(@gpu_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "gpuCount") unless @gpu_count.nil?
  @memory_limit_mib = memory_limit_mib
  Jsii::Type.check_type(@memory_limit_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryLimitMiB") unless @memory_limit_mib.nil?
  @memory_reservation_mib = memory_reservation_mib
  Jsii::Type.check_type(@memory_reservation_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryReservationMiB") unless @memory_reservation_mib.nil?
  @placement_constraints = placement_constraints
  Jsii::Type.check_type(@placement_constraints, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuUGxhY2VtZW50Q29uc3RyYWludCJ9LCJraW5kIjoiYXJyYXkifX0=")), "placementConstraints") unless @placement_constraints.nil?
  @placement_strategies = placement_strategies
  Jsii::Type.check_type(@placement_strategies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuUGxhY2VtZW50U3RyYXRlZ3kifSwia2luZCI6ImFycmF5In19")), "placementStrategies") unless @placement_strategies.nil?
end

Instance Attribute Details

#capacity_provider_strategiesArray<AWSCDK::ECS::CapacityProviderStrategy>? (readonly)

Note:

Default: - undefined

A list of Capacity Provider strategies used to place a service.

Returns:



119
120
121
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 119

def capacity_provider_strategies
  @capacity_provider_strategies
end

#circuit_breakerAWSCDK::ECS::DeploymentCircuitBreaker? (readonly)

Note:

Default: - disabled

Whether to enable the deployment circuit breaker.

If this property is defined, circuit breaker will be implicitly enabled.



127
128
129
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 127

def circuit_breaker
  @circuit_breaker
end

#clusterAWSCDK::ECS::ICluster? (readonly)

Note:

Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.

The name of the cluster that hosts the service.

If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.

Returns:



134
135
136
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 134

def cluster
  @cluster
end

#commandArray<String>? (readonly)

Note:

Default: - CMD value built into container image.

The command that is passed to the container.

If you provide a shell command as a single string, you have to quote command-line arguments.

Returns:

  • (Array<String>, nil)


141
142
143
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 141

def command
  @command
end

#container_nameString? (readonly)

Note:

Default: - QueueProcessingContainer

Optional name for the container added.

Returns:

  • (String, nil)


307
308
309
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 307

def container_name
  @container_name
end

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: 300 seconds

Grace period after scaling activity in seconds.

Subsequent scale outs during the cooldown period are squashed so that only the biggest scale out happens.

Subsequent scale ins during the cooldown period are ignored.



152
153
154
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 152

def cooldown
  @cooldown
end

#cpuNumeric? (readonly)

Note:

Default: none

The number of cpu units used by the task.

Valid values, which determines your range of valid values for the memory parameter:

256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB

512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB

1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB

2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments

4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments

This default is set in the underlying FargateTaskDefinition construct.

Returns:

  • (Numeric, nil)


326
327
328
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 326

def cpu
  @cpu
end

#cpu_target_utilization_percentNumeric? (readonly)

Note:

Default: - 50

The target CPU utilization percentage for CPU based scaling strategy when enabled.

Returns:

  • (Numeric, nil)


157
158
159
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 157

def cpu_target_utilization_percent
  @cpu_target_utilization_percent
end

#deployment_controllerAWSCDK::ECS::DeploymentController? (readonly)

Note:

Default: - Rolling update (ECS)

Specifies which deployment controller to use for the service.

For more information, see Amazon ECS Deployment Types



165
166
167
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 165

def deployment_controller
  @deployment_controller
end

#disable_cpu_based_scalingBoolean? (readonly)

Note:

Default: - false

Flag to disable CPU based auto scaling strategy on the service.

Returns:

  • (Boolean, nil)


170
171
172
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 170

def disable_cpu_based_scaling
  @disable_cpu_based_scaling
end

#enable_ecs_managed_tagsBoolean? (readonly)

Note:

Default: false

Specifies whether to enable Amazon ECS managed tags for the tasks within the service.

For more information, see Tagging Your Amazon ECS Resources

Returns:

  • (Boolean, nil)


178
179
180
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 178

def enable_ecs_managed_tags
  @enable_ecs_managed_tags
end

#enable_execute_commandBoolean? (readonly)

Note:

Default: - false

Whether ECS Exec should be enabled.

Returns:

  • (Boolean, nil)


183
184
185
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 183

def enable_execute_command
  @enable_execute_command
end

#enable_loggingBoolean? (readonly)

Note:

Default: true

Flag to indicate whether to enable logging.

Returns:

  • (Boolean, nil)


188
189
190
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 188

def enable_logging
  @enable_logging
end

#environmentHash{String => String}? (readonly)

Note:

Default: 'QUEUE_NAME: queue.queueName'

The environment variables to pass to the container.

The variable QUEUE_NAME with value queue.queueName will always be passed.

Returns:

  • (Hash{String => String}, nil)


196
197
198
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 196

def environment
  @environment
end

#familyString? (readonly)

Note:

Default: - Automatically generated name.

The name of a family that the task definition is registered to.

A family groups multiple versions of a task definition.

Returns:

  • (String, nil)


203
204
205
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 203

def family
  @family
end

#gpu_countNumeric? (readonly)

Note:

Default: - No GPUs assigned.

Gpu count for container in task definition.

Set this if you want to use gpu based instances.

Returns:

  • (Numeric, nil)


333
334
335
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 333

def gpu_count
  @gpu_count
end

#imageAWSCDK::ECS::ContainerImage? (readonly)

Note:

Default: - the image of the task definition is used for Fargate, required otherwise

The image used to start a container.

For QueueProcessingFargateService, either image or task_definition must be specified, but not both. For QueueProcessingEc2Service, image is required.

Returns:



211
212
213
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 211

def image
  @image
end

#log_driverAWSCDK::ECS::LogDriver? (readonly)

Note:

Default: - AwsLogDriver if enableLogging is true

The log driver to use.

Returns:



216
217
218
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 216

def log_driver
  @log_driver
end

#max_healthy_percentNumeric? (readonly)

Note:

Default: - default from underlying service.

The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment.

Returns:

  • (Numeric, nil)


221
222
223
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 221

def max_healthy_percent
  @max_healthy_percent
end

#max_receive_countNumeric? (readonly)

Note:

Default: 3

The maximum number of times that a message can be received by consumers.

When this value is exceeded for a message the message will be automatically sent to the Dead Letter Queue.

If the queue construct is specified, maxReceiveCount should be omitted.

Returns:

  • (Numeric, nil)


230
231
232
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 230

def max_receive_count
  @max_receive_count
end

#max_scaling_capacityNumeric? (readonly)

Note:

Default: 2

Maximum capacity to scale to.

Returns:

  • (Numeric, nil)


235
236
237
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 235

def max_scaling_capacity
  @max_scaling_capacity
end

#memory_limit_mibNumeric? (readonly)

Note:

Default: - No memory limit.

The hard limit (in MiB) of memory to present to the container.

If your container attempts to exceed the allocated memory, the container is terminated.

At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

Returns:

  • (Numeric, nil)


343
344
345
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 343

def memory_limit_mib
  @memory_limit_mib
end

#memory_reservation_mibNumeric? (readonly)

Note:

Default: - No memory reserved.

The soft limit (in MiB) of memory to reserve for the container.

When system memory is under contention, Docker attempts to keep the container memory within the limit. If the container requires more memory, it can consume up to the value specified by the Memory property or all of the available memory on the container instance—whichever comes first.

At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

Returns:

  • (Numeric, nil)


355
356
357
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 355

def memory_reservation_mib
  @memory_reservation_mib
end

#min_healthy_percentNumeric? (readonly)

Note:

Default: - default from underlying service.

The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment.

Returns:

  • (Numeric, nil)


240
241
242
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 240

def min_healthy_percent
  @min_healthy_percent
end

#min_scaling_capacityNumeric? (readonly)

Note:

Default: 1

Minimum capacity to scale to.

Returns:

  • (Numeric, nil)


245
246
247
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 245

def min_scaling_capacity
  @min_scaling_capacity
end

#placement_constraintsArray<AWSCDK::ECS::PlacementConstraint>? (readonly)

Note:

Default: - No constraints.

The placement constraints to use for tasks in the service.

For more information, see Amazon ECS Task Placement Constraints.

Returns:



363
364
365
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 363

def placement_constraints
  @placement_constraints
end

#placement_strategiesArray<AWSCDK::ECS::PlacementStrategy>? (readonly)

Note:

Default: - No strategies.

The placement strategies to use for tasks in the service.

For more information, see Amazon ECS Task Placement Strategies.

Returns:



371
372
373
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 371

def placement_strategies
  @placement_strategies
end

#propagate_tagsAWSCDK::ECS::PropagatedTagSource? (readonly)

Note:

Default: - none

Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

Tags can only be propagated to the tasks within the service during service creation.



252
253
254
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 252

def propagate_tags
  @propagate_tags
end

#queueAWSCDK::SQS::IQueue? (readonly)

Note:

Default: 'SQSQueue with CloudFormation-generated name'

A queue for which to process items from.

If specified and this is a FIFO queue, the queue name must end in the string '.fifo'. See CreateQueue

Returns:



260
261
262
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 260

def queue
  @queue
end

#retention_periodAWSCDK::Duration? (readonly)

Note:

Default: Duration.days(14)

The number of seconds that Dead Letter Queue retains a message.

If the queue construct is specified, retentionPeriod should be omitted.

Returns:



267
268
269
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 267

def retention_period
  @retention_period
end

#scaling_stepsArray<AWSCDK::ApplicationAutoScaling::ScalingInterval>? (readonly)

Note:

Default: [{ upper: 0, change: -1 },{ lower: 100, change: +1 },{ lower: 500, change: +5 }]

The intervals for scaling based on the SQS queue's ApproximateNumberOfMessagesVisible metric.

Maps a range of metric values to a particular scaling behavior. See Simple and Step Scaling Policies for Amazon EC2 Auto Scaling



275
276
277
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 275

def scaling_steps
  @scaling_steps
end

#secretsHash{String => AWSCDK::ECS::Secret}? (readonly)

Note:

Default: - No secret environment variables.

The secret to expose to the container as an environment variable.

Returns:



280
281
282
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 280

def secrets
  @secrets
end

#service_nameString? (readonly)

Note:

Default: - CloudFormation-generated name.

The name of the service.

Returns:

  • (String, nil)


285
286
287
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 285

def service_name
  @service_name
end

#visibility_timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(30)

Timeout of processing a single message.

After dequeuing, the processor has this much time to handle the message and delete it from the queue before it becomes visible again for dequeueing by another processor. Values must be between 0 and (12 hours).

If the queue construct is specified, visibilityTimeout should be omitted.

Returns:



295
296
297
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 295

def visibility_timeout
  @visibility_timeout
end

#vpcAWSCDK::EC2::IVPC? (readonly)

Note:

Default: - uses the VPC defined in the cluster or creates a new VPC.

The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.

Returns:



302
303
304
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 302

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 373

def self.jsii_properties
  {
    :capacity_provider_strategies => "capacityProviderStrategies",
    :circuit_breaker => "circuitBreaker",
    :cluster => "cluster",
    :command => "command",
    :cooldown => "cooldown",
    :cpu_target_utilization_percent => "cpuTargetUtilizationPercent",
    :deployment_controller => "deploymentController",
    :disable_cpu_based_scaling => "disableCpuBasedScaling",
    :enable_ecs_managed_tags => "enableECSManagedTags",
    :enable_execute_command => "enableExecuteCommand",
    :enable_logging => "enableLogging",
    :environment => "environment",
    :family => "family",
    :image => "image",
    :log_driver => "logDriver",
    :max_healthy_percent => "maxHealthyPercent",
    :max_receive_count => "maxReceiveCount",
    :max_scaling_capacity => "maxScalingCapacity",
    :min_healthy_percent => "minHealthyPercent",
    :min_scaling_capacity => "minScalingCapacity",
    :propagate_tags => "propagateTags",
    :queue => "queue",
    :retention_period => "retentionPeriod",
    :scaling_steps => "scalingSteps",
    :secrets => "secrets",
    :service_name => "serviceName",
    :visibility_timeout => "visibilityTimeout",
    :vpc => "vpc",
    :container_name => "containerName",
    :cpu => "cpu",
    :gpu_count => "gpuCount",
    :memory_limit_mib => "memoryLimitMiB",
    :memory_reservation_mib => "memoryReservationMiB",
    :placement_constraints => "placementConstraints",
    :placement_strategies => "placementStrategies",
  }
end

Instance Method Details

#to_jsiiObject



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'ecs_patterns/queue_processing_ec2_service_props.rb', line 413

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "capacityProviderStrategies" => @capacity_provider_strategies,
    "circuitBreaker" => @circuit_breaker,
    "cluster" => @cluster,
    "command" => @command,
    "cooldown" => @cooldown,
    "cpuTargetUtilizationPercent" => @cpu_target_utilization_percent,
    "deploymentController" => @deployment_controller,
    "disableCpuBasedScaling" => @disable_cpu_based_scaling,
    "enableECSManagedTags" => @enable_ecs_managed_tags,
    "enableExecuteCommand" => @enable_execute_command,
    "enableLogging" => @enable_logging,
    "environment" => @environment,
    "family" => @family,
    "image" => @image,
    "logDriver" => @log_driver,
    "maxHealthyPercent" => @max_healthy_percent,
    "maxReceiveCount" => @max_receive_count,
    "maxScalingCapacity" => @max_scaling_capacity,
    "minHealthyPercent" => @min_healthy_percent,
    "minScalingCapacity" => @min_scaling_capacity,
    "propagateTags" => @propagate_tags,
    "queue" => @queue,
    "retentionPeriod" => @retention_period,
    "scalingSteps" => @scaling_steps,
    "secrets" => @secrets,
    "serviceName" => @service_name,
    "visibilityTimeout" => @visibility_timeout,
    "vpc" => @vpc,
    "containerName" => @container_name,
    "cpu" => @cpu,
    "gpuCount" => @gpu_count,
    "memoryLimitMiB" => @memory_limit_mib,
    "memoryReservationMiB" => @memory_reservation_mib,
    "placementConstraints" => @placement_constraints,
    "placementStrategies" => @placement_strategies,
  })
  result.compact
end