enum ServiceManager
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.ServiceManager |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#ServiceManager |
![]() | software.amazon.awscdk.services.ec2.ServiceManager |
![]() | aws_cdk.aws_ec2.ServiceManager |
![]() | aws-cdk-lib » aws_ec2 » ServiceManager |
The service manager that will be used by InitServices.
The value needs to match the service manager used by your operating system.
Example
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
new ec2.Instance(this, 'Instance', {
vpc,
instanceType,
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
init: ec2.CloudFormationInit.fromElements(
// Create a simple config file that runs a Python web server
ec2.InitService.systemdConfigFile('simpleserver', {
command: '/usr/bin/python3 -m http.server 8080',
cwd: '/var/www/html',
}),
// Start the server using SystemD
ec2.InitService.enable('simpleserver', {
serviceManager: ec2.ServiceManager.SYSTEMD,
}),
// Drop an example file to show the web server working
ec2.InitFile.fromString('/var/www/html/index.html', 'Hello! It\'s working!'),
),
});
Members
Name | Description |
---|---|
SYSVINIT | Use SysVinit. |
WINDOWS | Use Windows. |
SYSTEMD | Use systemd. |
SYSVINIT
Use SysVinit.
This is the default for Linux systems.
WINDOWS
Use Windows.
This is the default for Windows systems.
SYSTEMD
Use systemd.