So I am thinking of migrating my website to Amazon S3 since it's super cheap and fast, however, I use PHP and AJAX to submit my contact forms. Would it be possible to host my site using AWS S3 and then send all HTTP POSTs to the EC2 instance?
Asked
Active
Viewed 60 times
1
-
Since cost savings is a primary goal Cloudfront may not be the right fit for your stack but I will mention it definitely solves for the "fast" delivery of your S3 content to end users. It also supports splitting requests to multiple origins, solving for your use case of static content from S3 and application processing form submits from your EC2. This example uses API Gateway rather than EC2 for form processing but shows you how to setup multiple origins on different paths if you do decide to go with Cloudfront: https://www.codeengine.com/articles/process-form-aws-api-gateway-lambda/ – Dave Maple Jan 30 '17 at 19:33
-
Thanks! I'll check this out and let you know how it works out! – David Drollinger Jan 31 '17 at 19:26
2 Answers
2
Yes, this is very well possible. However, if you're running an EC2 instance anyways and your traffic is not enormous, you might as well serve your static files from your EC2 instance.

Bram
- 4,232
- 20
- 23
0
It is not possible to host php site on AWS S3 only static content like images, css or js can be put their.
For dynamic content you have to make use of aws instance.
https://forums.aws.amazon.com/message.jspa?messageID=453142
Correct Usage of Amazon Web Services S3 for Server - Side Scripting

Community
- 1
- 1

Mohtisham Zubair
- 723
- 5
- 15