Exposing multiple ports from Docker within Elastic Beanstalk

后端 未结 3 1089
感情败类
感情败类 2021-01-07 16:10

From reading the AWS documentation, it appears that when using Docker as the platform on Elastic Beanstalk (EB) (as opposed to Tomcat, etc.), only a single port can be expos

3条回答
  •  太阳男子
    2021-01-07 16:51

    You could write an on-start config file for Elastic Beanstalk's LoadBalancer/ReversProxy to forward the additional ports to its EC2 instance(s). an example from Ben Delarre :

    "Resources" : {
      "AWSEBLoadBalancerSecurityGroup": {
        "Type" : "AWS::EC2::SecurityGroup",
        "Properties" : {
          "GroupDescription" : "Enable 80 inbound and 8080 outbound",
          "VpcId": "vpc-un1que1d",
          "SecurityGroupIngress" : [ {
            "IpProtocol" : "tcp",
            "FromPort" : "80",
            "ToPort" : "80",
            "CidrIp" : "0.0.0.0/0"
          }],
          "SecurityGroupEgress": [ {
            "IpProtocol" : "tcp",
            "FromPort" : "8080",
            "ToPort" : "8080",
            "CidrIp" : "0.0.0.0/0"
          } ]
        }
      },
      "AWSEBLoadBalancer" : {
        "Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
        "Properties" : {
          "Subnets": ["subnet-un1que1d2"],
          "Listeners" : [ {
            "LoadBalancerPort" : "80",
            "InstancePort" : "8080",
            "Protocol" : "HTTP"
          } ]
        }
      }
    }
    

    Ref:

    • Customizing AWS EB's ENV http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-resources.html
    • http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-elb-listenerconfig-quickref.html

提交回复
热议问题