Beanstalk env build fails : CREATE_FAILED, LaunchWaitCondition

0

I am using a single instance for a web service on Elastic Beanstalk and have had no issues. This morning, my service wasn't working. I checked the /var/logs/web.stdout.log and saw I had run out of space (this is not unsurprising). I removed a bunch of items but still no luck. I tried re-deploying and building and am now getting an entirely different error:

Trying to "rebuild the environment" fails. It gets to "Created CloudWatch alarm named:" and then: WARNING: "Environment health has transitioned from Pending to Severe. Initialization in progress (running for 11 minutes). None of the instances are sending data. ELB health is failing or not available for all instances."

Then after `~6 minutes: ERROR: Stack named 'awseb-e-wq99wiwqkd-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBInstanceLaunchWaitCondition].

ERROR: LaunchWaitCondition failed. The expected number of EC2 instances were not initialized within the given time. Rebuild the environment. If this persists, contact support.

/var/log/eb-cfn-init.log has this error: cfnbootstrap.aws_client.AwsQueryError: [Errno 400] ValidationError: Stack with id arn:aws:cloudformation:us-east-1:479132733260:stack/awseb-e-wq99wiwqkd-stack/c0d49260-6e48-11ec-9af9-124f774d9e03 does not exist or has been deleted

/var/log/web.stdout.log: looks good and the EC2 instance looks to be running. I can SSH into the instance.

This is particularly frustrating as I did not update any settings recently. I saw related issues on this forum / Stack Overflow VPC settings, but I don't think I have one configured and it hadn't been an issue.

Jeremy
asked 2 years ago2862 views
1 Answer
0

The issue here was that I had created a custom AMI by deploying a Beanstalk instance. Apparently that leads to unexpected behavior and the correct way of creating a custom for Beanstalk is by deploying a Beanstalk AMI to EC2, editing it, and then saving it and deploying to Beanstalk.

I had to sign up for Amazon premium support and do "live chat". They were very helpful.

One other thing - I ran into a separate issue that I hadn't seen before during setup. I was using ts-node (for a Typescript / Node.JS) project and it wasn't finding tsconfig-paths(I use this so I can have paths global to my code's src dir). I am installing these globally via .ebextensions. Apparently Elasticbeanstalk won't load env variables during .ebextensions` setup so you need to include a script first:

.ebextensions/0_set_env_variables.config

commands:
    setvars:
        command: /opt/elasticbeanstalk/bin/get-config environment | jq -r 'to_entries | .[] | "export \(.key)=\"\(.value)\""' > /etc/profile.d/sh.local
packages:
    yum:
        jq: []
Jeremy
answered 2 years ago

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