environment specific option_setings for beanstalk

0

I am currently working on configuring the .ebextensions file to add environment properties for my AWS Elastic Beanstalk application. So far, I have been successful in adding properties using a single .config file.

However, I have a requirement where I need to configure multiple option_settings files to accommodate different properties for different environments. For example, I have a development (dev) environment and a test environment, each requiring its own set of properties.

I am wondering if there is a way to use different settings files based on the environment I am deploying to. Ideally, I would like to achieve a similar behavior to the profile-based configuration in the Spring framework.

Any guidance or suggestions on how to accomplish this would be greatly appreciated.

Thank you in advance for your assistance.

Javeed
gefragt vor 2 Monaten255 Aufrufe
1 Antwort
0

Hello.

How about using "Fn::GetOptionSetting"?
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions-functions.html#ebextensions-functions-getoptionsetting

By using "Fn::GetOptionSetting", you can set "option_settings" as an environment variable when creating the environment.

option_settings:
  aws:elasticbeanstalk:environment:
    LoadBalancerType: application

  aws:elbv2:loadbalancer:
    IdleTimeout: 300

  aws:elbv2:listener:443:
    DefaultProcess: default
    ListenerEnabled: 'true'
    Protocol: HTTPS
    SSLCertificateArns:
      "Fn::GetOptionSetting":
        Namespace: "aws:elasticbeanstalk:application:environment"
        OptionName: "ACM_CERT_ARN"
        DefaultValue: ""
eb create --envvars "ACM_CERT_ARN=${cert_arn}" test
profile picture
EXPERTE
beantwortet vor 2 Monaten
  • I want to use the .config files differently for each env. I am wondering if we can load a config file based on the env we are deploying.

    let say i have 3 env dev, test, perf and all these have different config files, i want one of these needs to be loaded based on the beanstalk env.

  • As far as I know, I don't think that's possible. For example, if you are using CI/CD and have a configuration that copies the .config file according to the environment variables during deployment, it may be possible.

  • Okay thanks for looking into it, we can try doing at the project packaging level, to include the appropriate env file, but that still not work how exactly i wanted to do it

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen