How to set instance type using elastic beanstalk?

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

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

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

It did not throw an error, but also did not change the type of instance.

+7
amazon-web-services elastic-beanstalk
source share
2 answers

The setenv command is for changing environment variables. Therefore, the command you tried matches the bash equivalent:

export InstanceType=t2.medium

And does nothing for your beanstalk environment.

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

 eb create -i t2.micro 

Or you can use eb config to edit the current environment. This will open a text editor. Find the section that looks like this:

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

And edit t1.micro to t2.micro. (save and exit)


But to make your life easier, you can save below .elasticbeanstalk/saved_configs/default.cfg.yml , and the CLI will use all of these settings for all future creations.

 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' 
+10
source share

More affordable scenario:

 aws elasticbeanstalk update-environment --environment-name "your-env-name" --option-settings "Namespace=aws:autoscaling:launchconfiguration,OptionName=InstanceType,Value=t2.micro" 
+2
source share

All Articles