Skip to content

Unable to deploy my WAR application to AWS Elastic Beanstalk: WaitCondition timed out during environment creation

0

I’m trying to deploy a Java application packaged as a .war file to AWS Elastic Beanstalk. However, the environment creation process fails with the following error message:

WaitCondition timed out. Received 0 conditions when expecting 1 The following resource(s) failed to create: [AWSEBInstanceLaunchWaitCondition]. I’ve already tried the following steps to resolve the issue:

Verified that the EC2 instance profile aws-elasticbeanstalk-ec2-role exists and has the required policies: AWSElasticBeanstalkWebTier AWSElasticBeanstalkWorkerTier AWSElasticBeanstalkMulticontainerDocker. Ensured that the Root Volume Type is set to gp3 in the environment configuration. Set the DisableIMDSv1 option to true using the Elastic Beanstalk namespace. Confirmed that the EC2 instance limit in my region has not been exceeded. Despite these attempts, the issue persists, and the environment health remains in a Pending or Create_Failed state.

What I Need Help With How can I configure AWS Elastic Beanstalk to ensure successful environment creation? Are there additional steps I need to take to resolve the WaitCondition timed out issue? Here are the details of my setup:

Elastic Beanstalk Platform: Java AWS Region: eu-north-1 Application: Java application packaged as a .war file EC2 Instance Type: t3.micro (Free Tier eligible) Any help or guidance would be greatly appreciated!

2 Answers
1

Based on the information provided, it appears that your Elastic Beanstalk environment creation is failing due to connectivity issues between the EC2 instances and the Elastic Beanstalk service. This is a common problem that can occur for several reasons. Here are some additional steps you can take to troubleshoot and resolve the issue:

  1. Check your VPC configuration: Ensure that your EC2 instances are launched in a subnet with internet connectivity. If you're using a private subnet, make sure you have a NAT Gateway configured to allow outbound internet access.

  2. Verify Security Group settings: Check that the security group associated with your EC2 instances allows outbound traffic to the internet (0.0.0.0/0) on the necessary ports.

  3. Enable Public IP addresses: If your instances are in a public subnet, ensure that the "Auto-assign public IP" setting is enabled for the subnet or explicitly enabled in your Elastic Beanstalk environment configuration.

  4. Increase the timeout period: The default timeout for environment creation might be too short for your application. Try increasing the timeout period in your Elastic Beanstalk configuration.

  5. Check instance logs: If possible, try to access the EC2 instance logs to see if there are any specific errors during the launch process. This can provide more detailed information about what's causing the failure.

  6. Verify region-specific settings: Ensure that all necessary resources and permissions are properly configured for the eu-north-1 region you're using.

  7. Review your application's requirements: Make sure your Java application doesn't have any specific requirements that might be causing issues during deployment.

If the problem persists after trying these steps, you may want to consider creating a new environment with a basic configuration and gradually adding your custom settings to isolate the issue. Additionally, reviewing the full set of events in the Elastic Beanstalk console might provide more context about what's happening during the environment creation process.
Sources
AWSEBInstanceLaunchWaitCondition error on deploying Java app on Elastic Beanstalk | AWS re:Post
Troubleshooting Elastic Beanstalk - Categories and FAQs - AWS Elastic Beanstalk
Sample Application Error in Beanstalk - connection to asset server make timeout | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Let me help you troubleshoot this Elastic Beanstalk deployment issue. The WaitCondition timeout often occurs when the instance can't properly initialize. Here's a systematic approach to resolve this:

1. First, Check Instance Logs
# Download logs using EB CLI
eb logs

# Or check logs in AWS Console:
# CloudWatch Logs > /aws/elasticbeanstalk/<environment-name>/var/log/eb-activity.log
  1. Common Causes and Solutions:

a. VPC Configuration

{
  "VPCOptions": {
    "Subnets": ["subnet-aaaaa", "subnet-bbbbb"],
    "AssociatePublicIpAddress": true
  }
}
Ensure your VPC has:
    
  •     Internet Gateway attached
    
  •     Public subnets with auto-assign public IP enabled
    
  •     Proper route tables
    

b. Security Group Settings

{
  "Ingress": [
    {
      "IpProtocol": "tcp",
      "FromPort": 80,
      "ToPort": 80,
      "CidrIp": "0.0.0.0/0"
    }
  ]
}
  1. Configuration Fixes:

Create a .ebextensions/timeout.config file:

option_settings:
  - namespace: aws:elasticbeanstalk:command
    option_name: Timeout
    value: 1800
  
  - namespace: aws:autoscaling:launchconfiguration
    option_name: InstanceType
    value: t3.small  # Consider upgrading from t3.micro
  1. Health Check Configuration:
option_settings:
  - namespace: aws:elasticbeanstalk:environment:process:default
    option_name: HealthCheckPath
    value: /health  # Adjust to match your application's health check endpoint
  - namespace: aws:elasticbeanstalk:environment
    option_name: HealthCheckGracePeriodSeconds
    value: 300
  1. Memory Settings: Create .ebextensions/java-options.config:
option_settings:
  aws:elasticbeanstalk:container:tomcat:jvmoptions:
    Xms: 256m
    Xmx: 512m
    XX:MaxPermSize: 64m
  1. Additional Troubleshooting Steps:

a. Check IAM roles:

Verify aws-elasticbeanstalk-service-role exists
Ensure it has AWSElasticBeanstalkEnhancedHealth policy

b. Application size:

Ensure your WAR file is under 512MB
Consider using S3 for larger deployments

c. Region-specific checks:

# Check service health in eu-north-1
aws health describe-events --region eu-north-1

  1. Recommended Configuration Changes:
In your Elastic Beanstalk environment configuration:
  •     Increase instance type to t3.small
    
  •     Enable enhanced health monitoring
    
  •     Set up CloudWatch logs streaming
    

If these steps don't resolve the issue, I recommend:

  1. Creating a fresh environment with minimal configuration
    
  2. Gradually adding your customizations
    
  3. Monitoring CloudWatch logs during deployment
    
  4. Checking EC2 instance metadata service (IMDSv2) settings
    

Also, consider using the EB CLI for deployment with verbose logging:

eb deploy --verbose
AWS

answered 2 years ago

  • Thank you for your detailed explanation and suggestions! I appreciate your help. However, I’m new to AWS and struggling to locate the logs you mentioned. I tried using the EB CLI, but I encountered errors during initialization, possibly due to permission issues.

    Could you please guide me on:

    • How to access the logs using the AWS Management Console instead of the EB CLI?
    • The exact steps to find /aws/elasticbeanstalk/<environment-name>/var/log/eb-activity.log in CloudWatch Logs? Thank you for your patience and help!

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.