【问题标题】:Error "Property Listeners cannot be empty" occurs when deploy ruby-on-rails project部署 ruby​​-on-rails 项目时出现错误“Property Listeners cannot be empty”
【发布时间】:2021-05-13 15:20:02
【问题描述】:

我是 AWS Cloudformation 的新手。我的 Elastic Beanstalk Worker 使用 Ruby on Rails。 EB是一个基于cloudformation模板的Stack。 不知道为什么,最近在部署(eb deploy)的时候,Event报错如下:

AWSEBLoadBalancer 不在模板的Resources: 中。但我在源代码的.ebextensions 中找到了。

Resources:
  AWSEBLoadBalancer:
    Properties:
      AccessLoggingPolicy:
        EmitInterval: 5
        Enabled: true
        S3BucketName:
          Ref: LogsBucket
    Type: "AWS::ElasticLoadBalancing::LoadBalancer"
    DependsOn: "LogsBucketPolicy"

  LogsBucket:
    DeletionPolicy: Retain
    Type: "AWS::S3::Bucket"

  LogsBucketPolicy:
    Properties:
      Bucket:
        Ref: LogsBucket
      PolicyDocument:
        Statement:
          -
            Action:
              - "s3:PutObject"
            Effect: Allow
            Principal:
              AWS:
                ? "Fn::FindInMap"
                :
                  - Region2ELBAccountId
                  -
                    Ref: "AWS::Region"
                  - AccountId
            Resource:
              ? "Fn::Join"
              :
                - ""
                -
                  - "arn:aws:s3:::"
                  -
                    Ref: LogsBucket
                  - /AWSLogs/
                  -
                    Ref: "AWS::AccountId"
        

你能给我一些提示来解决这个问题吗?

【问题讨论】:

  • 可以展示一下模板吗?
  • @Marcin 感谢您检查我的问题。我已经更新了我的问题。

标签: ruby-on-rails amazon-elastic-beanstalk amazon-cloudformation


【解决方案1】:

错误消息显示您缺少Listeners。使用Listeners,您的平衡器定义将类似于(需要修改为您自己的设置):

  AWSEBLoadBalancer:
    Properties:
      Listeners:
        - InstancePort: 80
          InstanceProtocol: HTTP
          LoadBalancerPort: 80
          #PolicyNames: 
          #  - String
          Protocol: HTTP
          #SSLCertificateId: String
      AccessLoggingPolicy:
        EmitInterval: 5
        Enabled: true
        S3BucketName:
          Ref: LogsBucket
    Type: "AWS::ElasticLoadBalancing::LoadBalancer"
    DependsOn: "LogsBucketPolicy"

【讨论】:

    猜你喜欢
    • 2015-04-07
    • 1970-01-01
    • 2013-05-25
    • 1970-01-01
    • 2012-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多