Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

(WEB302) Best Practices for Running WordPress on AWS | AWS re:Invent 2014

12,227 views

Published on

WordPress is an open-source blogging tool and content management system (CMS) that can power anything from personal blogs to high traffic websites. This session covers best practices for deploying scalable Wordpress-powered websites on AWS. Starting from one-click single-instance installations from the AWS Marketplace, we move on to Wordpress implementation details that help you make the most of AWS elasticity. We provide a blueprint architecture for high availability (Elastic Load Balancing, Auto Scaling, Amazon RDS multi-AZ). You learn how to use Amazon S3 to create a stateless web tier, how to improve performance with Amazon ElastiCache and Amazon CloudFront, how to manage your application lifecycle with AWS Elastic Beanstalk, and more.

Published in: Technology

(WEB302) Best Practices for Running WordPress on AWS | AWS re:Invent 2014

  1. 1. November 12, 2014 | Las Vegas, NV Andreas Chatzakis, Solutions Architect, AWS Chris Pitchford, Lead Platform Owner, News UK
  2. 2. DIY or AWS Marketplace $ sudo yum update -y $ sudo yum groupinstall -y "Web Server" "MySQL Database" "PHP Support" $ sudo yum install -y php-mysql $ sudo service httpd start Starting httpd: [ OK ] $ sudo chkconfig httpd on http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
  3. 3. WordPress server (Apache, MySQL) Elastic IP www.example.com Amazon Route 53 DNS service WordPress server image (AMI)
  4. 4. WordPress Server (Apache, MySQL) Elastic IP WordPress server image (AMI) www.example.com Amazon Route 53 DNS service EBS volume EBS snapshot /var/www/html/wp-config.php /var/www/html/wp-content/ /var/lib/mysql/
  5. 5. WEB401 - Optimizing Your Web Server on AWS Thursday, Nov 13, 11:00 AM - 11:45 AM Level 4 - Lando 4301A
  6. 6. S3 bucket for static assets http://<bucketname>.s3.amazonaws.com/wp-content/uploads/2014/10/aws.jpg
  7. 7. Watch 2013 re:Invent session recording: ARC309 Dynamic Content Acceleration CloudFront
  8. 8. Amazon Route 53 EC2 instance(s) S3 bucket Static content Dynamic content wp-content/* wp-includes/* wp-admin/* wp-login.php Default(*) CloudFront distribution
  9. 9. Route 53 S3 bucket Static content wp-content/* wp-includes/* CloudFront distribution m1.example.com m2.example.com m3.example.com
  10. 10. CloudFront Static Dynamic (admin) Dynamic (front end) Paths wp-content/* wp-includes/* wp-admin/* wp-login.php default (*) Protocols HTTP and HTTPS Redirect to HTTPS HTTP and HTTPS HTTP methods GET, HEAD ALL ALL Query strings YES (invalidation) YES YES Cookies NONE ALL wordpress_* wp-settings-* comment_* Headers NONE ALL CloudFront-Forwarded-Proto Cloudfront-Is-Desktop-Viewer Cloudfront-Is-Mobile-Viewer Cloudfront-Is-Tablet-Viewer /wp-content/themes/my-theme/style.css?version=3410bf
  11. 11. CloudFront Static Dynamic (admin) Dynamic (front end) Paths wp-content/* wp-includes/* wp-admin/* wp-login.php default (*) Protocols HTTP and HTTPS Redirect to HTTPS HTTP and HTTPS HTTP methods GET, HEAD ALL ALL Query strings YES (invalidation) YES YES Cookies NONE ALL wordpress_* wp-settings-* comment_* Headers NONE ALL CloudFront-Forwarded-Proto Cloudfront-Is-Desktop-Viewer Cloudfront-Is-Mobile-Viewer Cloudfront-Is-Tablet-Viewer
  12. 12. CloudFront Static Dynamic (admin) Dynamic (front end) Paths wp-content/* wp-includes/* wp-admin/* wp-login.php default (*) Protocols HTTP and HTTPS Redirect to HTTPS HTTP and HTTPS HTTP methods GET, HEAD ALL ALL Query strings YES (invalidation) YES YES Cookies NONE ALL wordpress_* wp-settings-* comment_* Headers NONE ALL CloudFront-Forwarded-Proto Cloudfront-Is-Desktop-Viewer Cloudfront-Is-Mobile-Viewer Cloudfront-Is-Tablet-Viewer
  13. 13. CloudFront
  14. 14. seafood.jpg seafood-300x225.jpg seafood-150x150.jpg
  15. 15. $_SERVER['HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER'] $_SERVER['HTTP_CLOUDFRONT_IS_TABLET_VIEWER'] $_SERVER['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER'] CloudFront
  16. 16. WordPress web server 1. If data in cache, return result 2. If not in cache, read from DB RDS database Amazon ElastiCache 3. And store in cache
  17. 17. Availability Zone a RDS DB instance ElastiCache node 1 Availability Zone b S3 bucket for static assets www.example.com Amazon Route 53 DNS service Elastic Load Balancing Web server Web server
  18. 18. Availability Zone a RDS DB instance ElastiCache node 1 Availability Zone b S3 bucket for static assets www.example.com Amazon Route 53 DNS service Elastic Load Balancing Web server Web server RDS DB standby ElastiCache node 2
  19. 19. CPU>60% CloudWatch Availability Zone a RDS DB instance ElastiCache Node 1 Availability Zone b S3 bucket for static assets www.example.com Amazon Route 53 DNS service Elastic Load Balancing RDS DB standby ElastiCache Node 2 Web server Web server
  20. 20. Web server Web server Web server Web server Alarm Auto Scaling Availability Zone a RDS DB instance Availability Zone b S3 bucket for static assets www.example.com Amazon Route 53 DNS service Elastic Load Balancing RDS DB standby ElastiCache Node 1 ElastiCache Node 2
  21. 21. Web server Web server Web server Web server Availability Zone a RDS DB instance ElastiCache node 1 Availability Zone b S3 bucket for static assets www.example.com Amazon Route 53 DNS service Elastic Load Balancing RDS DB standby ElastiCache node 2 RDS read replica RDS read replica
  22. 22. $_SERVER["RDS_DB_NAME"] $_SERVER["RDS_USERNAME"] $_SERVER["RDS_PASSWORD"] $_SERVER["RDS_HOSTNAME"]
  23. 23. DBAppELB https://prod.elasticbeanstalk.com DBApp https://staging.elasticbeanstalk.com v1 1. Install plugin v2 2. Generate new zip file 3. Deploy in production 4. Trigger DB updates
  24. 24. November 12, 2014 | Las Vegas, NV Chris Pitchford, Lead Platform Owner, News UK
  25. 25. • Base application containing all plugins – Let website pick from menu • Plugins adhere to WordPress VIP standards – Automated testing and code review
  26. 26. • Config in DB, EC2 User Data or CloudFormation – No hard coded values • AWS credentials: IAM roles and session tokens – No IAM user credentials
  27. 27. www.site.com test-b.site.com cache.site.com
  28. 28. www.mysite.com/mywordpress/
  29. 29. Pushing to open source. Native support for Apache 2.4 and Varnish 4 (and Nginx maybe)
  30. 30. http://bit.ly/awsevals

×