在AWS上托管角色应用程序使用php

I'm new to AWS. I created a DB and I am currently hosting the website right now. This is great!

The problem is that I don't know how to integrate my PHP files that I was using before the start of AWS.

My previous stack was: Angular, MyPHP, MySQL, Apache. Everything was running locally. So I was able to use the same IP for the database and to also run php files.

What I tried to do was upload the php files into the S3 bucket. This doesn't work. The website will only download the file and not execute.

So how would I implement the same fluid way of integrating PHP on AWS as I did on my local computer?

If you want to do this on AWS you will need an EC2 instance to run your dynamic queries to the database. S3 will only host static files or programming which works on the client-side (JavaScript).

If it is a basic website, you might want to consider LightSail

My suggestions would be,

  1. use EC2 instead of using s3 for hosting the PHP website as you can have complete control over the server.
  2. For setting up EC2 with PHP please follow the steps in the following article. Setting up EC2(ubuntu instance) for php