{
  "AWSTemplateFormatVersion" : "2010-09-09",
  
  "Description" : "AWS CloudFormation Sample Template ElasticBeanstalkSample: Configure and launch the AWS Elastic Beanstalk 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"
    }
  },

  "Resources" : {
    "sampleApplication" : {
      "Type" : "AWS::ElasticBeanstalk::Application",
      "Properties" : {
        "Description" : "AWS Elastic Beanstalk Sample Application",
        "ApplicationVersions" : [{
          "VersionLabel" : "Initial Version",
          "Description" : "Version 1.0",
          "SourceBundle" : {
            "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]},
            "S3Key" : "elasticbeanstalk-sampleapp.war"
          }
        }],
        "ConfigurationTemplates" : [{
          "TemplateName" : "DefaultConfiguration",
          "Description" : "Default Configuration Version 1.0 - with SSH access",
          "SolutionStackName" : "64bit Amazon Linux running Tomcat 7",
          "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 Sample Application",
         "TemplateName" : "DefaultConfiguration",
         "VersionLabel" : "Initial Version"
      }
    }
  },
  "Outputs" : {
    "URL" : {
      "Description" : "URL of the AWS Elastic Beanstalk Environment",
      "Value" : { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }
    }
  }
}

