{
  "AWSTemplateFormatVersion" : "2010-09-09",
  
  "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_PHP_Sample: Configure and launch the AWS Elastic Beanstalk PHP sample application. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.",

  "Parameters" : {
    "KeyName": {
      "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance",
      "Type": "String",
      "MinLength": "1",
      "MaxLength": "255",
      "AllowedPattern" : "[\\x20-\\x7E]*",
      "ConstraintDescription" : "can contain only ASCII characters."
    }
  },

  "Resources" : {
    "sampleApplication" : {
      "Type" : "AWS::ElasticBeanstalk::Application",
      "Properties" : {
        "Description" : "AWS Elastic Beanstalk PHP Sample Application",
        "ApplicationVersions" : [{
          "VersionLabel" : "Initial Version",
          "Description" : "Version 1.0",
          "SourceBundle" : {
            "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]},
            "S3Key" : "php-sample.zip"
          }
        }],
        "ConfigurationTemplates" : [{
          "TemplateName" : "DefaultConfiguration",
          "Description" : "Default Configuration Version 1.0 - with SSH access",
          "SolutionStackName" : "64bit Amazon Linux running PHP 5.3",
          "OptionSettings" : [{
            "Namespace" : "aws:autoscaling:launchconfiguration",
            "OptionName" : "EC2KeyName",
            "Value" : { "Ref" : "KeyName" }
          }]
        }]
      }
    },
    "sampleEnvironment" : {
      "Type" : "AWS::ElasticBeanstalk::Environment",
      "Properties" : {
        "ApplicationName" : { "Ref" : "sampleApplication" },
         "Description" :  "AWS Elastic Beanstalk Environment running PHP Sample Application",
         "TemplateName" : "DefaultConfiguration",
         "VersionLabel" : "Initial Version"
      }
    }
  },
  "Outputs" : {
    "URL" : {
      "Description" : "URL of the AWS Elastic Beanstalk Environment",
      "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }]]}
    }
  }
}

