InitCommandOptions
- class aws_cdk.aws_ec2.InitCommandOptions(*, cwd=None, env=None, ignore_errors=None, key=None, service_restart_handles=None, test_cmd=None, wait_after_completion=None)
Bases:
object
Options for InitCommand.
- Parameters:
cwd (
Optional
[str
]) – The working directory. Default: - Use default working directoryenv (
Optional
[Mapping
[str
,str
]]) – Sets environment variables for the command. This property overwrites, rather than appends, the existing environment. Default: - Use current environmentignore_errors (
Optional
[bool
]) – Continue running if this command fails. Default: falsekey (
Optional
[str
]) – Identifier key for this command. Commands are executed in lexicographical order of their key names. Default: - Automatically generated based on indexservice_restart_handles (
Optional
[Sequence
[InitServiceRestartHandle
]]) – Restart the given service(s) after this command has run. Default: - Do not restart any servicetest_cmd (
Optional
[str
]) – Command to determine whether this command should be run. If the test passes (exits with error code of 0), the command is run. Default: - Always run the commandwait_after_completion (
Optional
[InitCommandWaitDuration
]) – The duration to wait after a command has finished in case the command causes a reboot. Set this value toInitCommandWaitDuration.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
- ExampleMetadata:
infused
Example:
handle = ec2.InitServiceRestartHandle() ec2.CloudFormationInit.from_elements( ec2.InitCommand.shell_command("/usr/bin/custom-nginx-install.sh", service_restart_handles=[handle]), ec2.InitService.enable("nginx", service_restart_handle=handle))
Attributes
- cwd
The working directory.
- Default:
Use default working directory
- env
Sets environment variables for the command.
This property overwrites, rather than appends, the existing environment.
- Default:
Use current environment
- ignore_errors
Continue running if this command fails.
- Default:
false
- key
Identifier key for this command.
Commands are executed in lexicographical order of their key names.
- Default:
Automatically generated based on index
- service_restart_handles
Restart the given service(s) after this command has run.
- Default:
Do not restart any service
- test_cmd
Command to determine whether this command should be run.
If the test passes (exits with error code of 0), the command is run.
- Default:
Always run the command
- wait_after_completion
The duration to wait after a command has finished in case the command causes a reboot.
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