From 27832d617e34a1d6a290437a76e397526e039291 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 17 Apr 2012 07:12:21 -0700 Subject: [PATCH] Updated WordPress_Single_Instance.template to work properly. Signed-off-by: Steven Dake --- templates/WordPress_Single_Instance.template | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/templates/WordPress_Single_Instance.template b/templates/WordPress_Single_Instance.template index 063602bc..a6917782 100644 --- a/templates/WordPress_Single_Instance.template +++ b/templates/WordPress_Single_Instance.template @@ -1,7 +1,7 @@ { "AWSTemplateFormatVersion" : "2010-09-09", - "Description" : "AWS CloudFormation Sample Template WordPress_Single_Instance: WordPress is web software you can use to create a beautiful website or blog. This template installs a single-instance WordPress deployment using a local MySQL database to store the data.", + "Description" : "AWS CloudFormation Sample Template WordPress_Multi_Instance: WordPress is web software you can use to create a beautiful website or blog. This template installs two instances: one running a WordPress deployment and the other using a local MySQL database to store the data.", "Parameters" : { @@ -92,24 +92,23 @@ }, "Resources" : { - - "WebServer": { + "WikiDatabase": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "packages" : { "yum" : { - "httpd" : [], "mysql" : [], "mysql-server" : [], + "httpd" : [], "wordpress" : [] } }, "services" : { "systemd" : { - "httpd" : { "enabled" : "true", "ensureRunning" : "true" }, - "mysqld" : { "enabled" : "true", "ensureRunning" : "true" } + "mysqld" : { "enabled" : "true", "ensureRunning" : "true" }, + "httpd" : { "enabled" : "true", "ensureRunning" : "true" } } } } @@ -125,19 +124,17 @@ "/opt/aws/bin/cfn-init\n", "# Setup MySQL root password and create a user\n", "mysqladmin -u root password '", { "Ref" : "DBRootPassword" }, "'\n", - "cat >> /tmp/mysql-wordpress-config << EOF\n", + "cat << EOF | mysql -u root --password='", { "Ref" : "DBRootPassword" }, "'\n", "CREATE DATABASE ", { "Ref" : "DBName" }, ";\n", "GRANT ALL PRIVILEGES ON ", { "Ref" : "DBName" }, ".* TO \"", { "Ref" : "DBUsername" }, "\"@\"localhost\"\n", "IDENTIFIED BY \"", { "Ref" : "DBPassword" }, "\";\n", "FLUSH PRIVILEGES;\n", "EXIT\n", "EOF\n", - "cat /tmp/mysql-wordpress-config | mysql -u root --password='", { "Ref" : "DBRootPassword" }, "' < /tmp/mysql-wordpress-config\n", - "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n", - "cp /usr/share/wordpress/wp-config.php /usr/share/wordpress/wp-config.orig\n" + "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n" ]]}} } - } + }, }, "Outputs" : { -- 2.45.2