Stop and Start Elastic Beanstalk Services

后端 未结 3 943
生来不讨喜
生来不讨喜 2021-01-07 21:54

I wanted to know if there is an option to STOP Amazon Elastic Beanstalk as an atomic unit as I can do with EC2 servers instead of going through each service (e.g. load balan

相关标签:
3条回答
  • 2021-01-07 22:21

    eb stop is deprecated. I also had the same problem and the only solution I could come up with was to backup the environment and then restore it.

    Here's a blog post in which I'm explaining it: http://pminkov.github.io/blog/how-to-shut-down-and-restore-an-elastic-beanstalk-environment.html

    0 讨论(0)
  • 2021-01-07 22:34

    If you have a load-balanced environment you can try the following trick

    $ aws autoscaling update-auto-scaling-group \
    --auto-scaling-group-name my-auto-scaling-group \
    --min-size 0 --max-size 0 --desired-capacity 0
    

    It will remove all instances from the environment but won't delete the environment itself. Unfortunately you still will pay for elastic load balancer. But usually EC2 is the most "heavy" part.

    Does it work for 0?

    yes, it does

    $ aws autoscaling describe-auto-scaling-groups --region us-east-1 \
    --auto-scaling-group-name ASG_NAME \
    --query "AutoScalingGroups[].{DesiredCapacity:DesiredCapacity,MinSize:MinSize,MaxSize:MaxSize}"
    
    [
        {
            "MinSize": 2, 
            "MaxSize": 2, 
            "DesiredCapacity": 2
        }
    ]
    
    $ aws autoscaling update-auto-scaling-group --region us-east-1 \
    --auto-scaling-group-name ASG_NAME \
    --min-size 0 --max-size 0 --desired-capacity 0
    
    $ aws autoscaling describe-auto-scaling-groups --region us-east-1 \
    --auto-scaling-group-name ASG_NAME \
    --query "AutoScalingGroups[].{DesiredCapacity:DesiredCapacity,MinSize:MinSize,MaxSize:MaxSize}"
    
    [
        {
            "MinSize": 0, 
            "MaxSize": 0, 
            "DesiredCapacity": 0
        }
    ]
    

    And then you can check environment status

    $ eb status -v
    Environment details for: test
      Application name: TEST
      Region: us-east-1
      Deployed Version: app-170925_181953
      Environment ID: e-1234567890
      Platform: arn:aws:elasticbeanstalk:us-east-1::platform/Multi-container Docker running on 64bit Amazon Linux/2.7.4
      Tier: WebServer-Standard
      CNAME: test.us-east-1.elasticbeanstalk.com
      Updated: 2017-09-25 15:23:22.980000+00:00
      Status: Ready
      Health: Grey
      Running instances: 0
    

    In the beanstalk webconsole you will see the following message

    INFO Environment health has transitioned from Ok to No Data. 
    There are no instances. Auto Scaling group desired capacity is set to zero.
    
    0 讨论(0)
  • 2021-01-07 22:40

    The EB command line interface has an eb stop command. Here is a little bit about what the command actually does:

    The eb stop command deletes the AWS resources that are running your application (such as the ELB and the EC2 instances). It however leaves behind all of the application versions and configuration settings that you had deployed, so you can quickly get started again. Eb stop is ideal when you are developing and testing your application and don’t need the AWS resources running over night. You can get going again by simply running eb start.

    EDIT:

    As stated in the below comment, this is no longer a command in the new eb-cli.

    0 讨论(0)
提交回复
热议问题