Amazon Web Services auto scaling over de beschikbaarheid zones

stemmen
1

Ik ben het uitvoeren van e-commerce applicatie, nu moet ik instances overspannen op basis van de auto-scaling configuraties. Momenteel ben ik het balanceren van het aantal gevallen over de beschikbaarheid van zones. Om het duidelijker Ik gebruik 2 gevallen de ap-zuidoost-1a en 2 gevallen de ap-zuidoost-1b, die soortgelijke kenmerken maken.

Nu wil ik de auto-scaling configuratie mogelijk te maken, zodat ik gelijk aantal gevallen tussen de regio's te creëren. Zodat de load balancer de belasting gelijkmatig kan evenwicht tussen de beschikbaarheid van zones. Ook de belasting vermindert het gelijke aantal instanties moet worden stilgelegd in de regio.

Hoe configureer ik de auto-scaling ???

Kindly help me out.

De vraag is gesteld op 22/08/2013 om 13:34
bron van user
In andere talen...                            


1 antwoorden

stemmen
1

Je kunt niet setup Autoscaling om instanties die al bestaan ​​schaal. Je moet in principe om ze opnieuw in een lancering configuratie en vervolgens hebben Autoscaling gebruiken dat de lancering configuratie. Hier is een cloudformation sjabloon:

{
  "AWSTemplateFormatVersion" : "2010-09-09",

  "Description" : "AWS CloudFormation Template to configure chef on an EC2 Instance",

  "Parameters" : {
    "KeyName" : {
      "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
      "Type" : "String"
    }
  },

  "Mappings" : {
    "RegionMap" : {
      "us-east-1"      : { "AMI" : "ami-7f418316" },
      "us-west-1"      : { "AMI" : "ami-951945d0" },
      "us-west-2"      : { "AMI" : "ami-16fd7026" },
      "eu-west-1"      : { "AMI" : "ami-24506250" },
      "sa-east-1"      : { "AMI" : "ami-3e3be423" },
      "ap-southeast-1" : { "AMI" : "ami-74dda626" },
      "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" }
    }
  },

  "Resources" : {
    "User" : {
      "Type" : "AWS::IAM::User",
      "Properties" : {
        "Path": "/",
        "Policies": [{
          "PolicyName": "root",
          "PolicyDocument": { "Statement":[{
            "Effect":"Allow",
            "Action":"*",
            "Resource":"*"
          }
                                          ]}
        }]
      }
    },

    "HostKeys" : {
      "Type" : "AWS::IAM::AccessKey",
      "Properties" : {
        "UserName" : { "Ref": "User" }
      }
    },
    "ElasticLoadBalancer" : {
      "Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
      "Properties" : {
        "AvailabilityZones" : ["ap-southeast-1a", "ap-southeast-1b"],
        "Listeners" : [{
          "LoadBalancerPort" : "80",
          "InstancePort" : "8080",
          "Protocol" : "HTTP"
        }],
        "HealthCheck" : {
          "Target" : "HTTP:8080/jenkins/",
          "HealthyThreshold" : "3",
          "UnhealthyThreshold" : "5",
          "Interval" : "30",
          "Timeout" : "5"
        }
      }
    },

    "WebServerGroup" : {
      "Type" : "AWS::AutoScaling::AutoScalingGroup",
      "Properties" : {
        "AvailabilityZones" : ["ap-southeast-1a", "ap-southeast-1b"],
        "LoadBalancerNames" : [{"Ref" : "ElasticLoadBalancer"}],
        "LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
        "MinSize" : "1",
        "MaxSize" : "10",
        "DesiredCapacity" : "4"
      }
    },

    "LaunchConfig" : {
      "Type" : "AWS::AutoScaling::LaunchConfiguration",

      "Properties" : {
        "InstanceType" : "m1.small",
        "KeyName" : { "Ref" : "KeyName" },
        "SecurityGroups" : [ {"Ref" : "FrontendGroup"} ],
        "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
      }
    },

    "FrontendGroup" : {
      "Type" : "AWS::EC2::SecurityGroup",
      "Properties" : {
        "GroupDescription" : "Enable SSH and access to Apache and Tomcat",
        "SecurityGroupIngress" : [
          {"IpProtocol" : "tcp", "FromPort" : "8080", "ToPort" : "8080", "CidrIp" : "0.0.0.0/0"},
          {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"},
          {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "0.0.0.0/0"}
        ]
      }
    },

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

    "WaitCondition" : {
      "Type" : "AWS::CloudFormation::WaitCondition",
      "DependsOn" : "LaunchConfig",
      "Properties" : {
        "Handle" : { "Ref" : "WaitHandle" },
        "Timeout" : "1200"
      }
    }
  },

  "Outputs" : {
  }
}

Dit sjabloon zal een lancering configuratie en Autoscaling groep die ap-zuidoosten-1a en b overspant creëren. Om dit te gebruiken moet u doen 1 van 2 dingen.

  1. Maak een gouden AMI waarin alle van de code en de configuratie van de applicatie is opgeslagen op de AMI heeft. Als je deze route te gaan, moet u uw AMI om een ​​volledig werkend systeem in principe te maken wanneer zijn gelanceerd

Om dit te doen in deze cloudformation sjabloon, maak uw AMI en bewerk deze lijn met de nieuwe AMI ID:

"ap-southeast-1" : { "AMI" : "ami-74dda626" },
  1. Script uw omgeving met behulp van AWS Clouformation init of de chef-kok / pop / etc. Hier is een link met betrekking tot deze: AWS Cloudformation Init . Dit is de beste optie, maar je zult een hoop werk opbouw van de infrastructuur code nodig.

Tot slot, om autosclaing werkend te krijgen, moet u optie 1 of 2 kiezen en vervolgens de cloudformation template i geplaatst.

Het zal een load balanced 4 bijvoorbeeld omgeving die zal worden verspreid outa ap-zuidoosten-1 a en b creëren

antwoordde op 22/08/2013 om 14:42
bron van user

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more