InitCommandOptions Struct
Options for InitCommand.
Example
ts
const handle = new ec2.InitServiceRestartHandle();
ec2.CloudFormationInit.fromElements(
ec2.InitCommand.shellCommand('/usr/bin/custom-nginx-install.sh', { serviceRestartHandles: [handle] }),
ec2.InitService.enable('nginx', { serviceRestartHandle: handle }),
);
Properties
The working directory.
Default: Use default working directory
envoptional{ [key: string]: string }envoptionaltyping.Mapping[str, str]envoptionalMap<String, String>EnvoptionalIDictionary<string, string>Envoptional*map[string]*string#Sets environment variables for the command.
Default: Use current environment
This property overwrites, rather than appends, the existing environment.
ignoreErrorsoptionalbooleanignore_errorsoptionalboolignoreErrorsoptionalBooleanIgnoreErrorsoptionalboolIgnoreErrorsoptional*bool= false#Continue running if this command fails.
Identifier key for this command.
Default: Automatically generated based on index
Commands are executed in lexicographical order of their key names.
serviceRestartHandlesoptionalInitServiceRestartHandle[]service_restart_handlesoptionaltyping.List[InitServiceRestartHandle]serviceRestartHandlesoptionalList<InitServiceRestartHandle>ServiceRestartHandlesoptionalInitServiceRestartHandle[]ServiceRestartHandlesoptional*[]InitServiceRestartHandle#Restart the given service(s) after this command has run.
Default: Do not restart any service
testCmdoptionalstringtest_cmdoptionalstrtestCmdoptionalStringTestCmdoptionalstringTestCmdoptional*string#Command to determine whether this command should be run.
Default: Always run the command
If the test passes (exits with error code of 0), the command is run.
waitAfterCompletionoptionalInitCommandWaitDurationwait_after_completionoptionalInitCommandWaitDurationwaitAfterCompletionoptionalInitCommandWaitDurationWaitAfterCompletionoptionalInitCommandWaitDurationWaitAfterCompletionoptionalInitCommandWaitDuration#The duration to wait after a command has finished in case the command causes a reboot.
Default: 60 seconds
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.