Class AttachInitOptions
Options for attaching a CloudFormationInit to a resource.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AttachInitOptions : Object, IAttachInitOptions
Syntax (vb)
Public Class AttachInitOptions
Inherits Object
Implements 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
Constructors
AttachInitOptions() |
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. |
Constructors
AttachInitOptions()
public AttachInitOptions()
Properties
ConfigSets
ConfigSet to activate.
public string[] ConfigSets { get; set; }
Property Value
System.String[]
Remarks
Default: ['default']
EmbedFingerprint
Whether to embed a hash into the userData.
public Nullable<bool> EmbedFingerprint { get; set; }
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.
public Nullable<bool> IgnoreFailures { get; set; }
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.
public Nullable<bool> IncludeRole { get; set; }
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.
public Nullable<bool> IncludeUrl { get; set; }
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
Instance role of the consuming instance or fleet.
public IRole InstanceRole { get; set; }
Property Value
Platform
OS Platform the init config will be used for.
public OperatingSystemType Platform { get; set; }
Property Value
PrintLog
Print the results of running cfn-init to the Instance System Log.
public Nullable<bool> PrintLog { get; set; }
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.
public CfnResource SignalResource { get; set; }
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