Amazon Linux v 2.0 does support systemd and comes installed by default:

cat /etc/os-release
NAME="Amazon Linux"
VERSION="2.0 (2017.12)"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2.0"
PRETTY_NAME="Amazon Linux 2.0 (2017.12) LTS Release Candidate"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2.0"
HOME_URL="https://amazonlinux.com/"

rpm -qa | grep -i systemd
systemd-libs-219-42.amzn2.4.x86_64
systemd-219-42.amzn2.4.x86_64
systemd-sysv-219-42.amzn2.4.x86_64`
Answer from supaflysnooka on serverfault.com
🌐
Amazon Web Services
aws.amazon.com › compute › amazon linux 2 › faqs
Amazon Linux 2 FAQs
2 weeks ago - Amazon Linux 2 is suited for a wide variety of virtualized and containerized workloads such as databases, data analytics, line-of-business applications, web and desktop applications, and more in production contexts. It is also available for use on · EC2 Bare Metal Instances as both a bare metal OS and a virtualization host. ... A Linux kernel tuned for performance on Amazon EC2. A set of core packages including systemd...
Discussions

centos - No package systemd available on Amazon linux EC2 - Unix & Linux Stack Exchange
Is there any option to manually install systemd to my linux system? ... You need to use Amazon Linux 2 for systemd, where it is installed by default. More on unix.stackexchange.com
🌐 unix.stackexchange.com
How to update systemd to version >219 on Amazon Linux 2
I have an EC2 running Amazon Linux 2 with systemd version 219 installed. I want to update to newer version but after using sudo yum update systemd, the answer is "No packages marked for update". Is... More on repost.aws
🌐 repost.aws
1
0
April 11, 2023
aws - Why is systemd service failing on Amazon Linux 2? - Unix & Linux Stack Exchange
I have a Node.js application cloned on an AWS EC2 instance running Amazon Linux 2. I can execute the project's server.js file just fine: [ec2-user@ip-*********** portfolio_v3]$ nvm use 16 Now using... More on unix.stackexchange.com
🌐 unix.stackexchange.com
Command not found: systemctl on Amazon Linux 2018.03 - Stack Overflow
As far as I know I would recommend ... of Linux taht supports systemd if operating systemd is mandatory for your requirement. Cause I don't think it is something that you can install as a package on your OS 2018-08-24T17:59:10.863Z+00:00 ... @Jason I confirm that the Amazon Linux AMI ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
AWS
docs.aws.amazon.com › amazon linux 2 › release notes › amazon linux 2 release notes › amazon linux 2 release notes for 2020 and earlier › amazon linux 2 release notes
Amazon Linux 2 release notes - Amazon Linux 2
Amazon Linux 2 uses the systemd 219 init system to bootstrap userspace and manage system processes. This is available as /sbin/init and replaces the System V-style init system that was available in the previous generation of Amazon Linux. Do not put initscripts sin /etc/init.d.
🌐
AWS
aws.amazon.com › blogs › aws › amazon-linux-2-modern-stable-and-enterprise-friendly
Amazon Linux 2 – Modern, Stable, and Enterprise-Friendly | Amazon Web Services
November 3, 2022 - SystemdAmazon Linux 2 includes the systemd init system, designed to provide better boot performance and increased control over individual services and groups of interdependent services.
🌐
Tenable
tenable.com › plugins › nessus › 173905
Amazon Linux 2 : systemd (ALAS-2023-2004)<!-- --> | Tenable®
The remote Amazon Linux 2 host is missing a security update. The version of systemd installed on the remote host is prior to 219-78. It is, therefore, affected by a vulnerability as referenced in the ALAS2-2023-2004 advisory. systemd before 247 does not adequately block local privilege escalation for some Sudo configurations, e.g., plausible sudoers files in which the systemctl status command may be executed.
🌐
Stack Exchange
unix.stackexchange.com › questions › 740014 › why-is-systemd-service-failing-on-amazon-linux-2
aws - Why is systemd service failing on Amazon Linux 2? - Unix & Linux Stack Exchange
sudo chmod 644 /etc/systemd/system/portfolio-v3.service sudo systemctl daemon-reload sudo systemctl enable portfolio-v3.service sudo systemctl start portfolio-v3.service
Find elsewhere
🌐
Amazon Web Services
aws.amazon.com › compute › amazon linux 2 › features
Amazon Linux 2 Features
April 29, 2026 - Amazon Linux 2 includes the widely adopted systemd init system which is used to bootstrap the user space as well as manage system processes.
🌐
cloudonaut
cloudonaut.io › migrating-to-amazon-linux-2
Migrating to Amazon Linux 2 | cloudonaut
June 27, 2018 - Amazon Linux 2 uses systemd as the init system. systemd executes elements of its startup sequence in parallel, which is faster than the traditional serial approach from SysVinit.
🌐
Tenable
tenable.com › plugins › nessus › 121050
Amazon Linux 2 : systemd (ALAS-2019-1141)<!-- --> | Tenable®
January 10, 2019 - The remote Amazon Linux 2 host is missing a security update. Large syslogd messages sent to journald can cause stack corruption, causing journald to crash. The version of systemd on Amazon Linux 2 is not vulnerable to privilege escalation in this case.
🌐
Stack Overflow
stackoverflow.com › questions › 75752322 › why-is-systemd-service-failing-on-aws-amazon-linux-2
Why is systemd service failing on AWS Amazon Linux 2? - Stack Overflow
I have a Node.js application cloned on an AWS EC2 instance running Amazon Linux 2. I can execute the project's server.js file just fine: [ec2-user@ip-*********** portfolio_v3]$ nvm use 16 Now using node v16.19.1 [ec2-user@ip-*********** portfolio_v3]$ MAIL_JET_API_KEY_PRIVATE="..." NYT_API_KEY="..." node server.js ... I am trying to create a systemd service so that the app will run all the time, and am following along with this walkthrough
🌐
Tenable
tenable.com › plugins › nessus › 168459
Amazon Linux 2 : systemd (ALAS-2022-1899)<!-- --> | Tenable®
December 7, 2022 - The remote Amazon Linux 2 host is missing a security update. The version of systemd installed on the remote host is prior to 219-78. It is, therefore, affected by a vulnerability as referenced in the ALAS2-2022-1899 advisory. An off-by-one Error issue was discovered in Systemd in format_timespan() function of time-util.c.
🌐
Tenable
tenable.com › plugins › nessus › 133552
Amazon Linux 2 : systemd (ALAS-2020-1388)<!-- --> | Tenable®
February 10, 2020 - The remote Amazon Linux 2 host is missing a security update. The version of systemd installed on the remote host is prior to 219-57. It is, therefore, affected by a vulnerability as referenced in the ALAS2-2020-1388 advisory. A heap use-after-free vulnerability was found in systemd, where asynchronous Polkit queries are performed while handling dbus messages.
🌐
Reddit
reddit.com › r/aws › amazon linux ami 2018.03.0 or amazon linux 2 ami
r/aws on Reddit: Amazon Linux AMI 2018.03.0 or Amazon Linux 2 AMI
August 15, 2018 -

Reddit's decision to charge for API access has shown that the company is more interested in making money than in providing a good user experience. The changes will force many popular third-party apps to shut down, which will inconvenience millions of users. Reddit's actions have also alienated many of its moderators, who rely on third-party apps to manage their communities.

Top answer
1 of 5
19
I find myself referring to Michael Wittig's blog post on Migrating to Amazon Linux 2 quite often. He briefly talks about: long term support SysVinit (the old) vs. systemd (the new) journald and the changes to the log files starting and stopping services the lack of EPEL and Amazon's replacement some agents and services were renamed, potentially breaking scripts ruby, netcat (nc) and cnf-init don't work out of the box there are no NAT and ECS optimized Amazon Linux 2 images. In general, I feel... if you have a relatively short development cycle and you need to set up your website (or whatever) soon, stick with Amazon Linux 1 aka 2018.03.0 and successive patches. if you have the time to experiment, look for solutions and potentially write your own, start using Amazon Linux 2. As u/cr125rider implies elsewhere in this thread, the switch to systemd (and IMHO, journald) is huge and at the very least will require you to retrain your muscle memory and the way you think about approaching problems. I.e., type X instead of Y. We're using both in my shop and quite frankly, I don't see much of a difference (yet) but speaking from experience, I know it's really painful skipping multiple versions when upgrading the OS. If you ever have to apply security patches to an application and those patches are only available for the most recent OS, you're in for a long weekend either upgrading to each version in succession, or rebuilding the whole instance. To recap: immediate need? Use Amazon Linux 1. Just playing around? Use 2.
2 of 5
11
Amazon Linux 2 is based off centos 7.3.1 it has systemd. Amazon Linux is based on the centos 6 series
Top answer
1 of 2
4

systemd is not supported in Services. The only correct is sysvinit:

services:
  sysvinit:
    my_worker:
      enabled: "true"
      ensureRunning: "true"

But I don't think it will even work, as this is for Amazon Linux 1, not for Amazon Linux 2.

In Amazon Linux 2 you shouldn't be even using much of .ebextensions. AWS docs specifically write:

On Amazon Linux 2 platforms, instead of providing files and commands in .ebextensions configuration files, we highly recommend that you use Buildfile. Procfile, and platform hooks whenever possible to configure and run custom code on your environment instances during instance provisioning.

Thus, you should consider using Procfile which does basically what you want to achieve:

Use a Procfile for long-running application processes that shouldn't exit. Elastic Beanstalk expects processes run from the Procfile to run continuously. Elastic Beanstalk monitors these processes and restarts any process that terminates. For short-running processes, use a Buildfile.

Alternative

Since you already have created a unit file /etc/systemd/system/my_worker.service for systemd, you can enable and start it yourself.

For this container_commands in .ebextensions can be used. For example:

container_commands:
   10_enable_worker:
     command: systemctl enable worker.service
   20_start_worker:
     command: systemctl start worker.service
2 of 2
1

It's not officially documented, but you can use a systemd service in Amazon Linux 2.

A block like the following should work:

services: 
    systemd:
        __SERVICE_NAME__:
            enabled: true
            ensureRunning: true

Support for a "systemd" service is provided by internal package /usr/lib/python3.7/site-packages/cfnbootstrap/construction.py which lists recognized service types: sysvinit, windows, and systemd

class CloudFormationCarpenter(object):
    _serviceTools = {"sysvinit": SysVInitTool, "windows": WindowsServiceTool, "systemd": SystemDTool}

Note that a systemd service must support chkconfig and in particular your launch script at /etc/init.d/__SERVICE_NAME__ must include a "chkconfig" and "description" line similar to:

# chkconfig: 2345 70 60
# description: Continuously logs Nginx status.

If you don't support chkconfig correctly then chkconfig --list __SERVICE_NAME__ will print an error, and attempting to deploy to Elastic Beanstalk will log a more detailed error in /var/log/cfn-init.log when it tries to start the service.

🌐
AWS
docs.aws.amazon.com › pdfs › linux › al2 › ug › al2-ug.pdf pdf
Amazon Linux 2 - User Guide
For more information, see systemd os-release ... AL2023 provides several versions of Amazon Corretto to support Java based workloads. The OpenJDK 7 packages are deprecated in AL2, and no longer present in AL2023. The · oldest JDK available in AL2023 is provided by Corretto 8. For more information about Java on Amazon Linux, see Java in AL2. ... Amazon Linux, convert Python 2 ...
🌐
AWS re:Post
repost.aws › questions › QUnFHdVih-Q1CdxH47nU1OZw › systemctl-command-doesn-t-work-inside-of-amazonlinux-latest-container
systemctl command doesn't work inside of amazonlinux:latest container | AWS re:Post
March 19, 2020 - cat /etc/os-release | grep CPE_NAME CPE_NAME="cpe:/o:amazon:linux:2018.03:ga" curl -o /usr/local/bin/systemctl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py\ && chmod +x /usr/local/bin/systemctl systemctl --version systemd 219 - via systemctl.py 1.5.7113 -PAM -AUDIT -SELINUX -IMA -APPARMOR -SMACK +SYSVINIT -UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL -XZ -LZ4 -SECCOMP -BLKID -ELFUTILS -KMOD -IDN ... EC2 user-data installs NVIDIA drivers successfully but ECS agent update only works when run manually ... How do I set up an HTTP proxy for Docker and the Amazon ECS container agent in Amazon Linux 2 or Amazon Linux 2023?