Skip to content

Dynamically setting InstanceTypes with .ebextensions is not working #175

@jeran-urban

Description

@jeran-urban

Hello,

I am having an issue trying to dynamically set the EC2's InstancTypes per environment using .ebextensions.

I have tried multiple configurations and this Stack Overflow article has a good break down of the problem with more detailed examples and some troubleshooting provided as well.

working yaml example (hard coded):

    option_settings:
        aws:ec2:instances:
            InstanceTypes: t3.small # <-- hard coded works. 

example environment variable yaml used:

    option_settings:
        aws:elasticbeanstalk:application:environment:
            ENV_INSTANCE_TYPE: t3.small

failing yaml example (using getOptionSetting fn)

    option_settings:
        aws:ec2:instances:
            InstanceTypes: {"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "ENV_INSTANCE_TYPE"}}

returns error:

    ERROR   Not a comma-separated string or array: '{"Fn::GetOptionSetting":{"Namespace":"aws:elasticbeanstalk:application:environment","OptionName":"ENV_INSTANCE_TYPE"}}'

I also tried:

  1. using custom resources.
  2. using 't3.small,t3.medium' and splitting that into 2 separate variables for the env var.
  3. using various attempts of joining/splitting the string in conjunction with the Fn::GetOptionSetting.

I do not see any issues referenced in the following documentation stating this should be an issue:

Is there something I am missing or is this not possible?

Any help with this would be greatly appreciated. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions