2016-09-21 97 views
0

我想设置我的应用程序以使用VPC中的Elastic beanstalk,它将访问同一子网中的rds。 这里是我的.ebextensions/conf.config文件:无法在VPC中启动Elastic beanstalk

option_settings: 
    aws:ec2:vpc: 
    VPCId: "vpc-aaaaaaaa" 
    Subnets: "subnet-zzzzzzzz" 
    aws:autoscaling:launchconfiguration: 
    InstanceType: m1.small 
    SecurityGroups: "sg-xxxxxxxx" 
    EC2KeyName: provisioner 
    aws:elb:loadbalancer: 
    SecurityGroups: "sg-yyyyyyyy" 
    aws:elasticbeanstalk:application:environment: 
    NODE_ENV: development 
commands: 
    01_command: 
    command: "rpm -i https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-ami201503-95-9.5-2.noarch.rpm" 
    02_command: 
    command: "yum install postgresql95-devel -y" 

我配置了安全组,以允许来自所有:

{ 
    "SecurityGroups": [ 
     { 
      "IpPermissionsEgress": [ 
       { 
        "IpProtocol": "-1", 
        "IpRanges": [ 
         { 
          "CidrIp": "0.0.0.0/0" 
         } 
        ], 
        "UserIdGroupPairs": [], 
        "PrefixListIds": [] 
       } 
      ], 
      "Description": "Security group for API server in EBS", 
      "IpPermissions": [ 
       { 
        "PrefixListIds": [], 
        "FromPort": 0, 
        "IpRanges": [ 
         { 
          "CidrIp": "0.0.0.0/0" 
         } 
        ], 
        "ToPort": 64000, 
        "IpProtocol": "tcp", 
        "UserIdGroupPairs": [] 
       } 
      ], 
      "GroupName": "api_ebs_dev", 
      "VpcId": "vpc-aaaaaaaa", 
      "OwnerId": "092511111111", 
      "GroupId": "sg-xxxxxxxx" 
     }, 
     { 
      "IpPermissionsEgress": [ 
       { 
        "IpProtocol": "-1", 
        "IpRanges": [ 
         { 
          "CidrIp": "0.0.0.0/0" 
         } 
        ], 
        "UserIdGroupPairs": [], 
        "PrefixListIds": [] 
       } 
      ], 
      "Description": "Security group for API ELB", 
      "IpPermissions": [ 
       { 
        "PrefixListIds": [], 
        "FromPort": 0, 
        "IpRanges": [ 
         { 
          "CidrIp": "0.0.0.0/0" 
         } 
        ], 
        "ToPort": 64000, 
        "IpProtocol": "tcp", 
        "UserIdGroupPairs": [] 
       } 
      ], 
      "GroupName": "api_lb_dev", 
      "VpcId": "vpc-aaaaaaaa", 
      "OwnerId": "09251111111", 
      "GroupId": "sg-yyyyyyyy" 
     } 
    ] 
} 

而看到以下错误:

2016-09-21 14:20:03 INFO Added instance [i-d206f766] to your environment. 
2016-09-21 14:30:02 WARN Environment health has transitioned from Pending to Severe. Initialization in progress (running for 12 minutes). None of the instances are sending data. ELB health is failing or not available for all instances. 
2016-09-21 14:35:43 ERROR The EC2 instances failed to communicate with AWS Elastic Beanstalk, either because of configuration problems with the VPC or a failed EC2 instance. Check your VPC configuration and try launching the environment again. 
2016-09-21 14:35:46 ERROR Stack named 'awseb-e-5sccvbi2wa-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBInstanceLaunchWaitCondition]. 
2016-09-21 14:35:49 INFO Launched environment: devtest. However, there were issues during launch. See event log for details. 

在同时,我可以在该vpc和子网中成功创建ec2实例,并且工作完美。

我错过了什么?

回答

0

可能是因为rpm包:

https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-ami201503-95-9.5-2.noarch.rpm 

就不再出现了。如果您登录到该实例,并检查文件:

/var/log/eb-commandprocessor.log 

您可以看到您的自定义.ebextensions命令的结果。

+0

同样的事情没有安装的应用程序。我设置VPC时无法正确创建。但我需要它能够连接到RDS –

+0

您是否尝试从.ebextensions/conf.config中删除命令?创建实例会失败,因为你试图安装的rpm包不在那里,并且返回404。 – duckworth

+0

是的。它没有改变 –