Interface IAttachInitOptions
Options for attaching a CloudFormationInit to a resource.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IAttachInitOptions
Syntax (vb)
Public Interface IAttachInitOptions
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.IAM;
CfnResource cfnResource;
Role role;
UserData userData;
var attachInitOptions = new AttachInitOptions {
InstanceRole = role,
Platform = OperatingSystemType.LINUX,
UserData = userData,
// the properties below are optional
ConfigSets = new [] { "configSets" },
EmbedFingerprint = false,
IgnoreFailures = false,
IncludeRole = false,
IncludeUrl = false,
PrintLog = false,
SignalResource = cfnResource
};
Synopsis
Properties
ConfigSets | ConfigSet to activate. |
EmbedFingerprint | Whether to embed a hash into the userData. |
IgnoreFailures | Don't fail the instance creation when cfn-init fails. |
IncludeRole | Include --role argument when running cfn-init and cfn-signal commands. |
IncludeUrl | Include --url argument when running cfn-init and cfn-signal commands. |
InstanceRole | Instance role of the consuming instance or fleet. |
Platform | OS Platform the init config will be used for. |
PrintLog | Print the results of running cfn-init to the Instance System Log. |
SignalResource | When provided, signals this resource instead of the attached resource. |
UserData | UserData to add commands to. |
Properties
ConfigSets
ConfigSet to activate.
virtual string[] ConfigSets { get; }
Property Value
System.String[]
Remarks
Default: ['default']
EmbedFingerprint
Whether to embed a hash into the userData.
virtual Nullable<bool> EmbedFingerprint { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
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
the instance will be replaced.
If false
, no such hash will be embedded, and if the CloudFormation Init
config changes nothing will happen to the running instance.
Default: true
IgnoreFailures
Don't fail the instance creation when cfn-init fails.
virtual Nullable<bool> IgnoreFailures { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
You can use this to prevent CloudFormation from rolling back when instances fail to start up, to help in debugging.
Default: false
IncludeRole
Include --role argument when running cfn-init and cfn-signal commands.
virtual Nullable<bool> IncludeRole { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
This will be the IAM instance profile attached to the EC2 instance
Default: false
IncludeUrl
Include --url argument when running cfn-init and cfn-signal commands.
virtual Nullable<bool> IncludeUrl { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
This will be the cloudformation endpoint in the deployed region e.g. https://cloudformation.us-east-1.amazonaws.com
Default: false
InstanceRole
Platform
OS Platform the init config will be used for.
OperatingSystemType Platform { get; }
Property Value
PrintLog
Print the results of running cfn-init to the Instance System Log.
virtual Nullable<bool> PrintLog { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
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).
Default: true
SignalResource
When provided, signals this resource instead of the attached resource.
virtual CfnResource SignalResource { get; }
Property Value
Remarks
You can use this to support signaling LaunchTemplate while attaching AutoScalingGroup
Default: - if this property is undefined cfn-signal signals the attached resource