{"id":21601,"date":"2019-03-05T15:22:50","date_gmt":"2019-03-05T15:22:50","guid":{"rendered":"https:\/\/fifteen-staging.fifteen.dev\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/"},"modified":"2024-09-05T15:40:02","modified_gmt":"2024-09-05T14:40:02","slug":"elastic-beanstalk-scaling-wordpress-using-aws","status":"publish","type":"post","link":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/","title":{"rendered":"Elastic Beanstalk: Scaling WordPress Using AWS"},"content":{"rendered":"<div class=\"entry-content\"><h2>Introduction<\/h2>\n<p>It\u2019s estimated that there are some 75,000,000 (75 million) websites currently running on top of the WordPress Content Management System. Of those 75 million, it\u2019s estimated that 33% are hosted with <a title=\"Amazon Web Services (AWS)\" href=\"https:\/\/aws.amazon.com\/\" target=\"_blank\" rel=\"noopener\">Amazon Web Services<\/a>. Fifteen moved from a Dedicated Server infrastructure to a cloud based (AWS) service around 2 years ago and we haven\u2019t looked back. Downtime is virtually non-existent, our development workflow is seamless, scalability is easily accomplished and best of all, we\u2019re self reliant. Our internal Development Operations team has grown in both manpower and skillset. We\u2019re no longer in a position whereby, if we have a problem, we have to raise a support ticket and sit back and wait for help. We managed our own servers and fix our own problems, under our own timescales.<\/p>\n<p>One thing that took us a while to get our heads around was scalability, more specifically, horizontal scaling.<\/p>\n<h2>What is horizontal (and vertical) scaling?<\/h2>\n<p>Scaling in its top level form is the process of giving more hardware power to a server to allow an application to scale in size, either by demand or by traffic levels.<\/p>\n<h3>Vertical Scaling<\/h3>\n<p>The approach of giving more resource to an application by increasing the hardware power of the server in which it resides.<\/p>\n<h3>Horizontal Scaling<\/h3>\n<p>The methodology of adding more servers to your infrastructure to create a \u201ccluster\u201d.<\/p>\n<p>Vertical scaling is easily accomplished within AWS especially with the new wave of T3 burstable EC2 instances, however, automation and budget control can be hard to control.<\/p>\n<p>Horizontal Scaling is the methodology we choose to utilise at Fifteen. Easily controllable, automated and granular when it comes to budget control.<\/p>\n<h2>Why would you need automated scaling?<\/h2>\n<p>If you have an application which is heavily resource intensive, or quite simply you receive a lot of traffic any sort of basic hosting offering isn\u2019t going to cut the mustard. Think of it like a car, if you have 6 kids, 3 dogs and a partner, you\u2019re not going to fit them all in a Vauxhall Corsa. If you\u2019re wanting to drag race quarter miles at Santa Pod, you\u2019re probably going to struggle to keep up with a Nissan Micra. If you\u2019re wanting to tour the world and cover 50,000 miles in a year, what are the chances that you\u2019ll do it with no problems driving a Renault Clio? You could buy a Ferrari but that comes with a monumental price tag.<\/p>\n<p>The Ferrari metaphor would be the simplest method of covering all bases when it comes to hosting, but what if you could switch and swap cars based on the requirement at any given time and even better, you could pay for only what you use?<\/p>\n<p>Consider an <a title=\"eCommerce website development\" href=\"https:\/\/www.fifteendesign.co.uk\/website-development\/ecommerce-websites\/\" target=\"_blank\" rel=\"noopener\">eCommerce website<\/a> that sells mens shoes in the UK. Generally, your peak traffic times will be, evenings (when people have finished work) and weekends. There would be very little point in running multiple expensive servers at 3am on a Wednesday for very \u2028little return. Automated scaling allows you to run the amount of servers that your application and traffic levels require, this also means you only pay for the server run time that you utilise.<\/p>\n<h2>Exploring horizontal scaling in AWS<\/h2>\n<p>When we first started looking at implementing horizontal scaling we went down the CloudFormation (CFn) route. Initially googling CFn scripts and attempting to mould them to our own requirements. Once we had got our heads around the CFn learning curve we began writing our own scripts for deployment. This worked well initially but it soon became apparent that this methodology was going to be time consuming in terms of maintenance and upkeep. This is when we stumbled across Elastic Beanstalk.<\/p>\n<h3>What is CloudFormation (CFn)?<\/h3>\n<p><a title=\"CloudFormation (CFn)\" href=\"https:\/\/aws.amazon.com\/cloudformation\/\" target=\"_blank\" rel=\"noopener\">CloudFormation<\/a> is a lightweight, low-level abstraction over existing AWS APIs. Using a static JSON\/YAML template document, you declare a set of Resources (such as an EC2 instance or an S3 bucket) that correspond to CRUD operations on the AWS APIs.<\/p>\n<h3>What is Elastic Beanstalk (EB)?<\/h3>\n<p><a title=\"Elastic Beanstalk (EB)\" href=\"https:\/\/aws.amazon.com\/elasticbeanstalk\/\" target=\"_blank\" rel=\"noopener\">Elastic Beanstalk (EB)<\/a> is a higher-level, managed &#8216;platform as a service&#8217; (PaaS) for hosting web applications, similar in scope to Heroku. Rather than deal with low-level AWS resources directly, EB provides a fully-managed platform where you create an application environment using a web interface, select which platform your application uses, create and upload a source bundle, and EB handles the rest.<\/p>\n<p>Using EB, you get all sorts of built-in features for monitoring your application environment and deploying new versions of your application.<\/p>\n<h2>Elastic Beanstalk Infrastructure<\/h2>\n<p>When we provision a horizontal scaling infrastructure under AWS we use a multitude of their product offerings. Most can be controlled under Elastic Beanstalk. From top to bottom, here\u2019s a summary of how we utilise AWS products:<\/p>\n<h3>CloudFront<\/h3>\n<p>We utilise <a title=\"CloudFront\" href=\"https:\/\/aws.amazon.com\/cloudfront\/\" target=\"_blank\" rel=\"noopener\">CloudFront<\/a> for its content distribution network and caching capabilities.<\/p>\n<h3>EC2 (Elastic Cloud Computing)<\/h3>\n<h4>Elastic Load Balancer<\/h4>\n<p>Elastic Load balancing improves responsiveness \u2028and increases availability of applications. A load balancer sits between the client and the server cluster accepting incoming network and application traffic and distributing the traffic across multiple EC2 Instances using various methods.<\/p>\n<h4>EC2 Instance<\/h4>\n<p>An EC2 instance is a virtual server in Amazon&#8217;s Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure. AWS is a comprehensive, evolving cloud computing platform; EC2 is a service that allows business subscribers to run application programs in the computing environment.<\/p>\n<h3>RDS (Relational Database Service)<\/h3>\n<p>This is a web service that makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.<\/p>\n<h3>S3 (Simple Storage Service)<\/h3>\n<p>S3 is a scalable, high-speed, web-based cloud storage service designed for online media \/ file storage and serving. Extremely resilient and secure.<\/p>\n<h3>ACM (Amazon Certificate Manager)<\/h3>\n<p>ACM is a Private Certificate Authority (CA) is a managed private CA service that helps you easily and securely manage the lifecycle of your SSL certificates.<\/p>\n<h3>SES (Simple Email Service)<\/h3>\n<p>Amazon Simple Email Service (SES) is a cost-effective email service built on the reliable and scalable infrastructure that Amazon.com developed to serve its own customer base.<\/p>\n<h3>CloudWatch<\/h3>\n<p>Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications you run on AWS.<\/p>\n<h2>Tips and Tricks<\/h2>\n<p>Over the past couple of years, we\u2019ve provisioned dozens if not hundreds of infrastructures under Elastic Beanstalk, it\u2019s fair to say we\u2019ve learnt a trick or two. Here are a few of our favourites to help you out along the way:<\/p>\n<h3>Port Forwarding<\/h3>\n<p>Accept connections via CloudFront over port 443 (redirect HTTP to HTTPS). Connections from the load balancer to EC2 Instances should be completed over port 80 &#8211; this will alleviate AWS asking for 2 SSL certificates.<\/p>\n<h3>HTTPS = ON<\/h3>\n<p>In your application, ensure you are forcing HTTPS, your system may not know this as traffic is delivered from load balancer to ec2 instance over port 80. In PHP $_SERVER[\u2018HTTPS\u2019] = \u201con\u201d saves a lot of hardship and infinite loops.<\/p>\n<h3>Provision SSL in the correct region<\/h3>\n<p>CloudFront will only utilise SSL certificates provisioned under ACM in the North Virginia Region<\/p>\n<h3>Keep your repository lightweight<\/h3>\n<p>The manner in which Elastic Beanstalk deploys is great, it switches between application versions to accommodate zero downtime. That being said, every time you do a deployment it will upload the application in its entirety.<\/p>\n<h3>Enable Session Stickiness<\/h3>\n<p>This will keep users on the same server for the duration of their session. Otherwise, anything stored in the session will be lost whilst bouncing around servers.<\/p>\n<p>If you would like to discuss a <a title=\"New website development\" href=\"\/web-design-services\/\" target=\"_blank\" rel=\"noopener\">new website development project<\/a>, how scaling can help with the performance of your existing site or <a title=\"Website support SLA\" href=\"\/web-design-services\/website-support\/\" target=\"_blank\" rel=\"noopener\">support<\/a>, get in touch with Fifteen&#8217;s <a title=\"Contact our dedicated development team\" href=\"\/contact\/\" target=\"_blank\" rel=\"noopener noopner\">dedicated web dev team<\/a> can give you the edge over your competition.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"Introduction It\u2019s estimated that there are some 75,000,000 (75 million) websites currently running on top of the WordPress Content Management System. Of those 75 million, it\u2019s estimated that 33% are hosted with Amazon Web Services. Fifteen moved from a Dedicated Server infrastructure to a cloud based (AWS) service around 2 years ago and we haven\u2019t [&hellip;]","protected":false},"author":53,"featured_media":21602,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-21601","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Elastic Beanstalk: Scaling WordPress Using AWS - Fifteen<\/title>\n<meta name=\"description\" content=\"Discover the wonders of AWS Elastic Beanstalk to deal with increases in demands on website resources through vertical or horizontal scaling.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Elastic Beanstalk: Scaling WordPress Using AWS\" \/>\n<meta property=\"og:description\" content=\"Discover the wonders of AWS Elastic Beanstalk to deal with increases in demands on website resources through vertical or horizontal scaling.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/\" \/>\n<meta property=\"og:site_name\" content=\"Fifteen\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/FifteenDesign\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-05T15:22:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-05T14:40:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1524\" \/>\n\t<meta property=\"og:image:height\" content=\"840\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sam Doyle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sam Doyle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Elastic Beanstalk: Scaling WordPress Using AWS - Fifteen","description":"Discover the wonders of AWS Elastic Beanstalk to deal with increases in demands on website resources through vertical or horizontal scaling.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/","og_locale":"en_GB","og_type":"article","og_title":"Elastic Beanstalk: Scaling WordPress Using AWS","og_description":"Discover the wonders of AWS Elastic Beanstalk to deal with increases in demands on website resources through vertical or horizontal scaling.","og_url":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/","og_site_name":"Fifteen","article_publisher":"https:\/\/www.facebook.com\/FifteenDesign","article_published_time":"2019-03-05T15:22:50+00:00","article_modified_time":"2024-09-05T14:40:02+00:00","og_image":[{"width":1524,"height":840,"url":"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg","type":"image\/jpeg"}],"author":"Sam Doyle","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sam Doyle","Estimated reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#article","isPartOf":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/"},"author":{"name":"Sam Doyle","@id":"https:\/\/www.fifteendesign.co.uk\/#\/schema\/person\/225efe9d507c30e4cfedd9db29c618f2"},"headline":"Elastic Beanstalk: Scaling WordPress Using AWS","datePublished":"2019-03-05T15:22:50+00:00","dateModified":"2024-09-05T14:40:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/"},"wordCount":1295,"commentCount":0,"image":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg","articleSection":["News"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/","url":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/","name":"Elastic Beanstalk: Scaling WordPress Using AWS - Fifteen","isPartOf":{"@id":"https:\/\/www.fifteendesign.co.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#primaryimage"},"image":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg","datePublished":"2019-03-05T15:22:50+00:00","dateModified":"2024-09-05T14:40:02+00:00","author":{"@id":"https:\/\/www.fifteendesign.co.uk\/#\/schema\/person\/225efe9d507c30e4cfedd9db29c618f2"},"description":"Discover the wonders of AWS Elastic Beanstalk to deal with increases in demands on website resources through vertical or horizontal scaling.","breadcrumb":{"@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#primaryimage","url":"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg","contentUrl":"https:\/\/www.fifteendesign.co.uk\/wp-content\/uploads\/2022\/12\/elastic-beanstalk-server-scaling-aws.jpg","width":1524,"height":840},{"@type":"BreadcrumbList","@id":"https:\/\/www.fifteendesign.co.uk\/blog\/elastic-beanstalk-scaling-wordpress-using-aws\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fifteendesign.co.uk\/"},{"@type":"ListItem","position":2,"name":"Elastic Beanstalk: Scaling WordPress Using AWS"}]},{"@type":"WebSite","@id":"https:\/\/www.fifteendesign.co.uk\/#website","url":"https:\/\/www.fifteendesign.co.uk\/","name":"Fifteen","description":"Creative. Digital. Marketing.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fifteendesign.co.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.fifteendesign.co.uk\/#\/schema\/person\/225efe9d507c30e4cfedd9db29c618f2","name":"Sam Doyle","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/705b2bbe1c8c8f0764afb5a35b0d21a15112491f97414856494078ee8d5faf9f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/705b2bbe1c8c8f0764afb5a35b0d21a15112491f97414856494078ee8d5faf9f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/705b2bbe1c8c8f0764afb5a35b0d21a15112491f97414856494078ee8d5faf9f?s=96&d=mm&r=g","caption":"Sam Doyle"},"url":"https:\/\/www.fifteendesign.co.uk\/blog\/author\/samd\/"}]}},"_links":{"self":[{"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/posts\/21601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/comments?post=21601"}],"version-history":[{"count":0,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/posts\/21601\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/media\/21602"}],"wp:attachment":[{"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/media?parent=21601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/categories?post=21601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fifteendesign.co.uk\/wp-json\/wp\/v2\/tags?post=21601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}