Whilst as you can use AWS to provide standalone servers, if you wish to support multiple instances, load balancing etc, you’ll want to separate things out. At the most basic level you’ll likely want to be using:
- S3 – persistent storage
- RDS – MySQL database
- EC2 – Apache / Nginx, PHP front end
You can then augment this with:
- Cloudfront – localised delivery of your S3 content
- Loadbalancer – ensure your EC2 instances are used optimally
- Auto scaling – start / stop new instances
- Route 53 – DNS
- VPC – important as this offers security, single front ends for SSL certificates etc.
Also, rather than start from scratch you can use AMI’s from the marketplace:https://aws.amazon.com/marketplace/
Checkout the AWS getting started guide as this goes through everything in detail:http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/web-app-hosting-intro.html
Using the above, I’d suggest moving your database to RDS and simply hosting Apache on your EC2 instances. You might even find this is cost effective too as you’ll be able to utilise small instances given the lower memory / CPU requirements.
Also, as time progresses, you can start to look at Elastic Beanstalk and Chef (maybe even vagrant for local dev boxes), Elastic Beanstalk (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_symfony2.html)
first up, environments
I’m assuming you’ve created production and development environments:http://symfony.com/doc/current/cookbook/configuration/environments.html. This is important as you are able to change configuration between local and production environments.
Checkout https://github.com/liip/LiipImagineBundle/blob/master/Resources/doc/data-loader/stream.md which utilises https://github.com/KnpLabs/Gaufrette (or the bundle:https://github.com/KnpLabs/KnpGaufretteBundle).
There appears to be a good article on how to configure it here: https://florian.ec/articles/upload-files-to-amazon-s3-with-symfony2-and-gaufrette/
Using the above environments, you’d be able to configure production to read/write to s3, whereas developments write to /tmp (for example)
I’m going to make an assumption that you’re using Doctrine as your DB connection and have followed the Symfony docs on how to set up the configuration:http://symfony.com/doc/current/book/doctrine.html#configuring-the-database.
All you’d need to do is follow the environment logic and set the db strings production / local accordingly. This should be seamless in the background and not require manual MySQL connections.