Deploying EBS via EB CLI fails: ERROR

0

I'm using EB CLI to launch a django project on EBS; the process produces the following error:

2024-02-24 16:35:50 ERROR Creating load balancer failed Reason: Resource handler returned message: "At least two subnets in two different Availability Zones must be specified (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: ***********)" (RequestToken: *****, HandlerErrorCode: InvalidRequest)

. . . 2024-02-24 16:37:53 ERROR Stack named 'awseb-***' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBV2LoadBalancer].

My ".ebextensions" has the following file:

option_settings: aws:elasticbeanstalk:container:python: WSGIPath: ****.wsgi:application

=======================

I tried to add a VPC to the "django-config" file with no result.

asked 2 months ago161 views
1 Answer
2
Accepted Answer

Hello.

What commands are you running with "EB CLI"?
If you are running the "eb create" command, try specifying two subnets to be used by ALB with "--vpc.elbsubnets".
Also, please select a subnet in a different availability zone.
You may find the following documentation examples helpful.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-create.html#eb3-createexample1

eb create dev-vpc --vpc.id vpc-0ce8dd99 --vpc.elbsubnets subnet-b356d7c6,subnet-02f74b0c --vpc.ec2subnets subnet-0bb7f0cd,subnet-3b6697c1 --vpc.securitygroup sg-70cff265
profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
  • I followed your comment and the problem was fixed, but another error states that the "security group doesnt exist in the VPC" even though it does:

    2024-02-26 00:08:31 ERROR Failed createEnvironment activity. Reason: Configuration validation exception: Invalid option value: 'sg-0d8e69 8f62e8e529b' (Namespace: 'aws:autoscaling:launchconfiguration', OptionName: 'SecurityGroups'): The security group 'sg-0d***' does not exist in vpc 'vpc-02a*****'

    I made sure it exists in the VPC.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions