nirmalkumarv
12/21/2016 - 3:35 PM

beanstalk-example.json

{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Description" : "Test template for creating a beanstalk environment",
  "Parameters" : {
    "VPC": {
      "Description" : "The AWS VPC to use.",
      "Type": "AWS::EC2::VPC::Id"
    },
    "SubnetA": {
      "Description" : "The Subnet in AZ A.",
      "Type": "AWS::EC2::Subnet::Id"
    },
    "SubnetB": {
      "Description" : "The Subnet in AZ B.",
      "Type": "AWS::EC2::Subnet::Id"
    },
    "SubnetC": {
      "Description" : "The Subnet in AZ C.",
      "Type": "AWS::EC2::Subnet::Id"
    },
    "KeyName": {
      "Description" : "The AWS PEM Key to use when creating instances.",
      "Type": "AWS::EC2::KeyPair::KeyName"
    },
    "URLPrefix" : {
      "Description" : "The Prefix for the websites URL. The URL will be 'prefix.elasticbeanstalk.com'. A CNAME/Route53 can be used to turn this into a 'friendly' domain name",
      "Type" : "String",
      "MinLength" : "4",
      "MaxLength" : "23",
      "AllowedPattern" : "[a-zA-Z0-9-]+",
      "ConstraintDescription" : "Must be from 4 to 23 characters in length, can contain only letters, numbers, and hyphens, and cannot start or end with a hyphen."
    }
  },
  "Resources" : {
    "BeanstalkApplication" : {
      "Type" : "AWS::ElasticBeanstalk::Application",
      "Properties" : {
        "ApplicationName" : "TestApplication",
        "Description" : "Test Application",
        "ApplicationVersions" : [{
          "VersionLabel" : "Sample .NET Application",
          "Description" : "Version 1.0",
          "SourceBundle" : {
            "S3Bucket" : "elasticbeanstalk-samples-eu-west-1",
            "S3Key" : "FirstSample.zip"
          }
        }]
      }
    }, 
    "BeanstalkEnvironment" : {
      "Type" : "AWS::ElasticBeanstalk::Environment",
      "Properties" : {
        "ApplicationName" : { "Ref" : "BeanstalkApplication" },
         "Description" :  "AWS Elastic Beanstalk Environment running Demo Application",
         "SolutionStackName" : "64bit Windows Server 2012 R2 running IIS 8.5",
         "EnvironmentName" : "TestSite",
         "CNAMEPrefix" : { "Ref" : "URLPrefix" },
         "OptionSettings" : [
           {"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName" : "EC2KeyName", "Value" : { "Ref" : "KeyName" }},
           {"Namespace" : "aws:ec2:vpc", "OptionName" : "VPCId", "Value" : { "Ref" : "VPC" }},
           {"Namespace" : "aws:ec2:vpc", "OptionName" : "Subnets", "Value" : { "Fn::Join" : [ ",", [ { "Ref" : "SubnetA" }, { "Ref" : "SubnetB" }, { "Ref" : "SubnetC" } ] ] } },
           {"Namespace" : "aws:ec2:vpc", "OptionName" : "ELBSubnets", "Value" : { "Fn::Join" : [ ",", [ { "Ref" : "SubnetA" }, { "Ref" : "SubnetB" }, { "Ref" : "SubnetC" } ] ] } },
           {"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName":"InstanceType", "Value" : "t2.micro" },
           {"Namespace" : "aws:ec2:vpc", "OptionName":"AssociatePublicIpAddress", "Value":"true" },
           {"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"MaxBatchSize", "Value": "1" },
           {"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"MinInstancesInService", "Value": "1" },
           {"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"PauseTime", "Value": "PT5M30S" },
           {"Namespace" : "aws:autoscaling:updatepolicy:rollingupdate", "OptionName":"RollingUpdateEnabled", "Value": "true" },
           {"Namespace" : "aws:elasticbeanstalk:command", "OptionName":"BatchSize", "Value": "30" },
           {"Namespace" : "aws:elb:policies", "OptionName":"ConnectionDrainingEnabled", "Value": "true" }
          ],
         "VersionLabel" : "Sample .NET Application"
        }
      }
    }
  }