Class: AWSCDK::EC2::AmazonLinuxImageSSMParameterBaseProps

Inherits:
AmazonLinuxImageSSMParameterBaseOptions
  • Object
show all
Defined in:
ec2/amazon_linux_image_ssm_parameter_base_props.rb

Overview

Base properties for an Amazon Linux SSM Parameter.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(additional_cache_key: nil, cached_in_context: nil, user_data: nil, parameter_name:) ⇒ AmazonLinuxImageSSMParameterBaseProps

Returns a new instance of AmazonLinuxImageSSMParameterBaseProps.

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.

  • user_data (AWSCDK::EC2::UserData, nil) (defaults to: nil)

    Initial user data.

  • parameter_name (String)

    The name of the SSM parameter that contains the AMI value.



11
12
13
14
15
16
17
18
19
20
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 11

def initialize(additional_cache_key: nil, cached_in_context: nil, user_data: nil, parameter_name:)
  @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?
  @user_data = user_data
  Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData") unless @user_data.nil?
  @parameter_name = parameter_name
  Jsii::Type.check_type(@parameter_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "parameterName")
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)


26
27
28
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 26

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)


45
46
47
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 45

def cached_in_context
  @cached_in_context
end

#parameter_nameString (readonly)

The name of the SSM parameter that contains the AMI value.

Returns:

  • (String)


54
55
56
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 54

def parameter_name
  @parameter_name
end

#user_dataAWSCDK::EC2::UserData? (readonly)

Note:

Default: - Empty UserData for Linux machines

Initial user data.

Returns:



50
51
52
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 50

def user_data
  @user_data
end

Class Method Details

.jsii_propertiesObject



56
57
58
59
60
61
62
63
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 56

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

Instance Method Details

#to_jsiiObject



65
66
67
68
69
70
71
72
73
74
75
# File 'ec2/amazon_linux_image_ssm_parameter_base_props.rb', line 65

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