sagar1025
sagar1025

Reputation: 696

AWS Elasticbeanstalk CLI ignores instace type option

I have a python application that's using Flask, which I'm trying to deploy to Elasticbeanstalk using the EB CLI. I'm following the deployment steps mentioned here:

https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-flask-deploy

I ran the following commands

eb init -p python-3.6 demo-v1 --region us-west-2
eb init
eb create demo-env -it t3a.large

I got the following error

ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

I checked the eb-activity.log and found that there was a MemoryError, which occurred because there wasn't enough space to install all the packages (as specified in the requirements.txt).

I then checked the instance type and it was showing the instance type as t2.micro. I had to manually go in to the ELB console configuration -> capacity -> changed the instance type from t2.micro to t3a.large

Seems like the CLI ignored the instance type flag and it didn't throw an error or a warning. How do I specify the instance type for my application?

Upvotes: 3

Views: 215

Answers (2)

sagar1025
sagar1025

Reputation: 696

I'm posting a "workaround" since this question is still active.

I created a file called 01instance_setting.config. I added this to my .ebextensions folder. This is the content for the 01instance_setting.config

option_settings:
  aws:autoscaling:asg:
    MinSize: 1
    MaxSize: 3
  aws:autoscaling:launchconfiguration:
    RootVolumeType: gp2
    RootVolumeSize: "32"
    EC2KeyName: my-key-pair
    MonitoringInterval: "2 minute"
  aws:ec2:instances:
    InstanceTypes: t3a.large

I think this is a better way rather than specifying the instance while creating the environment from the CLI. Its much more flexible if you're creating multiple environments.

Upvotes: 0

ChaseAllbee
ChaseAllbee

Reputation: 99

I believe the option you'd want to use is -i or --instance-type. The -it option is for instance types which expects a list of instance types rather than just one. Most likely what happened was that the ebcli did not know what to make of only one instance type when it expected something like eb create demov2 -it "t2.micro, t3.micro, t3a.large"

Upvotes: 1

Related Questions