Giter VIP home page Giter VIP logo

aws-refarch-wordpress's Introduction

Hosting WordPress on AWS

Version 2.0.2

ara-wp-2.0.2


This reference architecture provides a set of YAML templates for deploying WordPress on AWS using Amazon Virtual Private Cloud (Amazon VPC), Amazon Elastic Compute Cloud (Amazon EC2), Auto Scaling, Elastic Load Balancing (Application Load Balancer), Amazon Relational Database Service (Amazon RDS), Amazon ElastiCache, Amazon Elastic File System (Amazon EFS), Amazon CloudFront, Amazon Route 53, Amazon Certificate Manager (Amazon ACM) with AWS CloudFormation.

Overview

architecture-overview

The repository consists of a set of nested templates which are run in order from the master template. Run the master template to create the entire stack, entering the appropriate parameters. Nested templates can be run individually in order, entering the appropriate input parameters for each stack.

Update

Please refer to history.md for a detailed list of changes in 2.0.2.

Parameters

Steps to Run

To launch the entire stack and deploy a WordPress site on AWS, click on one of the Launch Stack links below or download the Master template and launch it locally.

You can launch this CloudFormation stack, using your account, in the following AWS Regions:

AWS Region Code Name Launch
us-east-1 US East (N. Virginia) cloudformation-launch-stack
us-east-2 US East (Ohio) cloudformation-launch-stack
us-west-2 US West (Oregon) cloudformation-launch-stack
eu-west-1 EU (Ireland) cloudformation-launch-stack
eu-central-1 EU (Frankfurt) cloudformation-launch-stack
ap-southeast-2 AP (Sydney) cloudformation-launch-stack

Select WordPress version

The version of WordPress can be selected. Possible values are latest, nightly, 4.5, 4.6, 4.7, 4.8, 4.9.

Override PHP.ini defaults by downloading an overrides ini file from Amazon S3

