aws / aws/aws-cdk

(aws-ec2): systemd support for CloudFormation Init

Open
#19,075 1 comment 11 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Description

It looks like CloudFormation has added systemd support for the services key in CloudFormation::Init.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html#aws-resource-init-services:

> # Services
> You can use the services key to define which services should be enabled or disabled when the instance is launched. On Linux systems, this key is supported by using sysvinit **or systemd.**

This request is to add support to add systemd support to the [InitService class](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitService.html).

### Use Case

Currently you need to use `InitCommand` with a shell command to start a start a service with systemd from cfn-init. Using `InitService` would be cleaner, less error-prone, and more readable.

### Proposed Solution

Add a property to [`InitServiceOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitServiceOptions.html) to allow user to specify sysvinit or systemd. The entry will be synthesized using the `"sysvinit"` or `"systemd"` key based on this property. The property can default to sysvinit to be backwards compatible.

### Other information

_No response_

### Acknowledge

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Locate the TypeScript implementation of InitService and InitServiceOptions in the aws_ec2 module, then compare its synthesized services entries with the CloudFormation Init documentation linked in the issue. Done means users can choose sysvinit or systemd, sysvinit remains the default for compatibility, and both output forms are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.