Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the instance type with Elastic Beanstalk?

How can I change the instance type of an existing Elastic Beanstalk application?

Currently I am changing it in the web interface: enter image description here

I tried changing it with the command line tool: eb setenv InstanceType=t2.medium

It didn't throw an error, but also didn't change the instance type.

like image 960
ustroetz Avatar asked Apr 09 '15 09:04

ustroetz


1 Answers

The setenv command is for changing Environment Variables. Hence the command you tried is bash equivalent of:

export InstanceType=t2.medium

And doesnt really do anything for your beanstalk environment.

You can create an environment using the -i option during create

eb create -i t2.micro

Or, you can use eb config to edit a currently running environment. This will open up a text editor. Look for the section that looks like:

aws:autoscaling:launchconfiguration:
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role
    EC2KeyName: aws
    InstanceType: t1.micro

And edit the t1.micro to t2.micro. (save and quit)


But just to make your life easier, you can save the below as .elasticbeanstalk/saved_configs/default.cfg.yml and the CLI will use all these settings on all future creates.

AWSConfigurationTemplateVersion: 1.1.0.0
OptionSettings:
  aws:elb:loadbalancer:
    CrossZone: true
  aws:elasticbeanstalk:command:
    BatchSize: '30'
    BatchSizeType: Percentage
  aws:autoscaling:launchconfiguration:
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role
    EC2KeyName: aws
    InstanceType: t2.micro
  aws:elb:policies:
    ConnectionDrainingEnabled: true
  aws:autoscaling:updatepolicy:rollingupdate:
    RollingUpdateType: Health
    RollingUpdateEnabled: true
  aws:elb:healthcheck:
    Interval: '30'
like image 112
Nick Humrich Avatar answered Sep 20 '22 14:09

Nick Humrich