Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments. They generate extra noise for issue followers and do not help prioritize the request.
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:
the manual approach: create the stack, copy the SQS queue url, and paste it into an environment property (or hardcode it)
worker_queue = None
client = boto3.client('elasticbeanstalk', region_name='eu-west-3')
response = client.describe_environment_resources(EnvironmentName='<name of my worker env>')
for queue in response['EnvironmentResources']['Queues']:
if queue['Name'] == 'WorkerQueue':
worker_queue = queue['URL']
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.
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.
Community Note
Tell us about your request
It would be great if there were a simple way to reference the
AWSEBWorkerQueue
resource for aWorker
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: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 aWorker
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: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:
env.yaml
, to link the environments, as in the example:ElasticBeanstalk.Client.describe_environment_resources()
fromboto3
in the app (or use the aws cli equivalent), for example (simplified):use
.ebextensions
to export the value ofAWSEBWorkerQueue
to CloudFormation, then useFn::ImportValue
in the CloudFormation template, as in:.ebextensions/resources.config
and in
my-cloudformation-template.yml
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 calledAWSEBWorkerQueueURL
. However, I could not figure out how to get that into my template.Additional context
n/a
Attachments
n/a