Class: AWSCDK::EC2::ApplyCloudFormationInitOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::ApplyCloudFormationInitOptions
- Defined in:
- ec2/apply_cloud_formation_init_options.rb
Overview
Options for applying CloudFormation init to an instance or instance group.
Instance Attribute Summary collapse
-
#config_sets ⇒ Array<String>?
readonly
ConfigSet to activate.
-
#embed_fingerprint ⇒ Boolean?
readonly
Force instance replacement by embedding a config fingerprint.
-
#ignore_failures ⇒ Boolean?
readonly
Don't fail the instance creation when cfn-init fails.
-
#include_role ⇒ Boolean?
readonly
Include --role argument when running cfn-init and cfn-signal commands.
-
#include_url ⇒ Boolean?
readonly
Include --url argument when running cfn-init and cfn-signal commands.
-
#print_log ⇒ Boolean?
readonly
Print the results of running cfn-init to the Instance System Log.
-
#timeout ⇒ AWSCDK::Duration?
readonly
Timeout waiting for the configuration to be applied.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config_sets: nil, embed_fingerprint: nil, ignore_failures: nil, include_role: nil, include_url: nil, print_log: nil, timeout: nil) ⇒ ApplyCloudFormationInitOptions
constructor
A new instance of ApplyCloudFormationInitOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(config_sets: nil, embed_fingerprint: nil, ignore_failures: nil, include_role: nil, include_url: nil, print_log: nil, timeout: nil) ⇒ ApplyCloudFormationInitOptions
Returns a new instance of ApplyCloudFormationInitOptions.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 14 def initialize(config_sets: nil, embed_fingerprint: nil, ignore_failures: nil, include_role: nil, include_url: nil, print_log: nil, timeout: nil) @config_sets = config_sets Jsii::Type.check_type(@config_sets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "configSets") unless @config_sets.nil? @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? @timeout = timeout Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil? end |
Instance Attribute Details
#config_sets ⇒ Array<String>? (readonly)
Default: ['default']
ConfigSet to activate.
35 36 37 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 35 def config_sets @config_sets end |
#embed_fingerprint ⇒ Boolean? (readonly)
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.
- If the EC2 instance is instance-store backed or
user_data_causes_replacementis set, this will cause the instance to be replaced and the new configuration to be applied. - If the instance is EBS-backed and
user_data_causes_replacementis not set, the change of UserData will make the instance restart but not be replaced, and the configuration will not be applied automatically.
If false, no hash will be embedded, and if the CloudFormation Init
config changes nothing will happen to the running instance. If a
config update introduces errors, you will not notice until after the
CloudFormation deployment successfully finishes and the next instance
fails to launch.
56 57 58 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 56 def @embed_fingerprint end |
#ignore_failures ⇒ Boolean? (readonly)
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.
64 65 66 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 64 def ignore_failures @ignore_failures end |
#include_role ⇒ Boolean? (readonly)
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
71 72 73 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 71 def include_role @include_role end |
#include_url ⇒ Boolean? (readonly)
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
79 80 81 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 79 def include_url @include_url end |
#print_log ⇒ Boolean? (readonly)
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).
92 93 94 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 92 def print_log @print_log end |
#timeout ⇒ AWSCDK::Duration? (readonly)
Default: Duration.minutes(5)
Timeout waiting for the configuration to be applied.
97 98 99 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 97 def timeout @timeout end |
Class Method Details
.jsii_properties ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 99 def self.jsii_properties { :config_sets => "configSets", :embed_fingerprint => "embedFingerprint", :ignore_failures => "ignoreFailures", :include_role => "includeRole", :include_url => "includeUrl", :print_log => "printLog", :timeout => "timeout", } end |
Instance Method Details
#to_jsii ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'ec2/apply_cloud_formation_init_options.rb', line 111 def to_jsii result = {} result.merge!({ "configSets" => @config_sets, "embedFingerprint" => @embed_fingerprint, "ignoreFailures" => @ignore_failures, "includeRole" => @include_role, "includeUrl" => @include_url, "printLog" => @print_log, "timeout" => @timeout, }) result.compact end |