Class: AWSCDK::ECS::ECSOptimizedImageOptions

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

Overview

Additional configuration properties for EcsOptimizedImage factory functions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(additional_cache_key: nil, cached_in_context: nil) ⇒ ECSOptimizedImageOptions

Returns a new instance of ECSOptimizedImageOptions.

Parameters:

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

    Adds an additional discriminator to the cdk.context.json cache key.

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

    Whether the AMI ID is cached to be stable between deployments.



9
10
11
12
13
14
# File 'ecs/ecs_optimized_image_options.rb', line 9

def initialize(additional_cache_key: nil, cached_in_context: nil)
  @additional_cache_key = additional_cache_key
  Jsii::Type.check_type(@additional_cache_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "additionalCacheKey") unless @additional_cache_key.nil?
  @cached_in_context = cached_in_context
  Jsii::Type.check_type(@cached_in_context, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "cachedInContext") unless @cached_in_context.nil?
end

Instance Attribute Details

#additional_cache_keyString? (readonly)

Note:

Default: - no additional cache key

Adds an additional discriminator to the cdk.context.json cache key.

Returns:

  • (String, nil)


20
21
22
# File 'ecs/ecs_optimized_image_options.rb', line 20

def additional_cache_key
  @additional_cache_key
end

#cached_in_contextBoolean? (readonly)

Note:

Default: false

Whether the AMI ID is cached to be stable between deployments.

By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on.

If set to true, the AMI ID will be cached in cdk.context.json and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the cdk context command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.

Can not be set to true in environment-agnostic stacks.

Returns:

  • (Boolean, nil)


39
40
41
# File 'ecs/ecs_optimized_image_options.rb', line 39

def cached_in_context
  @cached_in_context
end

Class Method Details

.jsii_propertiesObject



41
42
43
44
45
46
# File 'ecs/ecs_optimized_image_options.rb', line 41

def self.jsii_properties
  {
    :additional_cache_key => "additionalCacheKey",
    :cached_in_context => "cachedInContext",
  }
end

Instance Method Details

#to_jsiiObject



48
49
50
51
52
53
54
55
# File 'ecs/ecs_optimized_image_options.rb', line 48

def to_jsii
  result = {}
  result.merge!({
    "additionalCacheKey" => @additional_cache_key,
    "cachedInContext" => @cached_in_context,
  })
  result.compact
end