I'm trying to create a new ElasticBeanstalk application with an Application Load Balancer. I'm calling the following commands:
$ mkdir HelloWorld
$ cd HelloWorld
$ eb init
$ echo "Hello World" > index.html
$ eb create dev-env --elb-type application
Output of the last command results in this error:
Creating application version archive "app-170821_175709".
Uploading HelloWorld/app-170821_175709.zip to S3. This may take a while.
Upload Complete.
ERROR: Configuration validation exception: Invalid option value: 'null' (Namespace: 'aws:ec2:vpc', OptionName: 'ELBSubnets'): Specify the subnets for the VPC for load balancer type application.
Any ideas what is wrong with my VPC? I am using the default VPC for this region.
UPDATE:
I've made further progress, but am still not able to get the ALB set up correctly. I've added a few parameters to my eb create
command:
eb create staging-env --elb-type application --vpc.id vpc-1234604b --vpc.publicip --vpc.ec2subnets subnet-12340aa2 --vpc.elbsubnets subnet-12340aa3,subnet-12341966 --vpc.securitygroup sg-1234ac01 --vpc.elbpublic
But I'm still getting the following error:
ERROR: Stack named 'awseb-e-ifnuqgmbah-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBV2LoadBalancer].
ERROR: Creating load balancer named: arn:aws:elasticloadbalancing:us-west-2:123456785170:loadbalancer/app/awseb-AWSEB-Y1OVPGRIAZMD/cc5ce6193af39c0b failed Reason: S3Bucket: staging-bucket is not located in the same region with ELB: app/awseb-AWSEB-Y1OVPGRIAZMD/cc5ce6193af39c0b ```
I was able to get this working by running the eb create
command above with the correct vpc & subnet settings.
来源:https://stackoverflow.com/questions/45807504/how-to-setup-application-load-balancer-for-elastic-beanstalk-in-aws