I made my first Craft site with MAMP locally. I am trying to get my site running on AWS but I'm having a hard time with understanding the process. Are there any good tutorials or suggestions about how to deploy it?
The trouble is, there's no one way to utilize AWS. You can set up a simple VPS, or get endlessly complicated with load-balancing multiple servers, adding CDN, utilizing cool caching options, and plenty more.
I've been fortunate enough to learn a lot from a siteops team that established all the infrastructure. It's a bit much for getting started, but the result was a combination of Route 53 for DNS, Elastic Beanstalk+Docker+EC2 for server instances, S3 for Asset sources, CloudFront for easy CDN, RDS for MySQL, and Elasticache for Redis session storage. Craft happily worked with all these things out of the box, after some trial and error. The goal wasn't to have a single server running, but discrete components that could be scaled for stability and demand.
But that's a horrendous place to get started. While I need to write a blog post about what I've learned AWS-wise, you can get started more simply by following a tutorial for another LAMP app like WordPress since most of the setup's going to be the same. If you're comfortable with Linux, or comfortable Googling your way through various tweaks, this should be a breeze. Just pretend the AWS control panel isn't hilariously daunting and you'll be fine.
If you're looking to be a Craft-AWS pro, you could experiment in steps:
Level 1: Get Craft running on a single EC2 instance
All the stuff on one box, conceptually identical to Digital Ocean or Linode or whatever. I like Ubuntu 14.04 because I'm most familiar with it, but you can pick a Linux distribution, make sure the requirements are in place, give Craft a poke, and triumphantly point a domain name to your EC2 IP.
Solspace have created a detailed guide for this.
Level 2: Sprinkle in AWS components
This will prove that adding AWS services needn't be hard. You can easily...
- Add CDN with CloudFront
- Move MySQL off of your VPS and use RDS instead
- Use Elasticache for Redis, and store PHP's sessions there by installing an extension and adding two lines to php.ini (
session.save_handler = redisand
session.save_path = tcp://your-aws-cache-url:6379)
- Use Route 53 for DNS, because why not
Level 3: Automate deployments and use multiple server instances
This is where I start to gloss over: set up Docker images and Elastic Beanstalk for automated deployments, and add multiple EC2 server instances with load balancers (and sticky sessions!) that spread out traffic. You've theoretically got many of your pieces in place after level 2, so if you can master level 3 you'll basically have your undergraduate degree in AWS.
Edit May 29, 2020
While it isn’t AWS-specific, there’s a Knowledge Base article with tips for configuring Craft for multi-server environments: https://craftcms.com/knowledge-base/configuring-load-balanced-environments