Search code examples
amazon-web-servicesamazon-elastic-beanstalkamazon-linux-2epel

Elastic Beanstalk original environment not working after clone , epel failed


Hello everyone I have a problem, I have an elastic beanstalk that hosts our website as an API. It's been fine and good however I have been developing the next stage of the site. I uploaded the new version to the beanstalk but when I uploaded the deployment failed and rolled back to working version , the website working just fine after rolled back.

The problem I create a clone of the elastic beanstalk environment , after clone success my website somehow gone the API not working anymore i read documentation the clone suppose to be have the same configuration as the existing environment but my API stop working right after clone. I try to swap it back to original environment not the clone one but still my API not working.

I want to ask did I miss a step or did I need to edit configuration to make my API work again. Please could you give me some tips step by step I am new to AWS and this project was handed to me. The epel on ssl .ebextensions error not working anymore? What should i do to make it work again?

this is error from eb-engine.log

2024/08/30 14:07:29.696199 [INFO] Error occurred during build: Command 10_downloadepel failed

2024/08/30 14:07:29.696233 [ERROR] An error occurred during execution of command [self-startup] - [PostBuildEbExtension]. Stop running the command. Error: Container commands build failed. Please refer to /var/log/cfn-init.log for more details. 

2024/08/30 14:07:29.696240 [INFO] Executing cleanup logic

this is error from cfn-init.log for 10_downloadepel

2024-09-01 14:32:01,037 [ERROR] Command 10_downloadepel (sudo wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/) failed
2024-09-01 14:32:01,037 [ERROR] Error encountered during build of postbuild_0_api: Command 10_downloadepel failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 579, in run_config
    CloudFormationCarpenter(config, self._auth_config, self.strict_mode).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 278, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 10_downloadepel failed

this is fcn-init.log error for 50_getcert

    2024-09-03 06:53:21,178 [INFO] Running configSets: Infra-EmbeddedPostBuild
2024-09-03 06:53:21,182 [INFO] Running configSet Infra-EmbeddedPostBuild
2024-09-03 06:53:21,186 [INFO] Running config postbuild_0_api
2024-09-03 06:53:25,287 [INFO] Command 10_downloadepel succeeded
2024-09-03 06:53:25,571 [INFO] Command 20_installepel succeeded
2024-09-03 06:53:26,999 [INFO] Command 30_enableepl succeeded
2024-09-03 06:53:42,080 [INFO] -----------------------Starting build-----------------------
2024-09-03 06:53:42,091 [INFO] Running configSets: Infra-EmbeddedPostBuild
2024-09-03 06:53:42,093 [INFO] Running configSet Infra-EmbeddedPostBuild
2024-09-03 06:53:42,096 [INFO] Running config postbuild_0_api
2024-09-03 06:53:46,033 [INFO] Command 10_downloadepel succeeded
2024-09-03 06:53:46,176 [INFO] Command 20_installepel succeeded
2024-09-03 06:53:46,825 [INFO] Command 30_enableepl succeeded
2024-09-03 06:53:55,423 [INFO] Command 40_installcertbot succeeded
2024-09-03 06:54:00,545 [INFO] Command 40_installcertbot succeeded
2024-09-03 06:54:00,847 [ERROR] Command 50_getcert (sudo certbot certonly --debug --non-interactive --email [email protected] --agree-tos --standalone --domains mydomain.com --keep-until-expiring --pre-hook "sudo service nginx stop" --post-hook "sudo service nginx start") failed
2024-09-03 06:54:00,847 [ERROR] Error encountered during build of postbuild_0_api: Command 50_getcert failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 579, in run_config
    CloudFormationCarpenter(config, self._auth_config, self.strict_mode).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 278, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 50_getcert failed
2024-09-03 06:54:00,851 [ERROR] -----------------------BUILD FAILED!------------------------
2024-09-03 06:54:00,851 [ERROR] Unhandled exception during build: Command 50_getcert failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 181, in <module>
    worklog.build(metadata, configSets, strict_mode)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
    Contractor(metadata, strict_mode).build(configSets, self)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 567, in build
    self.run_config(config, worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 579, in run_config
    CloudFormationCarpenter(config, self._auth_config, self.strict_mode).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 278, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 50_getcert failed

ssl config code

    container_commands:
   10_downloadepel: 
    command: "sudo wget -r --no-parent -A 'epel-release-*.rpm' https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/"
  20_installepel: 
    command: "sudo rpm -Uvh archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-*.rpm --force"
  30_enableepl: 
    command: "sudo yum-config-manager --enable epel*"
  40_installcertbot: 
    command: "sudo yum install -y certbot"
  50_getcert: 
    command: "sudo certbot certonly --debug --non-interactive --email [email protected] --agree-tos --standalone --domains mydomain.com --keep-until-expiring --pre-hook \"sudo service nginx stop\" --post-hook \"sudo service nginx start\""
  60_link: 
    command: "ln -sf /etc/letsencrypt/live/mydomain.com /etc/letsencrypt/live/ebcert"

Solution

  • If the error shared in your post is the only issue for your cloned enviornment you need to change the the url of rpms as this folder is moved to archive, from the readme :

    ATTENTION
    ======================================
    The contents of this directory have been moved to our archives available at:
    
    http://archives.fedoraproject.org/pub/archive/epel/
    
    If you are having trouble finding something there please feel free to contact EPEL maintainers. [1]
    
    [1] https://docs.fedoraproject.org/en-US/epel/#communicating_with_epel
    

    the new url in this case is : https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/

    Hope this resolve your issue.