aws / elastic-beanstalk-roadmap

AWS Elastic Beanstalk roadmap
https://aws.amazon.com/elasticbeanstalk/
Creative Commons Attribution Share Alike 4.0 International
283 stars 11 forks source link

PHP 8.1 support #214

Closed IonBazan closed 2 years ago

IonBazan commented 2 years ago

Community Note

Tell us about your request What do you want us to build?

PHP 8.1 has officially been released on 25 November 2021, yay! Here are the changes and features introduced in this release: https://www.php.net/releases/8.1/en.php. It would be great to see it supported natively by Elastic Beanstalk.

Are you currently working around this issue?

Staying on PHP 8.0 or installing the 8.1 manually during startup.

1tonyca commented 2 years ago

https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-08-08-al2.html

jordanade commented 2 years ago

https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-08-08-al2.html

Happy day! Looks like there's a typo tho:

New! — Introduced new PHP 8.1 platform branch, running on version 8.0.18. For more information see PHP 8.1 Released!

on the PHP website.

This should say "running on version 8.1.8"

KZeni commented 2 years ago

Do anyone know if the php 8.1 packages became available for regular ec2 instances?

@ihor-sviziev Do you mean the amzn2extra repo? I can say that having updated everything just now and checking amazon-linux-extras has php8.0=latest enabled [ =stable ] with php8.1 not listed (whereas php7.4 is listed there as available so one would imagine that's where 8.1 would show [right?] and it isn't available yet.)

