For hosting a dynamic website on AWS, you need to use EC2 product. S3 is only used for storage and static website hosting. Other than EC2, you can also use Lightsail, which is basically a VPS. For hosting on EC2, you will need to launch an empty and install LAMP or any PHP based stack you have on the server. If you have already launched a Drupal on it, then you can simply uninstall the Drupal files or remove them. You will then have the PHP based stack on the server only. So, that is how it can be done as well.
You can get a better understanding with the AWS Course.