AWS EB: Unresolved resource dependencies

戏子无情 提交于 2020-07-03 17:31:13

问题


My Django app is deployed and working thanks to this fantastic article: https://medium.com/@justaboutcloud/how-to-deploy-a-django3-application-on-elastic-beanstalk-python3-7-and-amazon-linux-2-bd9b8447b55

I'm to the end of the project and am setting up HTTPS. To do that, I've created a config file in my .ebextensions folder called 02_https.config

In this file, I copy and pasted the code from the article:

option_settings:
  aws:elbv2:listener:443:
    SSLCertificateArns: <YourACMCertificateARN>
    Protocol: HTTPS
Resources:
    AWSEBV2LoadBalancerListener:
      Type: 'AWS::ElasticLoadBalancingV2::Listener'
      Properties:
        LoadBalancerArn: { "Ref" : "AWSEBV2LoadBalancer" }
        DefaultActions:
          - RedirectConfig:
              Port: 443
              Protocol: HTTPS
              StatusCode: HTTP_301
            Type: redirect
        Port: 80
        Protocol: HTTP

When I deploy the app, I get this error message:

Service:AmazonCloudFormation, Message:Template format error: Unresolved resource dependencies [AWSEBV2LoadBalancer] in the Resources block of the template

I have two theories:

  1. I'm not pasting the ARN Certificate in the correct format, which is throwing off my YAML formatting

  2. There is something wrong about this code's formatting.

Could someone please provide some input?


回答1:


To me, none of your theory seems to be correct for the error you're receiving due to a couple of reasons.

First of all, let's read the error carefully.

Service:AmazonCloudFormation, Message:Template format error: Unresolved resource dependencies [AWSEBV2LoadBalancer] in the Resources block of the template

The CFN stack backing the EB environment complaining about the unresolved dependency "AWSEBV2LoadBalancer". This means that the stack being created doesn't know what this logical id "AWSEBV2LoadBalancer" is for.

This can only happen if your beanstalk application is either:

A single instance application (no LB)

or

Using ELB (classic V1 LB) whose logical id in EB CFN stack is "AWSEBLoadBalancer" and not "AWSEBV2LoadBalancer".

The later "AWSEBV2LoadBalancer" is being used as logical id for application and network LBs.

From the medium article link you shared, I see that the author created his environment with application load balancer. Did you miss this?

eb create django3 --elb-type application --region eu-west-1 

Also the code snippet you shared is a valid YAML.



来源:https://stackoverflow.com/questions/62058404/aws-eb-unresolved-resource-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!