InitService

class aws_cdk.aws_ec2.InitService

Bases: aws_cdk.aws_ec2.InitElement

A services that be enabled, disabled or restarted when the instance is launched.

Attributes

element_type

Returns the init element type for this element.

Return type

str

Static Methods

classmethod disable(service_name)

Disable and stop the given service.

Parameters

service_name (str) –

Return type

InitService

classmethod enable(service_name, *, enabled=None, ensure_running=None, service_restart_handle=None)

Enable and start the given service, optionally restarting it.

Parameters
  • service_name (str) –

  • enabled (Optional[bool]) – Enable or disable this service. Set to true to ensure that the service will be started automatically upon boot. Set to false to ensure that the service will not be started automatically upon boot. Default: - true if used in InitService.enable(), no change to service state if used in InitService.fromOptions().

  • ensure_running (Optional[bool]) – Make sure this service is running or not running after cfn-init finishes. Set to true to ensure that the service is running after cfn-init finishes. Set to false to ensure that the service is not running after cfn-init finishes. Default: - same value as enabled.

  • service_restart_handle (Optional[InitServiceRestartHandle]) – Restart service when the actions registered into the restartHandle have been performed. Register actions into the restartHandle by passing it to InitFile, InitCommand, InitPackage and InitSource objects. Default: - No files trigger restart

Return type

InitService