Maybe I'm missing a step here, and I sure would love to know if there is an official way of doing so that I'm just missing (I know there are alternative options for getting PHP 8.1, but I'd like to stick to amazon-linux-extras, if I can.) It does appear it's not listed as available via this method yet (please correct me if I'm wrong.)

jordanade commented 2 years ago

Am I missing something, or is the pecl command missing?

RahulDey12 commented 2 years ago

Am I missing something, or is the pecl command missing?

You need to install php-pear first

dejagersh commented 2 years ago

Am I missing something, or is the pecl command missing?

I ran into the same issue.

You need to install php-pear first

Thanks @RahulDey12 . Works with sudo yum install php-pear

swiffer commented 2 years ago

@thejager - how are you installing it? for me it is not working with php 8.1

================================================================================ 2022-08-09 15:02:07,694 P1670 [INFO] Package Arch Version Repository Size 2022-08-09 15:02:07,694 P1670 [INFO] ================================================================================ 2022-08-09 15:02:07,694 P1670 [INFO] Installing: 2022-08-09 15:02:07,694 P1670 [INFO] php-pear noarch 1:1.10.12-9.amzn2 amzn2-core 359 k 2022-08-09 15:02:07,694 P1670 [INFO] Installing for dependencies: 2022-08-09 15:02:07,694 P1670 [INFO] php-cli aarch64 8.0.20-1.amzn2 amzn2extra-php8.0 5.0 M 2022-08-09 15:02:07,694 P1670 [INFO] php-common aarch64 8.0.20-1.amzn2 amzn2extra-php8.0 1.2 M 2022-08-09 15:02:07,694 P1670 [INFO] php-process aarch64 8.0.20-1.amzn2 amzn2extra-php8.0 84 k 2022-08-09 15:02:07,694 P1670 [INFO] php-xml aarch64 8.0.20-1.amzn2 amzn2extra-php8.0 175 k 2022-08-09 15:02:07,694 P1670 [INFO]
2022-08-09 15:02:07,694 P1670 [INFO] Transaction Summary 2022-08-09 15:02:07,694 P1670 [INFO] ================================================================================ 2022-08-09 15:02:07,694 P1670 [INFO] Install 1 Package (+4 Dependent packages) 2022-08-09 15:02:07,694 P1670 [INFO]
2022-08-09 15:02:07,694 P1670 [INFO] Total download size: 6.8 M 2022-08-09 15:02:07,694 P1670 [INFO] Installed size: 35 M

KZeni commented 2 years ago

@swiffer It appears you're encountering what I found & detailed in https://github.com/aws/elastic-beanstalk-roadmap/issues/214#issuecomment-1208871665 above.

That's showing you're using amzn2extra which then has PHP 8.0.20 being used, currently (that being the latest PHP version from the php8.0 item in amazon-linux-extras that's likely enabled & being used.)

I checked just now and amazon-linux-extras is still not listing php8.1 as an option. So it seems we're still waiting on AWS to complete that remaining item regarding PHP 8.1 being made available officially from them where past PHP versions are offered. Once that's offered (hopefully soon since it's now available elsewhere as mentioned by others above), one can go through the route of switching the enabled php version via amazon-linux-extras (among the other steps potentially involved.)

RahulDey12 commented 2 years ago

Do anyone know if the php 8.1 packages became available for regular ec2 instances?

@ihor-sviziev Do you mean the amzn2extra repo? I can say that having updated everything just now and checking amazon-linux-extras has php8.0=latest enabled [ =stable ] with php8.1 not listed (whereas php7.4 is listed there as available so one would imagine that's where 8.1 would show [right?] and it isn't available yet.)

Maybe I'm missing a step here, and I sure would love to know if there is an official way of doing so that I'm just missing (I know there are alternative options for getting PHP 8.1, but I'd like to stick to amazon-linux-extras, if I can.) It does appear it's not listed as available via this method yet (please correct me if I'm wrong.)

They did not updated AL2 repository. But there is an Public AMI of elastic beanstalk with php81. Maybe that could help.

PeterCai7 commented 2 years ago

https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-08-08-al2.html

Happy day! Looks like there's a typo tho:

New! — Introduced new PHP 8.1 platform branch, running on version 8.0.18. For more information see PHP 8.1 Released! on the PHP website.

This should say "running on version 8.1.8"

They have updated. Good call out. image

newadventure079 commented 2 years ago

For those looking to upgrade an existing environment, this can be done via the AWS CLI.

WARNING: Don't run this on a production environment without testing! And don't blame me if it breaks something

aws elasticbeanstalk update-environment \
--solution-stack-name "64bit Amazon Linux 2 v3.4.0 running PHP 8.1" \
--environment-id "x-xxxxxxxxxx" \
--region "xx-xxxx-x"

@andyexeter If you run that command, you end up with this. It wants you to get on 3.4.0, even tho you're already on 3.4.0 Screen Shot 2022-08-09 at 6 09 01 PM

newadventure079 commented 2 years ago

For those looking to upgrade an existing environment, this can be done via the AWS CLI. WARNING: Don't run this on a production environment without testing! And don't blame me if it breaks something

aws elasticbeanstalk update-environment \
--solution-stack-name "64bit Amazon Linux 2 v3.4.0 running PHP 8.1" \
--environment-id "x-xxxxxxxxxx" \
--region "xx-xxxx-x"

@andyexeter If you run that command, you end up with this. It wants you to get on 3.4.0, even tho you're already on 3.4.0 Screen Shot 2022-08-09 at 6 09 01 PM

It looks like that message goes away if you refresh the page or click out of the page and come back in

RahulDey12 commented 2 years ago

Please confirm when it will available for the amazon-linux-extras

iwishiwala commented 2 years ago

They added PHP8.1 yesterday!

KZeni commented 2 years ago

Please confirm when it will available for the amazon-linux-extras

Agreed. I'm looking forward to having an email notification via this issue from whoever finds out it's been added.

Here's the alphabetical list of what amazon-linux-extras currently offers on an otherwise up-to-date Amazon Linux 2 instance: https://gist.github.com/KZeni/9fa3510fb721e7782cdc3f89489fda8e *Note that PHP has a dedicated item for each x.1 version that then auto-updates the x.x.1 version for patches where it's still missing php8.1 as of now.

jordanade commented 2 years ago

In addition to the missing pecl, which is easily remedied, it seems that PHP's gd and pdo extensions are also missing. Is this intentional, or is this upgrade half-baked? Should I workaround or wait?

cloudjareen commented 2 years ago

I would like to confirm that gd and pdo extensions do exist. Please ssh into the instance and check using the command php -m. Also thanks for the 8.1 release. However its very depressing to see such a highly voted feature take so much time to land. There are a lot of folks out here who do not use docker , coz otherwise they could have used any service besides beanstalk. But I would like everybody to invest learning docker, so that we are not at mercy of late releases like this. Thanks

christian-manrique commented 2 years ago

Hi all, thanks for all the updates but i am also having the same error, the instance type is m6g.8xlarge and since i updated all the package the amazon-linux-extras list | grep php just return as latest 8.0 instead 8.1 which is what am looking forward to do, is there a workaround or suggestion to do? thanks for any advice

Screen Shot 2022-08-11 at 8 12 16 PM

amman20 commented 2 years ago

@jordanade what is the workaround for the missing pcntl?

MortenDHansen commented 2 years ago

Alright. I i'm not able to grasp how to get extensions that are not pre-loaded to work. Many applications will for example need a redis connection (in my case elasticache), but there seems to be no way to install redis for php after the upgrade, no articles seems to be able to help. (eg. https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-pecl7-amazon-linux2/)

Running installation for any extension picks the 8.0 extension.

How can i uninstall the elasticbeanstalk php so i can reinstall from remi instead?

andyexeter commented 2 years ago

@MortenDHansen I ended up switching to Pickle after seeing pecl was no longer installed by default.

Here's prebuild script which sets the redis extension up (create it as e.g. .platform/prebuild/10_install_redis.sh):

#!/bin/bash

set -xe

if ! [ -f /bin/pickle ]; then
  wget https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -O /bin/pickle
  chmod +x /bin/pickle
fi

if ! php -r 'exit(extension_loaded("redis") ? 0 : 1);'; then
  /bin/pickle install redis --no-interaction --no-ansi
  echo 'extension=redis.so' > /etc/php.d/41-redis.ini
fi
MortenDHansen commented 2 years ago

Oh thanks! - that mitigates an issue on the list. Can't seem to do pcntl that way though :)

localpath commented 2 years ago

You can install pecl then redis via it as well. Something to this effect

sudo yum install php-pear

sudo pecl channel-update pecl.php.net

sudo yum install php-devel

sudo no | sudo pecl install redis

sudo sed -i -e '/extension="redis.so"/d' /etc/php.ini

sudo echo 'extension="redis.so"' > /etc/php.d/41-redis.ini
yurik94 commented 2 years ago

I have a few issues (tested on latest EB PHP 8.1 t4g graviton/arm and x64):

publiux commented 2 years ago

This is absolutely insane. I was planning on migrating to AWS services with EB, but this lack of support for basic PHP is just driving me to another provider at this point.

nickdnk commented 2 years ago

https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-08-08-al2.html

@1tonyca While I'm sure we all appreciate that you now have 8.1 support, do you honestly feel like the communication with the community in this thread is adequate? No explanation for the absurd delay? No replies to/help with any of the problems people are having, the bugs found or missing features such as pecl, extra repo support etc?

PeterCai7 commented 2 years ago

Sorry that we are not able to make the community happy at this time. We have noticed the bugs and missing features and thank you all for the feedbacks. But for extra repo support, this is the first time EB team was curating PHP runtime by our own rather than using Amazon Linux repo. We don't have a good answer for this point yet. We are working on all those stuff and explanary wordings. Will update once we feel they are verified and reliable.

yurik94 commented 2 years ago

As REMI repository for php 8.1 is not working on arm/graviton cpus, I managed to install the missing php extensions (redis, ev, pcntl support) with the following yaml snippet of .ebextensions:

02_install_pecl_redis:
    command: |
      php /usr/lib/php/peclcmd.php install redis
      echo "extension=redis.so" | tee /etc/php.d/50-redis.ini
    test: "php -r \"exit(extension_loaded('redis') ? 1 : 0);\""

  03_install_pecl_ev:
    command: |
      php /usr/lib/php/peclcmd.php install ev
      echo "extension=ev.so" | tee /etc/php.d/50-ev.ini
    test: "php -r \"exit(extension_loaded('ev') ? 1 : 0);\""

  04_install_pcntl:
    command: |
      wget https://www.php.net/distributions/php-8.1.9.tar.gz
      tar -xf php-8.1.9.tar.gz
      cd php-8.1.9/ext/pcntl
      phpize
      ./configure
      make
      mv modules/pcntl.so /lib/php/extensions/no-debug-zts-20210902/pcntl.so
      cd ../../../
      rm -rf php-8.1.9
      echo "extension=pcntl.so" | tee /etc/php.d/50-pcntl.ini
    test: "php -r \"exit(extension_loaded('pcntl') ? 1 : 0);\""

Of course the hardocoded folder doesn't look good (you can use something like php-config --extension-dir) but it's tested and fully working on both x64 and graviton arm ATM

christian-manrique commented 2 years ago

Hi all, is this still not resolved? i want to deploy PHP 8.1on my ec2 server for the perks in performance and raised index of requests per second :'( please help

PeterCai7 commented 2 years ago

https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-08-31-al2.html

ihor-sviziev commented 2 years ago

Could someone confirm, does php 8.1 became available through Amazon extra repositories on regular ec2 instances?

salvoaranzulla commented 2 years ago

@ihor-sviziev I don't see it:

$ amazon-linux-extras | grep "php8" _ php8.0 available [ =stable ]

christian-manrique commented 2 years ago

@ihor-sviziev I don't see it:

$ amazon-linux-extras | grep "php8" _ php8.0 available [ =stable ]

did you execute the sudo yum/apt-get update?

salvoaranzulla commented 2 years ago

@christian-manrique Few minutes ago, I have done:

$ sudo yum update -y amazon-linux-extras

but nothing is changed:

$ amazon-linux-extras | grep "php8" _ php8.0 available [ =stable ]

MaximGns commented 2 years ago

Still the same here:

sudo amazon-linux-extras | grep "php8" _ php8.0 available [ =stable ]

AlekMosingiewicz commented 2 years ago

I second that. In addition, we get the following error: undefined symbol: executor_globals when trying to run your Elasticache-Client library for Linux. This blocks our attempts to upgrade our container to PHP 8.1, as Memcache extension is essential for our application. When are you planning to release extras for 8.1?

heathdutton commented 2 years ago

Guys you can make a pecl alias using your ebextensions like so:

    "/usr/bin/pecl":
        mode: "000755"
        owner: root
        group: root
        content: |
            #!/bin/sh
            exec /usr/bin/php -C \
                -d disable_functions=none \
                -d include_path=/usr/lib/php \
                -d date.timezone=UTC \
                -d output_buffering=1 \
                -d variables_order=EGPCS \
                -d safe_mode=0 \
                -d register_argc_argv="On" \
                /usr/lib/php/peclcmd.php "$@"
afariasfermin commented 2 years ago

I ran into this issue for a couple of month and the best solution for me to enter in peaceful state of mind was learn about containers and migrate to a docker environment. 😄

caseyw commented 2 years ago

According to the docs, version 2.0.20220805.0 contains PHP 8.1.9. When I pull the image and lookup the versions available:

$ docker run -it --rm amazonlinux:2.0.20220805.0 amazon-linux-extras list | grep php

Output: 42 php7.4 available [ =stable ] 51 php8.0 available [ =stable ]

Is this accurate based on the approach I'm taking, or am I going at this wrong?

Thanks

peachesontour commented 2 years ago

So this says PHP 8.1.11 is now available via Elastic Beanstalk: https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-10-03-linux.html

But apparently not this way: amazon-linux-extras list | grep php Output: _ php7.4 available [ =stable ] 51 php8.0=latest enabled [ =stable ]

Is there an easy way to update? Or best to migrate to AL 2022 or Ubuntu?

andres-montanez commented 2 years ago

Apparently pulling from this image amazonlinux:2022 does the trick. No need to use the extras, either.

bash-5.1# yum install -y php-cli
Last metadata expiration check: 0:02:09 ago on Sat Oct  8 15:51:09 2022.
Dependencies resolved.
=============================================================================================================================================================================================================================================================================================================
 Package                                                                Architecture                                                       Version                                                                             Repository                                                               Size
=============================================================================================================================================================================================================================================================================================================
Installing:
 php8.1-cli                                                             x86_64                                                             8.1.7-1.amzn2022.0.1                                                                amazonlinux                                                             3.5 M

Transaction Summary
=============================================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 3.5 M
Installed size: 16 M
Downloading Packages:
php8.1-cli-8.1.7-1.amzn2022.0.1.x86_64.rpm                                                                                                                                                                                                                                   1.1 MB/s | 3.5 MB     00:03
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                                                        832 kB/s | 3.5 MB     00:04
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                                     1/1
  Installing       : php8.1-cli-8.1.7-1.amzn2022.0.1.x86_64                                                                                                                                                                                                                                              1/1
  Running scriptlet: php8.1-cli-8.1.7-1.amzn2022.0.1.x86_64                                                                                                                                                                                                                                              1/1
  Verifying        : php8.1-cli-8.1.7-1.amzn2022.0.1.x86_64                                                                                                                                                                                                                                              1/1

Installed:
  php8.1-cli-8.1.7-1.amzn2022.0.1.x86_64

Complete!
bash-5.1# php -v
PHP 8.1.7 (cli) (built: Jun  7 2022 18:21:38) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.7, Copyright (c) Zend Technologies

🤘

RahulDey12 commented 2 years ago

So this says PHP 8.1.11 is now available via Elastic Beanstalk: https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2022-10-03-linux.html

But apparently not this way: amazon-linux-extras list | grep php Output: _ php7.4 available [ =stable ] 51 php8.0=latest enabled [ =stable ]

Is there an easy way to update? Or best to migrate to AL 2022 or Ubuntu?

use this syntax

rpm -i /opt/elasticbeanstalk/RPMS/php-debuginfo-8.1.8-1.amzn2.x86_64.rpm

Referance: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.container.html#php-8-1-considerations

KZeni commented 2 years ago

@andres-montanez Okay, I see that https://aws.amazon.com/amazon-linux-2/faqs/ points to Amazon Linux 2022 (AL2022) as being the successor to Amazon Linux 2 (AL2), but AL2022 is still showing as Release Candidate per https://aws.amazon.com/linux/amazon-linux-2022/.

Also, the AMI Catalog doesn't really feature it with the only match for "Amazon Linux 2022" or "AL2022" either being the one "Amazon ECS-Optimized Amazon Linux 2022 (AL2022) x86_64 AMI - PREVIEW" AMI under "AWS Marketplace AMIs" or a handful of AMIs being under the "Community AMIs" tab (it then not being in the recommended/"Quickstart AMIs" at all [likely due to it not being officially released yet.])

I think I'd prefer to stay on Amazon Linux 2 for the meantime (with the new EOL being June 30th, 2024 per their FAQs linked above) with this just needing PHP 8.1 added to Amazon Linux Extras rather than jumping over to a wholly different OS version that's not officially released yet (at least not considered ready for production environments per it still being a release candidate.) Especially considering https://docs.aws.amazon.com/linux/al2022/ug/compare-al2-to-AL2022.html shows migrating between the two not being the most seamless experience in certain ways (at least for now.)

@RahulDey12 Doesn't that method just avoid the use of Amazon Linux Extras? Ideally, I'd like to keep using the Amazon Linux Extras convention that was established for Amazon Linux 2 since we just need them to add support for new PHP versions via this tool when they're made available (especially after elastic beanstalk has it added).

It would seem odd for them to drop support for adding new versions of things to amazon-linux-extras considering that's the convention Amazon Linux 2 set up for these items with Amazon Linux 2 then saying it's still being supported through mid-2024.

As far as I can tell, we're still waiting on PHP 8.1.x to be added to Amazon Linux Extras. We technically have yet to be given a confirmation that AWS has any plans to do so (let alone provide a timeline.) They got it added to EB (~9 months after release) while mentions of amazon-linux-extras have either been effectively ignored, had existing customers say they also are waiting for it, or had people bring up ways to add PHP 8.1 that essentially avoids the use of amazon-linux-extras to do so. It's also been brought up on re:Post multiple times (also without luck when it comes to them saying they'll actually be adding PHP 8.1 to Amazon Linux 2 or not [both in providing a timeline & just saying they're planning to do it at all.])

  1. https://repost.aws/questions/QUsfhDbww4SAy8i5Jmd4vcMg/amazon-linux-2-amazon-linux-extras-php-8-1-support
  2. https://repost.aws/questions/QUYOYerObQQ36CDxBsry62Ow/how-to-request-php-8-1-to-be-added-to-amazon-linux-extras
  3. https://repost.aws/questions/QUEE13bbWpRICK4skmyN706g/when-is-php-8-1-coming-to-amazon-linux-extras
RahulDey12 commented 2 years ago

@KZeni I think the amazon-linux-extra is a wonderful way to install any version of PHP. But from PHP 8.1 I think AWS is not planning to add any future support for PHP in the amazon-linux-extras repo. So I think it's time to move on RHEL distro instead of AL2. AL2 was also an RHEL-based distro so there is not much of a change in terms of configuration. But the draw back is that RHEL distros cost more money than AL2 because of the licensing. But RHEL has wonderful support for PHP thanks to Remi Repos.

KZeni commented 2 years ago

@RahulDey12 Have they actually stated they're no longer supporting amazon-linux-extras or are you just guessing that's the case?

Also, when it comes to changing over to a different Linux distro... it's kinda like seeing people asking for an update be made to a key feature of an operating system that AWS has stated they're supporting through mid-2024 (like the case is here) and then just saying to switch operating systems as a resolution (while then only stating a specific OS/distro when there's actually a successor to the OS/distro in question [AL2 => AL2022] that would also address the issue.) Seems a bit heavy handed of a recommendation for a case like this (especially when there are other options that don't have added licensing fees, are also reasonable & reputable, and wouldn't have this issue [ex. Ubuntu, Fedora, CentOS, etc. and even the successor to Amazon Linux 2... Amazon Linux 2022 which is then based on Fedora which is then closely related to RHEL where it just needs to leave Release Candidate/Preview status.])

That said, the fact AWS (both EB & the AL2 extras) hasn't managed this very well has me looking outside of their offerings if they keep lagging behind like this (ex. Docker, using a different linux distro, etc.... possibly keep with the latest Amazon Linux distros [or possibly use Amazon ECS] while then just using Docker for the server software/environment.)

faizanakram99 commented 2 years ago

EDIT: nvm, works on fresh environment ... it was something specific to an environment which was upgraded via a command

image

Does this really work for anyone ?

when i do php -v, it shows php 8 version instead of 8.1

image

What is wrong ?

@RahulDey12 i don't see that directory, there is no RPMS directory inside /opt/elasticbeanstalk

peachesontour commented 2 years ago

It finally appeared today: amazon-linux-extras list | grep php _ php7.4 available [ =stable ] 51 php8.0=latest enabled [ =stable ] _ php8.1 available [ =stable ]

christian-manrique commented 2 years ago

i am able to upgrade my ec2 instance to php 8.1, thanks for the Support team very nice and appreciate it

$ amazon-linux-extras list | grep php
  _  php7.4                   available    [ =stable ]
 43  php8.0=latest            enabled      [ =stable ]
  _  php8.1                   available    [ =stable ]
tobiaseichert commented 1 year ago

Running the default /bin/sh -c composer.phar install --no-ansi --no-interaction inside a PHP 8.1 environment (64bit Amazon Linux 2/3.5.0) currently results in an error, e.g.

In Git.php line 484:

  Failed to clone https://git.drupalcode.org/project/coder.git, git was not f  
  ound, check that it is installed and in your PATH env.                       

  sh: git: command not found 

However, git is installed:

[ec2-user@ip-172-31-4-122 ~]$ which git
/usr/bin/git

Is this an environment related bug at deployment time? There's no problem when performing a deployment inside a PHP 7.4 environment.

RahulDey12 commented 1 year ago

New issue is coming during update

Could not retrieve mirrorlist https://amazonlinux-2-repos-ap-south-1.s3.dualstack.ap-south-1.amazonaws.com/2/extras/php8.1/latest/x86_64/mirror.list error was
14: HTTPS Error 403 - Forbidden

Looks like they have blocked access to the rpms