Class: AWSCDK::Autoscaling::ApplyCloudFormationInitOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/apply_cloud_formation_init_options.rb

Overview

Options for applying CloudFormation init to an instance or instance group.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_sets: nil, embed_fingerprint: nil, ignore_failures: nil, include_role: nil, include_url: nil, print_log: nil) ⇒ ApplyCloudFormationInitOptions

Returns a new instance of ApplyCloudFormationInitOptions.

Parameters:

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

    ConfigSet to activate.

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

    Force instance replacement by embedding a config fingerprint.

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

    Don't fail the instance creation when cfn-init fails.

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

    Include --role argument when running cfn-init and cfn-signal commands.

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

    Include --url argument when running cfn-init and cfn-signal commands.

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

    Print the results of running cfn-init to the Instance System Log.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 13

def initialize(config_sets: nil, embed_fingerprint: nil, ignore_failures: nil, include_role: nil, include_url: nil, print_log: nil)
  @config_sets = config_sets
  Jsii::Type.check_type(@config_sets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "configSets") unless @config_sets.nil?
  @embed_fingerprint = embed_fingerprint
  Jsii::Type.check_type(@embed_fingerprint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "embedFingerprint") unless @embed_fingerprint.nil?
  @ignore_failures = ignore_failures
  Jsii::Type.check_type(@ignore_failures, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ignoreFailures") unless @ignore_failures.nil?
  @include_role = include_role
  Jsii::Type.check_type(@include_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "includeRole") unless @include_role.nil?
  @include_url = include_url
  Jsii::Type.check_type(@include_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "includeUrl") unless @include_url.nil?
  @print_log = print_log
  Jsii::Type.check_type(@print_log, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "printLog") unless @print_log.nil?
end

Instance Attribute Details

#config_setsArray<String>? (readonly)

Note:

Default: ['default']

ConfigSet to activate.

Returns:

  • (Array<String>, nil)


32
33
34
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 32

def config_sets
  @config_sets
end

#embed_fingerprintBoolean? (readonly)

Note:

Default: true

Force instance replacement by embedding a config fingerprint.

If true (the default), a hash of the config will be embedded into the UserData, so that if the config changes, the UserData changes and instances will be replaced (given an UpdatePolicy has been configured on the AutoScalingGroup).

If false, no such hash will be embedded, and if the CloudFormation Init config changes nothing will happen to the running instances. If a config update introduces errors, you will not notice until after the CloudFormation deployment successfully finishes and the next instance fails to launch.

Returns:

  • (Boolean, nil)


48
49
50
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 48

def embed_fingerprint
  @embed_fingerprint
end

#ignore_failuresBoolean? (readonly)

Note:

Default: false

Don't fail the instance creation when cfn-init fails.

You can use this to prevent CloudFormation from rolling back when instances fail to start up, to help in debugging.

Returns:

  • (Boolean, nil)


56
57
58
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 56

def ignore_failures
  @ignore_failures
end

#include_roleBoolean? (readonly)

Note:

Default: false

Include --role argument when running cfn-init and cfn-signal commands.

This will be the IAM instance profile attached to the EC2 instance

Returns:

  • (Boolean, nil)


63
64
65
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 63

def include_role
  @include_role
end

#include_urlBoolean? (readonly)

Note:

Default: false

Include --url argument when running cfn-init and cfn-signal commands.

This will be the cloudformation endpoint in the deployed region e.g. https://cloudformation.us-east-1.amazonaws.com

Returns:

  • (Boolean, nil)


71
72
73
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 71

def include_url
  @include_url
end
Note:

Default: true

Print the results of running cfn-init to the Instance System Log.

By default, the output of running cfn-init is written to a log file on the instance. Set this to true to print it to the System Log (visible from the EC2 Console), false to not print it.

(Be aware that the system log is refreshed at certain points in time of the instance life cycle, and successful execution may not always show up).

Returns:

  • (Boolean, nil)


84
85
86
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 84

def print_log
  @print_log
end

Class Method Details

.jsii_propertiesObject



86
87
88
89
90
91
92
93
94
95
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 86

def self.jsii_properties
  {
    :config_sets => "configSets",
    :embed_fingerprint => "embedFingerprint",
    :ignore_failures => "ignoreFailures",
    :include_role => "includeRole",
    :include_url => "includeUrl",
    :print_log => "printLog",
  }
end

Instance Method Details

#to_jsiiObject



97
98
99
100
101
102
103
104
105
106
107
108
# File 'autoscaling/apply_cloud_formation_init_options.rb', line 97

def to_jsii
  result = {}
  result.merge!({
    "configSets" => @config_sets,
    "embedFingerprint" => @embed_fingerprint,
    "ignoreFailures" => @ignore_failures,
    "includeRole" => @include_role,
    "includeUrl" => @include_url,
    "printLog" => @print_log,
  })
  result.compact
end