无法在VPC中启动Elastic beanstalk

时间:2016-09-21 15:44:48

标签: amazon-web-services elastic-beanstalk

我想设置我的应用程序来处理VPC中的Elastic beanstalk,它将访问同一子网中的rds。 这是我的.ebextensions / conf.config文件:

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实例,并且它可以很好地工作。

我错过了什么?

1 个答案:

答案 0 :(得分: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命令的结果。