Create a custom .ini file that includes PHP overrides and make it publically available in an S3 bucket. These could be common overrides like memory_limit, post_max_size, upload_max_filesize, max_input_time, max_execution_time, etc. Amazon S3 object path should use https format (e.g.https://s3.amazonaws.com/aws-refarch/wordpress/latest/bits/20-aws.ini). Sample PHP overrides are below and in the samples/20-aws.ini directory.

; Enable php.ini overrides for hosting WordPress on AWS - https://github.com/awslabs/aws-refarch-wordpress

memory_limit = 128M

post_max_size = 0

upload_max_filesize = 64M

max_input_time = 60

max_execution_time = 30

Using Bastion to access Wordpress instances

From the EC2 console, navigate to Auto Scaling groups and find the Bastion launch configuration for your stack. Edit the launch configuration and set the desired instances to 1. Press Save and the Bastion instance will be created. Bastion is a gateway to your instances for enhanced security.

The Wordpress CLI is enabled on each instance, SSH into Bastion, then SSH into an instance. From the wordpress install directory /var/www/wordpress/<site directory> use the wp command to interact with your wordpress install.

Amazon EFS resources & dashboard

This AWS Cloudformation template, and nested templates, will create an Amazon EFS file system and other AWS resources to monitor and send notifications if the burst credit balance of the file system drops below predefined thresholds. These alarms and other AWS CloudWatch metrics, including a file system size custom metric are added as widgets to a CloudWatch dashboard.

Throughput on Amazon EFS scales as a file system grows. Because file-based workloads are typically spiky—driving high levels of throughput for short periods of time, and low levels of throughput the rest of the time—Amazon EFS is designed to burst to high throughput levels for periods of time. Amazon EFS uses a credit system to determine when file systems can burst. Each file system earns credits over time at a baseline rate that is determined by the size of the file system, and uses credits whenever it reads or writes data. The baseline rate is 50 MiB/s per TiB of storage (equivalently, 50 KiB/s per GiB of storage). Accumulated burst credits give the file system permission to drive throughput above its baseline rate. When a file system has a positive burst credit balance, it can burst. The burst rate is 100 MiB/s per TiB of storage (equivalently, 100 KiB/s per GiB of storage).

If your WordPress deployment accessing the file system relies on the burst throughput for normal operations, running out of burst credits could negatively impact the workload, so monitoring the file system's burst credit balance is essential. The efsalarms template will create two Amazon CloudWatch alarms that will send email notifications if the burst credit balance drops below two predefined thresholds, a 'Warning' threshold and a 'Critical' threshold. These thresholds are based on the number of minutes it would take to completely use all burst credits if the file system was being driven at the highest throughput rate possible, the permitted throughput rate. You enter these minute variables as input parameters in the Cloudformation template. The 'Warning' threshold and has a default value of 180 minutes. This means that a CloudWatch alarm will send an email notification 180 minutes before the credit balance drops to zero, based on the latest permitted throughput rate. The second alarm and notification is a 'Critical' notification and has a default value of 60 minutes. This alarm will send an email notification 60 minutes before the credit balance drops to zero, based on the latest permitted throughput rate. Permitted throughput is dynamic, scaling up as the file systems grows and scaling down as the file system shrinks. Therefore a third and fourth alarm is create that monitors permitted throughput. If the permitted throughput increases or decreases, an email notification is sent and an Auto Scaling Group will launch an EC2 instance that dynamically resets the 'Warning' and 'Critical' thresholds based on the latest permitted throughput rate. This EC2 instance will auto terminate and a new instance will launch to reset the thresholds only when the permitted throughput rate increases or decreases.

A new AWS CloudWatch dashboard is also created with some Amazon EFS, Amazon RDS, Amazon ELB, and custom metrics. Amazon EFS burst credit balance threshold alarms are also displayed if they were selected to be created.

Sample dashboard

Optional: Encrypting Amazon Aurora DB data at Rest

This reference architecture now allows you to encrypt your databases using keys you manage through AWS Key Management Service (KMS). On a database instance running with Amazon Aurora encryption, data stored at rest in the underlying storage is encrypted, as are the automated backups, snapshots, and replicas in the same cluster. Encryption and decryption are handled seamlessly so you don’t have to modify your application to access your data. When you launch this AWS Cloudformation stack, you can choose to enable database encryption via a parameter in the master template. You may use the default RDS key automatically created in your account by leaving the "Existing AWS KMS CMK for RDS" parameter empty or use a key you created using KMS to encrypt your data.

Optional: Encrypting Amazon EFS Data & Metadata at Rest

Amazon EFS integrates with AWS Key Management Service (KMS) to support encryting file system contents using AWS KMS Customer Master Keys (CMKs). In an encrypted file system, data and metadata are automatically encrypted before being written to the file system. Similarly, as data and metadata are read, they are automatically decrypted before being presented to the application. These processes are handled transparently by Amazon EFS, so you don’t have to modify WordPress to take advantage of encrypted file systems. Encryption at rest is enabled by default for file systems you create using this cloudformation template. This option is exposed as a configurable Cloudformation template parameter. 'true' creates an encrypted file system. 'false' creates an unencrypted file system. To use the AWS-managed CMK for Amazon EFS (key alias: aws/elasticfilesystem) leave the "Existing AWS KMS CMK for EFS" parameter empty. To use a specific customer-managed CMK (within this AWS account or another AWS account) enter the CMKs ARN in the "Existing AWS KMS CMK for EFS" parameter field.

Optional: Amazon Certificate Manager SSL/TLS Certificates

AWS Certificate Manager (ACM) is a service that lets you easily provision, manage, and deploy Secure Sockets Layer/Transport Layer Security (SSL/TLS) certificates for use with AWS services. SSL/TLS certificates provisioned through AWS Certificate Manager are free.

If you don't already have an SSL/TLS certificate for your domain name, it is recommended that you request one using ACM. For more information about requesting an SSL/TLS certificate using ACM, please read the AWS Certificate Manager User Guide.

Use ACM to request a certificate or import a certificate into ACM. To use an ACM certificate with CloudFront (optional input parameter), you must request or import the certificate in the US East (N. Virginia) region. To use an ACM certificate with Amazon ELB - Application Load Balancer (optional input parameter), you must request or import the certificate in the region you create the CloudFormation stack. After you validate ownership of the domain names in your certificate, ACM provisions the certificate. Use the ACM certificate Amazon Resource Name (ARN) as the optional Cloudfront and/or Public ALB ACM certificate input parameters of the master template.

Stack Creation

There are two output URLs for the master template. The WPSiteURL will take you to your new WordPress site. It will be the site domain name if you provided one, the CloudFront URL if you chose to create a CloudFront distribution, or the domain name of the public application load balancer. The second output URL will take you to the OpCache Status page for each EC2 instance in the AutoScaling group. By refreshing the page you will be able to verify OpCache has been enabled on each instance.

OPcache

OPcache is a byte-code cache engine running on each EC2 instance that caches precompiled PHP scripts that boosts performance of PHP applications like WordPress. It is recommended to use a caching engine like OpCache when serving PHP pages for a website from Amazon EFS. OPcache can be configured to store it's cache in memory or on EBS volumes.

Recommended OPcache Configuration Settings
  • Mount the EFS file system using the default Linux mount options identified in the Amazon EFS User Guide. Changing some of the activating caching options from their defaults, like actimeo, acregmax, or acdirmax may generate significantly higher metadata operations by timing out the attribute caches more frequently. Careful testing is recommended if the defaults are not used.

  • Increase the size of realpath_cache_size. Setting it to 512k is a good start but finding out how much realpath cache you’re actually using will help you fine tune this setting and be more precise. To find out how much real path cache you’re actually using, place the following php code snippet in a php file (you can use any name – for example realpathcache.php) and place it in your WordPress directory. Open a browser and point to this php file. Refresh your page multiple times. The value being returned is the amount of memory in bytes realpath cache is using. Take note of the maximum value being returned after refreshing this page multiple times. This, plus a little headroom, should be the value of the realpath_cache_size setting.

<?php
 print_r(realpath_cache_size());
?>
  • Please get the number of php files using “find . -type f -print | grep php | wc -l” in your WordPress directory. This number should be smaller than your opcache.max_accelerated_files settings. This setting controls how many PHP files, at most, can be held in memory at once. It's important that your project has LESS FILES than whatever you set this at.

  • The default value for opcache.memory consumption is 64 MB. Increasing this setting could improve performance by caching more files in memory. Consider setting this to a value of 512MB (opcache.memory_consumption=512) or more to improve performance. Testing different opcache.memory consumption values is recommended to optimize the performance for your particular workload. In case memory size turns out to be a limiting factor, the cloudformation template also configures opcache.file_cache to use local storage (an EBS or instance store volume). During testing we recommend disabling opcache.validate_timestamps so calls are not being made to the NFS server to ensure opcache’s coherency. It is not recommended that opcache.validate_timestamps be disabled in production.

To learn more about OPcache, please read http://php.net/manual/en/book.opcache.php

Offloading Static Assets

WordPress has a large partner ecosystem to further enhance the usability, performance, and ease of maintenance of WordPress deployments. Plugins, like W3-Total-Cache, allow you to leverage other AWS services like Amazon S3 and Amazon CloudFront to offload and store static content. Others may like the simplicity of storing all content on Amazon EFS and avoid installing and managing 3rd party plugins.

Setup W3-Total-Cache

The W3-Total-Cache plugin is required for the reference architecutre to have the best performance. W3 allows Offloading of static assets, and impliments memcached to cache Objects, Database Queries, ect.

To setup W3-Total-Cache, activate it in plugins (Will be installed automatically on fresh CloudFormation launch). Navigate to ElasticCache -> Memcached in AWS, find the cluster created for the stack. Copy the Configuration Endpoint (formated: wor-el-1d6494yen6xl1.xxxxxx.cfg.usw2.cache.amazonaws.com:11211). Now under performance -> General, find the following options:

  • Page Cache - enable, select Memcached
  • Minify - enable, select Disk (Minified files will be offloaded)
  • Database Cache - enable, select Memcached
  • Object Cache - enable, select Memcached
  • CDN - enable, select Amazon Cloudfront - Or Amazon Simple Storage Service
  • Fragment Cache - enable, select Memcached

Press Save All & Purge Cache

You will see errors saying 127.0.0.1:11211 not accessible. Now Inside each menu in the sidebar navigation, scroll to Memcached server option (Advanced), and paste the ElasticCache Configuration Endpoint. Press test and ensure it passes.

Under Browser Cache, enable both Set expires header and Set cache control header (When testing this may be combersome)

Under CDN, paste in a valid and uniquely created IAM Key and Secret that has access to S3 or an S3 bucket. Paste in the Cloudfront prefix that was created with the stack. Also scroll to Advanced and select Export changed files automatically

Since files will be offloaded to S3, ensure to add the S3 bucket as an origin on your CloudFront Distribution. Simply navigate to the distribution, select the Origin tab, Create Origin, Click on the Origin Domain Name text field and find the S3 bucket used for CDN. Note: This will take some time, the Distribution will be In Progress until CDN replication is complete.

Master Template

The master template receives all input parameters and passes them to the appropriate nested template which are executed in order based on conditions and dependencies. Review the template here aws-refarch-wordpress-master.yaml

AWS Resources Created:

  • Amazon Virtual Private Cloud (Amazon VPC)
  • Internet Gateway (IGW)
  • NAT Gateway (across all public subnets)
  • Amazon VPC subnets (public, private (data, web)) in all the Availability Zones (AZs) selected
  • Routing tables for public subnets - routing through IGW
  • Routing tables for private subnets - routing through NAT Gateway
  • Mulitple VPC Security Groups
  • Bastion Auto Scaling Group (launching no instances) - in public subnets (public)
  • Amazon Relational Database Service (Amazon RDS) Aurora cluster - in private subnets (data)
  • Amazon Elastic File System (Amazon EFS) file system - with mount targets in private subnets (data) w/ optional dummy data to grow the file system to achieve higher levels of throughput and IOPS
  • File System Auto Scaling Group (launching 1 instance) - to add dummy data (it auto terminates by setting ASG desired count to 0)
  • File System Auto Scaling Group (launching 1 instance) - to dynamically adjust warning and critical threshold values when the permitted throughput value changes (it auto terminates by setting ASG desired count to 0)
  • Amazon CloudWatch alarms to monitor Amazon EFS burst credit balance
  • Amazon ElastiCache cache cluster (optional) - in private subnets (data)
  • Amazon Elastic Load Balancing (Amazon ELB) Application Load Balancer (ALB) - in public subnets (public)
  • Web Auto Scaling Group (launching 2 instances) - in private subnets (web)
  • Amazon CloudFront distribution (optional)
  • Amazon Route53 DNS record set (optional)
  • Amazon CloudWatch dashboard

Input Parameters

General AWS

  • EC2 Key Name Pair
  • SSH Access CIDR block (to access bastion host)
  • Email address for WordPress administration and SNS notifications
  • Site Domain Name (e.g. 'example.com') - use this only if you will use your own custom domain name
  • Select if you want to create a DNS record set for your custom dist domain name
  • Select if you want to use a AWS CloudFront to cache images at AWS edge locations (3rd party plugins are required to leverage a CDN)
  • Enter the ARN of the AWS Certificate Manager certificate you created in us-east-1 for your custom site domain name

Network

  • Number of Avilability Zones (AZs) - from 2 to 6
  • Select the individual Availability Zones where resources will be launched (the number of selected AZs must match the number of AZs selected above)
  • VPC CIDR block
  • VPC tenancy
  • CIDR block for public subnets 1 to 6
  • CIDR block for web subnets 1 to 6
  • CIDR block for data subnets 1 to 6

File System

  • Amazon EFS performance mode
  • Encrypted file system (boolean)
  • AWS KMS Customer Master Key ARN (if enabling encryption and using customer-managed CMK)
  • Clone EFS, use the System ID of an existing EFS Filesystem. The data is copied to the Site Directory. If the Site Directory exists on the source filesystem, only the contents of the site directory are copied. So make sure if you are copying from an existing Wordpress Cloudformation template, that the site directory is the same.
  • Add dummy data to the file system to achieve higher throughput & IOPS beyond the amount of data your WordPress environment will use. This value is in GiB.
  • The instance type that will be used to dd dummy data into the file system
  • Select if you want to create alarms that send SNS notifications when the file system's burst credit balance drops below certain thresholds.
  • The instance type that will be used to dynamically adjust alarm thresholds as permitted throughput changes.
  • The 'Warning' threshold has a default value of 180 minutes. This means that a CloudWatch alarm will send an email notification 180 minutes before the credit balance drops to zero, based on the latest permitted throughput rate.
  • The 'Critical' threshold has a default value of 60 minutes. This means that a CloudWatch alarm will send an email notification 60 minutes before the credit balance drops to zero, based on the latest permitted throughput rate.

Database

  • Database Name
  • Database Master Username
  • Database Master Password
  • DB Restore from Snapshot, enter the cluster Snapshot name from the RDS console. (formatted rds:wordpress-stack-name-rds-xxxxxxxx-databasecluster-apzdbrozmzcn-snapshot-date)
  • Database Size
  • Database Instance Class Type
  • Encrypted database storage (boolean)
  • AWS KMS Customer Master Key ARN (if enabling encryption and using customer-managed CMK)
  • Create ElastiCache cluster (boolean)
  • ElastiCache Node Type

Bastion Parameters

  • Bastion Instance Type

Web Parameters

  • Create CloudFront distribution (boolean)
  • Create Route 53 record set (boolean)
  • PHP Version (5.5, 5.6, or 7.0 - recomended)
  • Web Instance Type
  • The maximum number of instances in the web tier auto scaling group
  • The minimum (and desired) number of instances in the web tier auto scaling group

WordPress Parameters

  • WordPress Title
  • WordPress Administrator Username
  • WordPress Administrator Username Password
  • WordPress Main Language of the site
  • Wordpress Site Directory

Master Template

The master template receives all input parameters and passes them to the appropriate nested template which are executed in order based on dependencies. Review the template here aws-refarch-wordpress-master.yaml

New VPC Template

Review the template here aws-refarch-wordpress-01-newvpc.yaml

Default VPC and subnet IP ranges

The 'newvpc' stack defaults to the following network design (but these can be changed via master parameters):

Item CIDR Range Usable IPs Description
VPC 10.0.0.0/16 65,536 The whole range used for the VPC and all subnets
Web Subnet 10.0.0.0/22 1022 Private subnet in first Availability Zone
Web Subnet 10.0.4.0/22 1022 Private subnet in second Availability Zone
Web Subnet 10.0.8.0/22 1022 Private subnet in third Availability Zone
Web Subnet 10.0.12.0/22 1022 Private subnet in fourth Availability Zone
Web Subnet 10.0.16.0/22 1022 Private subnet in fifth Availability Zone
Web Subnet 10.0.20.0/22 1022 Private subnet in sixth Availability Zone
Data Subnet 10.0.100.0/24 254 Private subnet in first Availability Zone
Data Subnet 10.0.101.0/24 254 Private subnet in second Availability Zone
Data Subnet 10.0.102.0/24 254 Private subnet in third Availability Zone
Data Subnet 10.0.103.0/24 254 Private subnet in fourth Availability Zone
Data Subnet 10.0.104.0/24 254 Private subnet in fifth Availability Zone
Data Subnet 10.0.105.0/24 254 Private subnet in sixth Availability Zone
Public Subnet 10.0.200.0/24 254 Public subnet in first Availability Zone
Public Subnet 10.0.201.0/24 254 Public subnet in second Availability Zone
Public Subnet 10.0.202.0/24 254 Public subnet in third Availability Zone
Public Subnet 10.0.203.0/24 254 Public subnet in fourth Availability Zone
Public Subnet 10.0.204.0/24 254 Public subnet in fifth Availability Zone
Public Subnet 10.0.205.0/24 254 Public subnet in sixth Availability Zone

Security Groups Template

Review the template here aws-refarch-wordpress-02-securitygroups.yaml

Bastion Template

Review the template here aws-refarch-wordpress-03-bastion.yaml

Amazon EFS File System Template

Review the template here aws-refarch-wordpress-03-efsfilesystem.yaml

Amazon EFS Alarms Template

Review the template here aws-refarch-wordpress-03-efsalarms.yaml

Amazon ElastiCache Template

Review the template here aws-refarch-wordpress-03-elasticache.yaml

Amazon Elastic Load Balancing - Application Load Balancer Template

Review the template here aws-refarch-wordpress-03-publicelb.yaml

Amazon RDS Template

Review the template here aws-refarch-wordpress-03-rds.yaml

Amazon CloudFront Template

Review the template here aws-refarch-wordpress-04-cloudfront.yaml

WordPress Web Template

Review the template here aws-refarch-wordpress-04-web.yaml

Amazon Route 53 Template

Review the template here aws-refarch-wordpress-05-route53.yaml

Amazon CloudWatch Dashboard Template

Review the template here aws-refarch-wordpress-06-dashboard.yaml

Add a new item to this list

If you found yourself wishing this set of frequently asked questions had an answer for a particular problem, please submit a pull request. The chances are that others will also benefit from having the answer listed here.

License Summary

This sample code is made available under the MIT-0 license. See the LICENSE file.

It relies on WordPress and OPcache:

  • WordPress is licensed under the General Public License (GPLv2 or later) from the Free Software Foundation.

  • OPcache is licensed under PHP License, version 3.01.

aws-refarch-wordpress's People

Contributors

arthurngatatpems avatar ashmartian avatar darrylsosborne avatar hyandell avatar perryjj-aws avatar srobin9 avatar zoltak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-refarch-wordpress's Issues

[Request] PHP5 rather than PHP7

More of a [Feature Request] than an Issue.

Our Website is not compatible with our existing site. therefore a request to choose different versions of PHP in my case version PHP5.6

Parameter misspelling

DatabaseEncrpytedBoolean & EfsEncrpytedBoolean parameters are spelled incorrectly in the templates. The templates with the incorrect spelling appear to be:

  • aws-refarch-wordpress-master-newvpc.yaml
  • aws-refarch-wordpress-03-efsfilesystem.yaml
  • aws-refarch-wordpress-03-rds.yaml
  • as well as in the sample parameter json file.

How to SSH In To Change Server Php Ini

I can seem to find any IP to ssh in to change the PHP ini to allow more than 2mbs for upload, is this just pigeonholed to be used as is or is there any room to customize. I was looking for the bastion ip to be able to up the limit server side. Also to change the wp-config without the use of a plugin, becuase that can get shaky at times.

EFS performance

Due to EFS credit balance can be a correct way split wp-content to EFS and EBS and apply versionising for plugins?

Site Latency

Happy New Year Darryl,

Background reference issue #7.

I ran v2.01 of the template without any issues, then imported/migrated an existing Wordpress site (mysite.com) into this new CloudFormation template site (newsite.mysite.com); however, I now have significant latency issues on newsite.mysite.com that I do not have on my original mysite.com (noting, mysite.com is a single t2.medium instance site).

The latency immediately causes instances to fail the Health Check, starting a cycle of termination & launching of instances--changing "HealthCheckType: ELB" to "HealthCheckType: EC2" keeps this in check for now.

In my prior attempt on v1.0 of the template (issue #7), I was definitely running into the Burst Credit issue, which now based on 75GiB of dummy data and my interpretation of the Dashboard Widgets, appears not to be an issue in this most recent attempt on V2.01.

In reviewing the Safari web inspector, there is a significant difference in Time to First Byte: mysite.com <1 seconds, newsite.mysite.com could be anywhere from 7-15+ seconds. Then, the page loads very quick on mysite.com and is long on newsite.mysite.com.

Before I re-engage AWS Tech Support, I wanted to check in here...

Darryl, I would welcome your collaboration and/or your guidance on how to narrow down root cause--any thoughts or suggestions?

Anyone else have a similar experience that they resolved and could share some thinking here?

Very much see the value in this Architecture and can't wait to get it fully functional for our business needs.

Thank you, Mike

Script is broken in it's current state

I just ran this today to see if this would work for my needs. It created everything without any issues but I am not able to access the site.

I opted out of having the DNS entry added as this fails due to this already being setup in Route53. So I added the Cloudfront DNS to the DNS record manually. Either way, the Cloudfront DNS does not work (site won't load even when visiting that directly). I thought this may be due to me using a cert so I updated the DNS record for the domain to use the Cloudfront DNS but still nothing.

I am getting the error:

ERROR
The request could not be satisfied.
CloudFront wasn't able to connect to the origin. 

When I go to the ELB DNS, the site loads with no CSS applied. Further analyis shows that all requests to any wordpress pathing failed (no 50x or 40x errors). Playing with the Dashboard, I am seeing a 100% Cloudfront error (50x) rate.

It appears there are 2 issues happening here.

  1. ELB is not able to load the assets, can only output text that is rendered
  2. Cloudfront is not able to communicate to ELB (assume SG issue)

I also noted that CloudFront is not configured to pass WordPress cookies so you will have user content mismatch if you use the login system. (although I did see coloudfront with 0 for TTL which I assume is a work-a-round for this issue... I am concerned why this is "best Practice" as this is just a waste of money and passing the cookies seems a better fit) I use this for my WP CloudFront and this works very well: https://aws.amazon.com/blogs/startups/how-to-accelerate-your-wordpress-site-with-amazon-cloudfront/

At this point, I think this is a little much for my needs so I won't be looking further into this. I just wanted to report this as it is not in a working state. I hope this helps. Thanks for all your work, this is really great.

[Feature Consideration] Bastion Instance Type Configuration

Feature Consideration:

For your consideration, you may want to you expose the Bastion Instance Type as a configuration element before the user runs the CloudFront Template (currently, it just defaults to t2.large within the Yaml file).

I realized it had a large server after the Templates ran. I changed it via making a copy of the Launch Configuration and reassigning the revised configuration to the ASG; but, thought it would be a nice extension to your comprehensive Template.

ELB Health Check Issue

When I run the Master Template, it fails and does a rollback at the point of the Web Template. As such, I ran the Templates individually successfully until I run the Web Template where it fails and does a rollback (of just the web template).

The issue is new instances fail the Health Check, and as a result, the ASG launches another EC2 instance, another fails, it launches a new instance, etc... hence, causing the Web Template to fail and rollback.

As a result, I changed the Web Template from "HealthCheckType: ELB" to "HealthCheckType: EC2" and the Web Template runs successfully to completion and the ASG does not continually launch instances. As such, it appears the Heath Check is not visible from the ELB as it should be.

Aside from the above modification, the only other modification I made to the Templates was changing the subnet IP ranges from 10.0.x.x/xx to 10.10.x.x/xx. in the VPC Template.

Is there some other configuration I need to make as a result of adjusting the CIDR ranges? or are there any other configuration I need to make in the AWS Console for these Templates to execute in totality?

Would appreciate any/all guidance and thoughts re how to get the Health Check from the ELB working.

Thank you, Mike

Github out of sync with AWS

If you grab the templates from S3 (e.g., https://s3.amazonaws.com/aws-refarch/wordpress/latest/templates/aws-refarch-wordpress-04-web.yaml), there are big diffs vs. the master head here on GitHub. At a minimum, AFAICT, there's no longer any attempt to install W3 Total Cache (so #52 should be re-opened and #49 doesn't work as a patch against the code on AWS).

It would be great if whatever is actually on s3 could get pulled into the repository, and if the documentation could be updated accordingly.

Sample or void parameters file

Hi,

First of all, thank you for the great job. We are planning to build our new institutionnal website on wordpress and this set of template will be a great help.

Can you provide a parameters json file in a sample folders please ?

Amazon Elastic File System (EFS) - How To Access Files

This project is an excellent starter-kit to help someone (me) with novice experience to build a production-ready AWS environment with minimal effort--thank you! With that said, I'm having a difficult time accessing the files stored on the EFS from a NFS client on my mac. Ideally, I am looking for an easy solution similar to FTP, where I can connect to an EFS server to CRUD files included in the WordPress distribution, but I don't know where to start. On a similar note, I successfully implemented "W3 Total Cache" per the instructions found in this document: http://d0.awsstatic.com/whitepapers/deploying-wordpress-with-aws-elastic-beanstalk.pdf (page 23). I attached an S3 Origin to my CloudFront distribution, now I can access the wp-includes and wp-content folders directly from my FTP client, Transmit, that supports S3. I would like to access EFS in a similar fashion to FTP, please help.

Terminates and Rollback on Route 53 setup

Hello,

I've tried to utilise this stack twice without success. As soon as it tries to set up the Route 53 section it fails, terminates and rolls back. I'm trying to set it up in ap-southeast-2 using the launch button. Whilst I'm no AWS expert I can't see what I might be doing wrong.

Also, I note whilst ap-southeast-2 is listed as supported in the description here, it is not listed in the CloudFormation stack description, only the other regions are. Any advice is appreciated.

Nathan
Stack Detail.pdf

Help with updating wordpress

Hello Folks,

I tried to update an available update from WordPress, but when I did it, my current ec2 instance was terminated and another one was initialized.

Is not possible to update wp? Tips?

problems with Web sub stack

I have tried to kick off the stac creation. Everything looks fine until the stack rolls back with the following error.

It feels like the instances aren't given enough time to start up.

Any guidance appreciated.

Received 1 SUCCESS signal(s) out of 2. Unable to satisfy 100% MinSuccessfulInstancesPercent requirement
19:44:21 UTC+1100	UPDATE_IN_PROGRESS	AWS::AutoScaling::AutoScalingGroup	WebAutoScalingGroup	Failed to receive 1 resource signal(s) for the current batch. Each resource signal timeout is counted as a FAILURE.
19:41:44 UTC+1100	CREATE_IN_PROGRESS	AWS::AutoScaling::AutoScalingGroup	WebAutoScalingGroup	Received SUCCESS signal with UniqueId i-0b3ce92aef06b21fb
19:39:20 UTC+1100	CREATE_IN_PROGRESS	AWS::AutoScaling::AutoScalingGroup	WebAutoScalingGroup	Resource creation Initiated

ASG stuck in a loop when using ELB health check

I'm not sure if the issue I'm seeing is related to either issue #25 or #7 so I'll add the steps to duplicate.
I have a fresh install of the Wordpress application (used for AWS training purposes only). I've used t2.micro instances for the WP EC2 instances, and have db.t2.small instances for RDS. I also loaded it with 1 GB of sample data.

I have not put any load against the application.

What I wanted to test and learn more about is the use of Auto Scaling Health Checks, and specifically the difference when using the EC2 vs. ELB health check option. My understanding is that with the ELB option, if a health check fails then the instance will be terminated and new instance created. The WP architecture is configured to use the ELB health check option. The target group for the WP EC2 instances uses a health check that looks for /wp_login.php.

To simulate the failure, I logged in to one of my WP EC2 instances and changed the name of the health check file from wp_login.php to wp_login0.php, and then logged out. I was expecting that instance to be terminated and a new instance created.

I got busy with another task, and when I came back to the EC2 console about an hour later I found during that timeframe there were 13 successful launches and 13 successful terminations listed in the Activity History of the ASG, and more were in process.

I have not yet determined which setting I need to change, whether the health check grace period, the cool down setting, or if there's some other item such as the choice of instance size that was resulting in this loop. However, this was done using the default settings in the CloudFormation script and perhaps something needs to be adjusted.

Edit apache settings?

Forgive me for being somewhat new to this. How does one make a permanent change to Apache settings?

Editing apache server settings seems necessary to enable WordPress permalinks. I've noticed some plugins don't install, giving a 504 error. I suppose this has to do with apache settings as well.

Would a shell script appended to the user data section in the ec2 launch configuration be the best(only?) solution?

HTTPS can't access - How to setting cloudfront?

I am input parameter Cloudfront Certificate ARN already and run CloudFormation is COMPLETE
But i am not access web it is show 502 ERROR

Then I am set CloudFront Distributions > Origins and Origin Groups
Now : Origin Protocol Policy = HTTPS Only (can not access web 502 ERROR)
**But if **
Set : Origin Protocol Policy = HTTP Only (access web OK but can not load css & js)

I'm not sure How to setting CloudFront Distributions?
more question

  • if i am input parameter Cloudfront Certificate ARN then i must be input ALB Certificate ARN?
  • Cloudfront Certificate ARN and ALB Certificate ARN is same ?

Please advise me.

How to Connect to Aurora RDS MySQL Database with DataGrip

I'm having trouble connecting to the MySQL database with JetBrains DataGrip, here are the "Data Source Properties":

GENERAL
Host: (My Cluster Endpoint)
Port: 3306
Database: (My Database Name)
User: (My Database Username)
Password: (My Database Password)
URL: (My Cluster Endpoint):3306/(My Database Name)
general

SSH/SSL
Use SSH Tunnel: FALSE
Proxy Host: Undefined
Proxy User: Undefined
Auth Type: Undefined
Proxy Password: Undefined

Use SSL: TRUE
CA File: Undefined
Client Certificate File: Undefined
Client Key File: (My_Security_Group_PEM_File.pem)
ssh-ssl

I can't figure out what I'm doing wrong here, please help.

Fail to create Stack

Despite several attempts, I'm unable to deploy the stack.
Here is the output that leads to a rollback :

11:37:04 UTC+0200 ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack TestDom The following resource(s) failed to create: [publicalb, efs, rds, bastion, elasticache]. . Rollback requested by user.
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom/9ab57870-6ad2-11e7-84fb-503aca2616d1
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33
  11:37:02 UTC+0200 CREATE_FAILED AWS::CloudFormation::Stack bastion
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom-bastion-1ACPD1KWG5K7/41cf0720-6ad3-11e7-be2a-500c28b4e461
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33
  11:37:02 UTC+0200 CREATE_FAILED AWS::CloudFormation::Stack elasticache
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom-elasticache-15WXD68ALIO17/41721a10-6ad3-11e7-a1fc-500c289032fe
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33
  11:37:02 UTC+0200 CREATE_FAILED AWS::CloudFormation::Stack publicalb
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom-publicalb-12T7R99A3XTRZ/41dc9bb0-6ad3-11e7-9f7c-503aca261629
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33
  11:37:02 UTC+0200 CREATE_FAILED AWS::CloudFormation::Stack efs
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom-efs-FOUIV7P1YWCS/421537e0-6ad3-11e7-805a-50d5ca6e604a
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33
  11:37:01 UTC+0200 CREATE_FAILED AWS::CloudFormation::Stack rds
  Physical ID:arn:aws:cloudformation:us-east-1:560474847061:stack/TestDom-rds-1P8GDUYQ491N7/41c89e80-6ad3-11e7-85c4-5044763dbb7b
  Client Request Token:Console-CreateStack-8372e6ab-fe26-4512-a6fd-5027b2a18a33

Master Template does NOT include parameters for DB Restore from Snapshot or Clone EFS

Launching the stack via the "Launch Stack" button does NOT prompt for:

  • Clone EFS, use the System ID of an existing EFS Filesystem.

  • DBRestore from Snapshot, enter the cluster Snapshot name from the RDS console. (formatted rds:wordpress-stack-name-rds-xxxxxxxx-databasecluster-apzdbrozmzcn-snapshot-date)

However, the individual Templates (03-efsfilesystem, 03-rds) clearly have provisions regarding the same.

Additionally, the 2 links to review the [master] template gives a 404 error.

Alarm creation flawed

The two alarms for EFS are being created concurrently, which can lead to a race condition and a fail:

  | 16:48:03 UTC+0100 | CREATE_COMPLETE | AWS::CloudWatch::Alarm | CriticalAlarm |  
  | 16:48:03 UTC+0100 | CREATE_FAILED | AWS::CloudWatch::Alarm | WarningAlarm | A separate request to update this alarm is in progress.
  | 16:48:03 UTC+0100 | CREATE_IN_PROGRESS | AWS::CloudWatch::Alarm | CriticalAlarm | Resource creation Initiated

As you can see, the create for one hasn't terminated when the other is started, leading to a failure of "A separate request to update this alarm is in progress.". Then it completes the alarm creation, but from then on, it's all rolled back of course because of the failure due to the concurrent creation. Please fix :)

Render model in Designer fails

When I try to render the model in Designer it fails with following error message :

Cannot render the template because of an error.: YAMLException: duplicated mapping key at line 292, column 32: Condition: DeployCloudFront ^

Lines 291-292 show :

    Condition: AvailableAWSRegion
    Condition: DeployCloudFront

I'm new to the syntax (first time ever using it) and I'm wondering which between these two is correct :

Condition: [ AvailableAWSRegion, DeployCloudFront ]

or

Condition:
- AvailableAWSRegion
- DeployCloudFront

Same question applies for lines 320-321 / 386-387

Rollback on Route53

Hi,

I've been trying to run the stack on eu-west-1 but it always rollback on Route53:

15:47:52 UTC+0000 | CREATE_FAILED | AWS::CloudFormation::Stack | route53 | Embedded stack arn:aws:cloudformation:eu-west-1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx was not successfully created: The following resource(s) failed to create: [RecordSet].

How can I debug this error?
I'm trying to use a subdomain like sites.mydomain.com, and I already have the hosted zone for mydomain.com created.
I didn't created the sites record on route53.

Thanks!

Network ELB

Have the option to choose between Application ELB and Network ELB.

ELB Health Check

Running 2.0.1
Min. 2 Instances
Max 4 Instances
2 AZs

ASG running ELB Health check, scaling, but I do not see any reason why. Starts 2 new instances and shuts down the original two. Caught in a loop and stops on the 5th cycle.

Issue looks to be similar to #7

Problematic amazon-elasticache-cluster-client.so

Hello, it seems that there is an error when trying to enable elastic cache client. The error I get is below

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/7.0/modules/amazon-elasticache-cluster-client.so' - /usr/lib64/php/7.0/modules/amazon-elasticache-cluster-client.so: undefined symbol: igbinary_unserialize in Unknown on line 0

I replaced the .so file with the one provided by Amazon (downloaded it today) and it works fine. So I guess the file in the stack needs to be updated.

Thanks
Christos

CANNOT Clone EFS, use the System ID of an existing EFS Filesystem

@darrylsosborne

Not withstanding issue #42, I am using the templates individually, and am having issues with the EFS template not enabling the mount to my existing EFS to then facilitate the copy to the new template EFS.

My existing EFS is in the AWS Std. VPC 172.31.x.x/16, the RefArch templates use a new VPC 10.1.x.x/16. We have successfully worked with AWS technicians to understand & resolve:

  • VPC Peering, route tables, 'DNS resolution', validated NACLs, etc.
  • EFS data load instance C5 (or M5) required by EFS to mount within VPC Peering connection

This line in the template is failing as the the DNS Name cannot be resolved: sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $COPY_SYSTEM_ID.efs.$region.amazonaws.com:/ /$COPY_SYSTEM_ID and we have been informed by AWS Engineers, that AWS does not support this DNS Resolution across VPC Peering connections. We can only manually mount across the VPC peering connection if we use an IP address.

Would welcome your assistance, thoughts, or any suggested workarounds...

Thank you, Mike

List a range of expected costs on Readme

Hello,

Thank you for taking the time to create this template and make it publicly available for use to the Wordpress/AWS communities. Could you possibly a range of expected costs for this configuration?

I understand that there are a wide variety of parameters in this template that could affect cost, so perhaps you could speak to the typical estimated costs for small, medium, large setups.. etc, etc.

The AWS calculator is a great tool for costing out a build. For someone who has never deployed a template or used the calculator, it can be difficult to set the parameters just right to get a reasonable estimate.

Thank you for consideration.

HTTPS not pass through or detected

I'm using HTTPS and when using cloudfront the system fails to detect that, so it's refrencing some content in http which then Chrome blocks. Any one else had this issue?

[question] re Migrating an existing AWS site to this new infrastructure

Thank you for the Template... this is great work! Very Much Appreciated!

All appears to be working as expected, and now, we want to run the infrastructure through its paces with the contents (users, posts, plugins, custom code, etc.) of our current singe EC2 Prod site, so I'm looking for any best practices and/or recommendations to basically replicate/promote/copy the contents of our current Prod site into this new much more complex infrastructure. Any suggestions?

Our Goal would be this new infrastructure becomes our new Prod.

Currently, our prod infrastructure is basic: Route53, Cloudfront, Single EC2 (for web & db), and S3.

Thank you, Mike

RDS Connection

We are receiving an Error establishing database connection when users try to connect. I configured the Max_connection limits to 1000, but we are still receiving the error. Disabled all of my plugins. All plugins are purchased from Envato Market. Established a WAF to prevent DDOS, since I was not sure if we may be getting hit by bots.

Multisite problems

I launched the stack and everything was working fine, but then I activated multisite option and follow the Wordpress network setup I can't open the site anymore.
When I try to login wp-login.php is fine and 200 but it also tries to load load-styles.php directly from one of the private ips that is not even up anymore.
It was the ip I used to ssh from bastion to change wp-config.
Any ideas what could be the problem?

I also checked issue #14 and added more ports to alb health check but didn't fix the problem.

Thanks

Memached doesn't seem to be installed

After running the template, I can get my site to work but W3 Total Cache's compatibility modal reports that Memcached is not installed. As such, it's not available in any of the dropdowns for caching options.

Cannot acces EC2 INSTANCE over SSH. Cannot install MEMCACHED on wordpress

Hi I just got started with AWS,one of the important things on this architecture is to be able to use memcached, using W3 Total Cache, which I cant use if I dont have installed php-memcached in the EC2 instance, and for that I need to be able to acces via ssh so as to install it, which I cannot, and I dont know why.

Every time I try to access it just says on ubuntu command line "resource temporarily unavailable"

So to check that there is not any problem with what I am doing, I launched an EC2 instance for testing purpouses, which I was able to acces through ssh with ease.

I have been going at this problem for a week now, and I am kind of desperate. I am aware that I am doing things wrong, but I dont know what is it that Im screwing up. And I have not found any solution, or similar problem online.

Any help will be much appreciated.

Thanks, Charlie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.