{
  "AWSTemplateFormatVersion" : "2010-09-09",
  
  "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_Python_Sample: Configure and launch the AWS Elastic Beanstalk Python 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 Python Sample Application",
        "ApplicationVersions" : [{
          "VersionLabel" : "Initial Version",
          "Description" : "Version 1.0",
          "SourceBundle" : {
            "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]},
            "S3Key" : "python-sample.zip"
          }
        }]
      }
    },
    "sampleEnvironment" : {
      "Type" : "AWS::ElasticBeanstalk::Environment",
      "Properties" : {
        "ApplicationName" : { "Ref" : "sampleApplication" },
         "Description" :  "AWS Elastic Beanstalk Environment running Python Sample Application",
         "SolutionStackName" : "64bit Amazon Linux running Python",
         "OptionSettings" : [{
           "Namespace" : "aws:autoscaling:launchconfiguration",
           "OptionName" : "EC2KeyName",
           "Value" : { "Ref" : "KeyName" }
         }],
         "VersionLabel" : "Initial Version"
      }
    }
  },
  "Outputs" : {
    "URL" : {
      "Description" : "URL of the AWS Elastic Beanstalk Environment",
      "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }]]}
    }
  }
}

