AWS LAMP with MariaDB10.2, PHP7.4 and Apache 2.4

I've been working with a LAMP stack server on AWS EC2 for some years. Recently PHP7.2 went out of support and I wanted to be running on a supported version, as well as using an up-to-date version of MariaDB and Apache.
It seems that PHP7.4 still isn't fully supported on AWS EC2 (see LAMP instructions). Others have shown how to get PHP7.4 working, but I found that it wasn't possible then to have an up-to-date version of MariaDB. It's also possible to get PHP7.3 working with MariaDB 10.2, but not it seems with PHP 7.4. After some searching, I found that it's possible to make PHP 7.4 work with MariaDB 10.2 from the CentOS repositories. Other's have also used similar solutions.

These are the lines from the userdata from a launch template:-

#!/bin/bash

cat > /etc/yum.repos.d/mariadb.repo <<EOF
# MariaDB 10.2 CentOS repository list - created 2020-11-18 16:24 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

yum makecache 
yum repolist 

yum update -y
yum install -y amazon-linux-extras
amazon-linux-extras enable php7.4
yum clean metadata
yum install -y php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
yum install -y httpd httpd-tools mod_ssl mariadb-server
systemctl enable httpd
systemctl enable mariadb

groupadd www
groupadd www_write
usermod -a -G www ec2-user
usermod -a -G www_write ec2-user
usermod -a -G www_write apache

systemctl start mariadb
printf "\nn\nY\nY\nY\nY\n" | sudo mysql_secure_installation
                

I've also included a variant on headless running of headless mysql_secure_installation (See comments at bottom of Automating `mysql_secure_installation`