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.
bool? Enabled { get; }
Property Value
bool?
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.
bool? EnsureRunning { get; }
Property Value
bool?
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.
ServiceManager? ServiceManager { get; }
Property Value
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.
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