interface InitServiceOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.InitServiceOptions |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#InitServiceOptions |
![]() | software.amazon.awscdk.services.ec2.InitServiceOptions |
![]() | aws_cdk.aws_ec2.InitServiceOptions |
![]() | aws-cdk-lib » aws_ec2 » InitServiceOptions |
Options for an InitService.
Example
declare const myBucket: s3.Bucket;
const handle = new ec2.InitServiceRestartHandle();
ec2.CloudFormationInit.fromElements(
ec2.InitFile.fromString('/etc/nginx/nginx.conf', '...', { serviceRestartHandles: [handle] }),
ec2.InitSource.fromS3Object('/var/www/html', myBucket, 'html.zip', { serviceRestartHandles: [handle] }),
ec2.InitService.enable('nginx', {
serviceRestartHandle: handle,
})
);
Properties
Name | Type | Description |
---|---|---|
enabled? | boolean | Enable or disable this service. |
ensure | boolean | Make sure this service is running or not running after cfn-init finishes. |
service | Service | What service manager to use. |
service | Init | Restart service when the actions registered into the restartHandle have been performed. |
enabled?
Type:
boolean
(optional, default: true if used in InitService.enable()
, no change to service
state if used in InitService.fromOptions()
.)
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.
ensureRunning?
Type:
boolean
(optional, default: same value as enabled
.)
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.
serviceManager?
Type:
Service
(optional, default: ServiceManager.SYSVINIT for Linux images, ServiceManager.WINDOWS for Windows images)
What service manager to use.
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.
serviceRestartHandle?
Type:
Init
(optional, default: No files trigger restart)
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.