InitServiceRestartHandle

class aws_cdk.aws_ec2.InitServiceRestartHandle

Bases: object

An object that represents reasons to restart an InitService.

Pass an instance of this object to the InitFile, InitCommand, InitSource and InitPackage objects, and finally to an InitService itself to cause the actions (files, commands, sources, and packages) to trigger a restart of the service.

For example, the following will run a custom command to install Nginx, and trigger the nginx service to be restarted after the command has run:

# Example automatically generated. See https://github.com/aws/jsii/issues/826
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))