Interface IInitServiceOptions
Options for an InitService.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IInitServiceOptions
Syntax (vb)
Public Interface IInitServiceOptions
Remarks
ExampleMetadata: infused
Examples
Bucket myBucket;
var handle = new InitServiceRestartHandle();
CloudFormationInit.FromElements(InitFile.FromString("/etc/nginx/nginx.conf", "...", new InitFileOptions { ServiceRestartHandles = new [] { handle } }), InitSource.FromS3Object("/var/www/html", myBucket, "html.zip", new InitSourceOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions {
ServiceRestartHandle = handle
}));
Synopsis
Properties
Enabled | Enable or disable this service. |
EnsureRunning | Make sure this service is running or not running after cfn-init finishes. |
ServiceManager | What service manager to use. |
ServiceRestartHandle | Restart service when the actions registered into the restartHandle have been performed. |
Properties
Enabled
Enable or disable this service.
virtual Nullable<bool> Enabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
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()
.
EnsureRunning
Make sure this service is running or not running after cfn-init finishes.
virtual Nullable<bool> EnsureRunning { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
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
.
ServiceManager
What service manager to use.
virtual Nullable<ServiceManager> ServiceManager { get; }
Property Value
System.Nullable<ServiceManager>
Remarks
This needs to match the actual service manager on your Operating System. For example, Amazon Linux 1 uses SysVinit, but Amazon Linux 2 uses Systemd.
Default: ServiceManager.SYSVINIT for Linux images, ServiceManager.WINDOWS for Windows images
ServiceRestartHandle
Restart service when the actions registered into the restartHandle have been performed.
virtual InitServiceRestartHandle ServiceRestartHandle { get; }
Property Value
Remarks
Register actions into the restartHandle by passing it to InitFile
, InitCommand
,
InitPackage
and InitSource
objects.
Default: - No files trigger restart