Class: AWSCDK::ECSPatterns::FargateServiceBaseProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs_patterns/fargate_service_base_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(circuit_breaker: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, platform_version: nil, runtime_platform: nil, task_definition: nil) ⇒ FargateServiceBaseProps

Returns a new instance of FargateServiceBaseProps.

Parameters:

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

    Whether to enable the deployment circuit breaker.

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

    The number of cpu units used by the task.

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

    The amount (in GiB) of ephemeral storage to be allocated to the task.

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

    The amount (in MiB) of memory used by the task.

  • platform_version (AWSCDK::ECS::FargatePlatformVersion, nil) (defaults to: nil)

    The platform version on which to run your service.

  • runtime_platform (AWSCDK::ECS::RuntimePlatform, nil) (defaults to: nil)

    The runtime platform of the task definition.

  • task_definition (AWSCDK::ECS::FargateTaskDefinition, nil) (defaults to: nil)

    The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'ecs_patterns/fargate_service_base_props.rb', line 13

def initialize(circuit_breaker: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, platform_version: nil, runtime_platform: nil, task_definition: 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?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.nil?
  @ephemeral_storage_gib = ephemeral_storage_gib
  Jsii::Type.check_type(@ephemeral_storage_gib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ephemeralStorageGiB") unless @ephemeral_storage_gib.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?
  @platform_version = platform_version
  Jsii::Type.check_type(@platform_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVQbGF0Zm9ybVZlcnNpb24ifQ==")), "platformVersion") unless @platform_version.nil?
  @runtime_platform = runtime_platform.is_a?(Hash) ? ::AWSCDK::ECS::RuntimePlatform.new(**runtime_platform.transform_keys(&:to_sym)) : runtime_platform
  Jsii::Type.check_type(@runtime_platform, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlJ1bnRpbWVQbGF0Zm9ybSJ9")), "runtimePlatform") unless @runtime_platform.nil?
  @task_definition = task_definition
  Jsii::Type.check_type(@task_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVUYXNrRGVmaW5pdGlvbiJ9")), "taskDefinition") unless @task_definition.nil?
end

Instance Attribute Details

#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.



37
38
39
# File 'ecs_patterns/fargate_service_base_props.rb', line 37

def circuit_breaker
  @circuit_breaker
end

#cpuNumeric? (readonly)

Note:

Default: 256

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

8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments

16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments

This default is set in the underlying FargateTaskDefinition construct.

Returns:

  • (Numeric, nil)


60
61
62
# File 'ecs_patterns/fargate_service_base_props.rb', line 60

def cpu
  @cpu
end

#ephemeral_storage_gibNumeric? (readonly)

Note:

Default: Undefined, in which case, the task will receive 20GiB ephemeral storage.

The amount (in GiB) of ephemeral storage to be allocated to the task.

The minimum supported value is 21 GiB and the maximum supported value is 200 GiB.

Only supported in Fargate platform version 1.4.0 or later.

Returns:

  • (Numeric, nil)


69
70
71
# File 'ecs_patterns/fargate_service_base_props.rb', line 69

def ephemeral_storage_gib
  @ephemeral_storage_gib
end

#memory_limit_mibNumeric? (readonly)

Note:

Default: 512

The amount (in MiB) of memory used by the task.

This field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter:

512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)

1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)

2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)

Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)

Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU)

Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU)

This default is set in the underlying FargateTaskDefinition construct.

Returns:

  • (Numeric, nil)


93
94
95
# File 'ecs_patterns/fargate_service_base_props.rb', line 93

def memory_limit_mib
  @memory_limit_mib
end

#platform_versionAWSCDK::ECS::FargatePlatformVersion? (readonly)

Note:

Default: Latest

The platform version on which to run your service.

If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.



102
103
104
# File 'ecs_patterns/fargate_service_base_props.rb', line 102

def platform_version
  @platform_version
end

#runtime_platformAWSCDK::ECS::RuntimePlatform? (readonly)

Note:

Default: - If the property is undefined, operatingSystemFamily is LINUX and cpuArchitecture is X86_64

The runtime platform of the task definition.



107
108
109
# File 'ecs_patterns/fargate_service_base_props.rb', line 107

def runtime_platform
  @runtime_platform
end

#task_definitionAWSCDK::ECS::FargateTaskDefinition? (readonly)

Note:

Default: - none

The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.

[disable-awslint:ref-via-interface]



114
115
116
# File 'ecs_patterns/fargate_service_base_props.rb', line 114

def task_definition
  @task_definition
end

Class Method Details

.jsii_propertiesObject



116
117
118
119
120
121
122
123
124
125
126
# File 'ecs_patterns/fargate_service_base_props.rb', line 116

def self.jsii_properties
  {
    :circuit_breaker => "circuitBreaker",
    :cpu => "cpu",
    :ephemeral_storage_gib => "ephemeralStorageGiB",
    :memory_limit_mib => "memoryLimitMiB",
    :platform_version => "platformVersion",
    :runtime_platform => "runtimePlatform",
    :task_definition => "taskDefinition",
  }
end

Instance Method Details

#to_jsiiObject



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'ecs_patterns/fargate_service_base_props.rb', line 128

def to_jsii
  result = {}
  result.merge!({
    "circuitBreaker" => @circuit_breaker,
    "cpu" => @cpu,
    "ephemeralStorageGiB" => @ephemeral_storage_gib,
    "memoryLimitMiB" => @memory_limit_mib,
    "platformVersion" => @platform_version,
    "runtimePlatform" => @runtime_platform,
    "taskDefinition" => @task_definition,
  })
  result.compact
end