Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk .ebextensions order of precedence

If I apply a setting in two config files in the .ebextensions folder does the last file override the setting in the first file?

For example take two files with instance role setting defined:

.ebextensions/0001-base.config

option_settings:
  IamInstanceProfile: aws-ec2-role

.ebextensions/0010-app.config

option_settings:
  IamInstanceProfile: aws-app-role

Which role will the Beanstalk EC2 instance be given? aws-ec2-role or aws-app-role?

like image 545
rabs Avatar asked Aug 15 '16 02:08

rabs


People also ask

What is .ebextensions in AWS Elastic Beanstalk?

You can add AWS Elastic Beanstalk configuration files ( . ebextensions ) to your web application's source code to configure your environment and customize the AWS resources that it contains. Configuration files are YAML- or JSON-formatted documents with a . config file extension that you place in a folder named .

Where are Elastic Beanstalk configuration files?

Saved configurations are stored in the Elastic Beanstalk S3 bucket in a folder named after your application. For example, configurations for an application named my-app in the us-west-2 region for account number 123456789012 can be found at s3://elasticbeanstalk-us-west-2-123456789012/resources/templates/my-app .

Does Elastic Beanstalk automatically scale?

Your AWS Elastic Beanstalk environment includes an Auto Scaling group that manages the Amazon EC2 instances in your environment. In a single-instance environment, the Auto Scaling group ensures that there is always one instance running.


1 Answers

.ebextensions are executed in alphabetical order so aws-app-role would be the final result for your IamInstanceProfile option setting.

Your syntax for the .ebextensions would cause a compilation error if you tried to deploy them, here is the correct way to do what you want.

option_settings:
      "aws:autoscaling:launchconfiguration":
          IamInstanceProfile: aws-app-role
like image 54
nbalas Avatar answered Sep 20 '22 06:09

nbalas