class InitService
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.InitService |
![]() | software.amazon.awscdk.services.ec2.InitService |
![]() | aws_cdk.aws_ec2.InitService |
![]() | @aws-cdk/aws-ec2 » InitService |
Extends
Init
A services that be enabled, disabled or restarted when the instance is launched.
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 |
---|---|---|
element | string | Returns the init element type for this element. |
elementType
Type:
string
Returns the init element type for this element.
Methods
Name | Description |
---|---|
static disable(serviceName) | Disable and stop the given service. |
static enable(serviceName, options?) | Enable and start the given service, optionally restarting it. |
static disable(serviceName)
public static disable(serviceName: string): InitService
Parameters
- serviceName
string
Returns
Disable and stop the given service.
static enable(serviceName, options?)
public static enable(serviceName: string, options?: InitServiceOptions): InitService
Parameters
- serviceName
string
- options
Init
Service Options
Returns
Enable and start the given service, optionally restarting it.