aws / elastic-beanstalk-roadmap

AWS Elastic Beanstalk roadmap
https://aws.amazon.com/elasticbeanstalk/
Creative Commons Attribution Share Alike 4.0 International
283 stars 11 forks source link

Enable reference to AWSEBWorkerQueue in a CloudFormation template #330

Open dennisvang opened 4 days ago

dennisvang commented 4 days ago

Community Note

Tell us about your request

It would be great if there were a simple way to reference the AWSEBWorkerQueue resource for a Worker environment created in a CloudFormation template.

For example, something like !GetAtt MyWorkerEnvironment.AWSEBWorkerQueue would be nice.

The docs for AWS::ElasticBeanstalk::Environment only mention EndpoinURL as a return value, so I was silently hoping that !GetAtt MyWorkerEnvironment.EndpointURL would return the SQS queue url. However, unfortunately, stack creation just fails altogether with an error:

Attribute 'EndpointURL' does not exist

Is this request specific to an Elastic Beanstalk platform?

no

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

In a single CloudFormation template that creates both a WebServer and a Worker environment, I am trying to get the worker's SQS queue url (or name), and assign it to an environment property for the webserver.

Ideally, I would like to be able to use something like Fn::GetAtt to get the SQS url from the worker resource, for example:

Resources:

  MyWorkerEnvironment:
    Type: AWS::ElasticBeanstalk::Environment
    # ...

  MyWebServerEnvironment:
    Type: AWS::ElasticBeanstalk::Environment
    DependsOn: MyWorkerEnvironment
    # ...
    Properties:
      # ...
      OptionSettings:
        - Namespace: aws:elasticbeanstalk:application:environment
          OptionName: WORKER_QUEUE
          Value: !GetAtt MyWorkerEnvironment.AWSEBWorkerQueue  # <-- this would be great, but does not work

This seems like a very basic issue that everyone using webservers and workers with cloudformation will run into at some point.

Are you currently working around this issue?

I've found, and tested, several alternatives:

These all work, but all suffer from various drawbacks.

I also noticed that the stack created by AWS::ElasticBeanstalk::Environment for the worker environment already has an output called AWSEBWorkerQueueURL. However, I could not figure out how to get that into my template.

Additional context

n/a

Attachments

n/a

dennisvang commented 3 days ago

Actually, it would be great if other resources could also be accessed from the template that defines the AWS::ElasticBeanstalk::Environment. For example, AWSEBV2LoadBalancer would be very convenient.