Cfn

 view release on metacpan or  search on metacpan

t/cfn_json/WordPress_Multi_AZ.json  view on Meta::CPAN


          "/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r LaunchConfig ",
          "         --region ", { "Ref" : "AWS::Region" }, "\n",
          "/opt/aws/bin/cfn-signal -e $? '", { "Ref" : "WaitHandle" }, "'\n",

          "# Setup correct file ownership\n",
          "chown -R apache:apache /var/www/html/wordpress\n",
          
          "# Add keys and salts to the config file\n",
          "wp_config=/var/www/html/wordpress/wp-config.php\n",
          "GET https://api.wordpress.org/secret-key/1.1/salt/ >> $wp_config\n",
          "echo \"define('WPLANG'            , '');\" >> $wp_config\n",
          "echo \"define('WP_DEBUG'          , false);\" >> $wp_config\n", 
          "echo \"\\$table_prefix  = 'wp_';\" >> $wp_config\n",
          "echo \"if ( !defined('ABSPATH') )\" >> $wp_config\n",
          "echo \"    define('ABSPATH', dirname(__FILE__) . '/');\" >> $wp_config\n",
          "echo \"require_once(ABSPATH . 'wp-settings.php');\" >> $wp_config\n"
        ]]}}
      }
    },

    "WaitHandle" : {
      "Type" : "AWS::CloudFormation::WaitConditionHandle"
    },

    "WaitCondition" : {
      "Type" : "AWS::CloudFormation::WaitCondition",
      "DependsOn" : "WebServerGroup",
      "Properties" : {
        "Handle" : {"Ref" : "WaitHandle"},
        "Timeout" : "300"
      }
    },

    "DBInstance" : {
      "Type": "AWS::RDS::DBInstance",
      "Properties": {
        "DBName"            : { "Ref" : "DBName" },
        "Engine"            : "MySQL",
        "MultiAZ"           : { "Ref": "MultiAZDatabase" },
        "MasterUsername"    : { "Ref" : "DBUsername" },
        "DBInstanceClass"   : { "Ref" : "DBClass" },
        "DBSecurityGroups"  : [{ "Ref" : "DBSecurityGroup" }],
        "AllocatedStorage"  : { "Ref" : "DBAllocatedStorage" },
        "MasterUserPassword": { "Ref" : "DBPassword" }
      }
    },

    "DBSecurityGroup": {
      "Type": "AWS::RDS::DBSecurityGroup",
      "Properties": {
        "DBSecurityGroupIngress": [{ "EC2SecurityGroupName": { "Ref": "WebServerSecurityGroup"} }],
        "GroupDescription"      : "Frontend Access"
      }
    },


    "WebServerSecurityGroup" : {
      "Type" : "AWS::EC2::SecurityGroup",
      "Properties" : {
        "GroupDescription" : "Enable HTTP access via port 80 locked down to the load balancer + SSH access",
        "SecurityGroupIngress" : [
          {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"]},"SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "Source...
          {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}}
        ]
      }
    }
  },

  "Outputs" : {
    "WebsiteURL" : {
      "Value" : { "Fn::Join" : ["", ["http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}, "/wordpress"]] },
      "Description" : "WordPress Website"
    }
  }
}



( run in 1.311 second using v1.01-cache-2.11-cpan-5735350b133 )