Show / Hide Table of Contents

Class InitCommandOptions

Options for InitCommand.

Inheritance
object
InitCommandOptions
Implements
IInitCommandOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class InitCommandOptions : IInitCommandOptions
Syntax (vb)
Public Class InitCommandOptions Implements IInitCommandOptions
Remarks

ExampleMetadata: infused

Examples
var handle = new InitServiceRestartHandle();
            CloudFormationInit.FromElements(InitCommand.ShellCommand("/usr/bin/custom-nginx-install.sh", new InitCommandOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions { ServiceRestartHandle = handle }));

Synopsis

Constructors

InitCommandOptions()

Options for InitCommand.

Properties

Cwd

The working directory.

Env

Sets environment variables for the command.

IgnoreErrors

Continue running if this command fails.

Key

Identifier key for this command.

ServiceRestartHandles

Restart the given service(s) after this command has run.

TestCmd

Command to determine whether this command should be run.

WaitAfterCompletion

The duration to wait after a command has finished in case the command causes a reboot.

Constructors

InitCommandOptions()

Options for InitCommand.

public InitCommandOptions()
Remarks

ExampleMetadata: infused

Examples
var handle = new InitServiceRestartHandle();
            CloudFormationInit.FromElements(InitCommand.ShellCommand("/usr/bin/custom-nginx-install.sh", new InitCommandOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions { ServiceRestartHandle = handle }));

Properties

Cwd

The working directory.

public string? Cwd { get; set; }
Property Value

string

Remarks

Default: - Use default working directory

Env

Sets environment variables for the command.

public IDictionary<string, string>? Env { get; set; }
Property Value

IDictionary<string, string>

Remarks

This property overwrites, rather than appends, the existing environment.

Default: - Use current environment

IgnoreErrors

Continue running if this command fails.

public bool? IgnoreErrors { get; set; }
Property Value

bool?

Remarks

Default: false

Key

Identifier key for this command.

public string? Key { get; set; }
Property Value

string

Remarks

Commands are executed in lexicographical order of their key names.

Default: - Automatically generated based on index

ServiceRestartHandles

Restart the given service(s) after this command has run.

public InitServiceRestartHandle[]? ServiceRestartHandles { get; set; }
Property Value

InitServiceRestartHandle[]

Remarks

Default: - Do not restart any service

TestCmd

Command to determine whether this command should be run.

public string? TestCmd { get; set; }
Property Value

string

Remarks

If the test passes (exits with error code of 0), the command is run.

Default: - Always run the command

WaitAfterCompletion

The duration to wait after a command has finished in case the command causes a reboot.

public InitCommandWaitDuration? WaitAfterCompletion { get; set; }
Property Value

InitCommandWaitDuration

Remarks

Set this value to InitCommandWaitDuration.none() if you do not want to wait for every command; InitCommandWaitDuration.forever() directs cfn-init to exit and resume only after the reboot is complete.

For Windows systems only.

Default: - 60 seconds

Implements

IInitCommandOptions
Back to top Generated by DocFX