Reputation: 125
I have created a zip file with all my programs and it runs well locally. For some reason elastic beanstalk gives several errors when I deploy my zip file. Such as:
"Warning: Configuration files cannot be extracted from the application version my_tennis_club2. Check that the application version is a valid zip or war file."
"Error: The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist."
"Error: Failed to launch environment"
I followed the tutorial https://www.w3schools.com/django/django_deploy_eb.php where I always got the same result as the tutorial up until I was gonna upload the zip file containing my entire project to elastic beanstalk
edit:
I can't open the domain when elastic beanstalk is done loading the zip file containing my django project. I can run my project on a localhost when i write
python manage.py runserver
on my computer. I created an ec2 instance and an IAM role which I gave administrative access to so it should have access to both the EC2 and beanstalk. It also says "Unable to assume role "arn:aws:iam::976090601851:role/masterROLE". Verify that the role exists and is configured correctly. Impaired services on all instances." masterROLE is the name of the IAM role that I created.
Above is the directories and files included in the zip that i upload
Edit2
I created the IAM role as described but it still doesn't work. See below:
The health is still degraded and when I try opening the URL which should work under https://sqs.eu-north-1.amazonaws.com/976090601851/awseb-e-j7uhxx3a5p-stack-AWSEBWorkerQueue-citCtAuZFkvV/members then i get UnknownOperationException. In the zip file I have also included apart from my project also a file 'requirements.txt' and and a folder .ebextensions containing django.config.
Edit3 I clicked the box "Create and use new service role". I then used the IAM role aws-elasticbeanstalk-ec2-role, which I created as described. I don't get any error messages anymore like I did before, but the health is still degraded and when i try to access the website I get "502 bad gateway" error message. Below is my eb-engine.log:
2023/09/18 19:26:28.733627 [INFO] Starting EBPlatform-PlatformEngine
2023/09/18 19:26:28.733702 [INFO] reading event message file
2023/09/18 19:26:28.758543 [INFO] Engine received EB command userdata-exec
2023/09/18 19:26:28.798950 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1
2023/09/18 19:26:29.479440 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBBeanstalkMetadata --region eu-north-1
2023/09/18 19:26:30.314960 [INFO] This is a workflow controlled instance.
2023/09/18 19:26:30.315052 [INFO] Engine command: (env-launch)
2023/09/18 19:26:30.315547 [INFO] Executing instruction: SyncClock
2023/09/18 19:26:30.315552 [INFO] Starting SyncClock
2023/09/18 19:26:30.315567 [INFO] Running command /bin/sh -c /usr/bin/chronyc tracking
2023/09/18 19:26:30.323708 [INFO] Reference ID : A9FEA97B (169.254.169.123)
Stratum : 4
Ref time (UTC) : Mon Sep 18 19:26:29 2023
System time : 0.881987631 seconds slow of NTP time
Last offset : -0.959451079 seconds
RMS offset : 0.959451079 seconds
Frequency : 4.176 ppm fast
Residual freq : -39.628 ppm
Skew : 2.331 ppm
Root delay : 0.000236736 seconds
Root dispersion : 0.000381636 seconds
Update interval : 0.0 seconds
Leap status : Normal
2023/09/18 19:26:30.323735 [INFO] Running command /bin/sh -c /usr/bin/chronyc -a makestep
2023/09/18 19:26:31.210717 [INFO] 200 OK
2023/09/18 19:26:31.210764 [INFO] Skipping Configure OS
2023/09/18 19:26:31.210771 [INFO] Skipping LockRepo
2023/09/18 19:26:31.210777 [INFO] Skipping GenerateEBBanner
2023/09/18 19:26:31.210783 [INFO] Skipping Install Process Manager
2023/09/18 19:26:31.210788 [INFO] Skipping install syslog
2023/09/18 19:26:31.210794 [INFO] Skipping install cron
2023/09/18 19:26:31.210799 [INFO] Skipping install proxy
2023/09/18 19:26:31.210804 [INFO] Skipping installhealthd
2023/09/18 19:26:31.210809 [INFO] Skipping Install Log Streaming Manager
2023/09/18 19:26:31.210815 [INFO] Skipping install X-Ray
2023/09/18 19:26:31.210820 [INFO] Skipping install Third Party License
2023/09/18 19:26:31.210825 [INFO] Skipping install httpd
2023/09/18 19:26:31.210832 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:31.210835 [INFO] Executing instruction: installSqsd
2023/09/18 19:26:31.210840 [INFO] This is a web server environment instance, skip install sqsd daemon ...
2023/09/18 19:26:31.210845 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:31.210848 [INFO] Executing instruction: bootstraphealthd
2023/09/18 19:26:31.210852 [INFO] this is an enhanced health env ...
2023/09/18 19:26:31.210864 [INFO] bootstrap healthd....
2023/09/18 19:26:31.210880 [INFO] Running command /bin/sh -c /usr/bin/id -u healthd || /usr/sbin/useradd --user-group healthd -s /sbin/nologin --create-home
2023/09/18 19:26:31.801829 [INFO] /usr/bin/id: ‘healthd’: no such user
2023/09/18 19:26:31.805718 [INFO] bootstrap healthd....
2023/09/18 19:26:31.805745 [INFO] Running command /bin/sh -c /usr/bin/id -u healthd || /usr/sbin/useradd --user-group healthd -s /sbin/nologin --create-home
2023/09/18 19:26:31.811867 [INFO] 1001
2023/09/18 19:26:31.814461 [INFO] configure bundle log for healthd...
2023/09/18 19:26:31.814557 [INFO] Executing instruction: GetSetupProxyLog
2023/09/18 19:26:31.814731 [INFO] Skipping Install yum packages
2023/09/18 19:26:31.814738 [INFO] Skipping Configure Python site-packages
2023/09/18 19:26:31.814744 [INFO] Skipping Install Python Modules
2023/09/18 19:26:31.814749 [INFO] Skipping MarkBaked
2023/09/18 19:26:31.814756 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:31.814760 [INFO] Executing instruction: TuneSystemSettings
2023/09/18 19:26:31.814763 [INFO] Starting TuneSystemSettings
2023/09/18 19:26:31.814768 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:31.815661 [INFO] Executing instruction: GetSetupLogRotate
2023/09/18 19:26:31.815666 [INFO] Initialize LogRotate files and directories
2023/09/18 19:26:31.827638 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:31.827648 [INFO] Executing instruction: BootstrapCFNHup
2023/09/18 19:26:31.827652 [INFO] Bootstrap cfn-hup
2023/09/18 19:26:31.829109 [INFO] Copying file /opt/elasticbeanstalk/config/private/aws-eb-command-handler.conf to /etc/cfn/hooks.d/aws-eb-command-handler.conf
2023/09/18 19:26:31.830671 [INFO] Executing instruction: StartCFNHup
2023/09/18 19:26:31.830680 [INFO] Start cfn-hup
2023/09/18 19:26:31.830699 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/09/18 19:26:31.863884 [INFO] cfn-hup is not registered with EB yet, registering it now
2023/09/18 19:26:31.863938 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/09/18 19:26:31.895860 [INFO] Running command /bin/sh -c systemctl daemon-reload
2023/09/18 19:26:32.402788 [INFO] Running command /bin/sh -c systemctl reset-failed
2023/09/18 19:26:32.415233 [INFO] Running command /bin/sh -c systemctl is-enabled aws-eb.target
2023/09/18 19:26:32.428574 [INFO] Running command /bin/sh -c systemctl enable aws-eb.target
2023/09/18 19:26:32.902723 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
2023/09/18 19:26:32.926209 [INFO] Running command /bin/sh -c systemctl enable cfn-hup.service
2023/09/18 19:26:33.416376 [INFO] Synchronizing state of cfn-hup.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable cfn-hup
Created symlink /etc/systemd/system/multi-user.target.wants/cfn-hup.service → /etc/systemd/system/cfn-hup.service.
2023/09/18 19:26:33.416404 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
2023/09/18 19:26:33.430346 [INFO] cfn-hup process is not running, starting it now
2023/09/18 19:26:33.430376 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/09/18 19:26:33.445103 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
2023/09/18 19:26:33.456117 [INFO] Running command /bin/sh -c systemctl start cfn-hup.service
2023/09/18 19:26:33.517348 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:33.517371 [INFO] Executing instruction: SetupPublishLogCronjob
2023/09/18 19:26:33.517375 [INFO] Setup publish logs cron job...
2023/09/18 19:26:33.517380 [INFO] Copying file /opt/elasticbeanstalk/config/private/logtasks/cron/publishlogs to /etc/cron.d/publishlogs
2023/09/18 19:26:33.519224 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:33.519234 [INFO] Executing instruction: MarkBootstrapped
2023/09/18 19:26:33.519238 [INFO] Starting MarkBootstrapped
2023/09/18 19:26:33.519243 [INFO] Instance has NOT been bootstrapped
2023/09/18 19:26:33.519318 [INFO] Marked instance as Bootstrapped
2023/09/18 19:26:33.519322 [INFO] Executing instruction: Save CFN Stack Info
2023/09/18 19:26:33.519368 [INFO] Starting SwitchCFNStack
2023/09/18 19:26:33.519373 [INFO] Executing cleanup logic
2023/09/18 19:26:33.519382 [INFO] Platform Engine finished execution on command: env-launch
2023/09/18 19:26:52.642020 [INFO] Starting...
2023/09/18 19:26:52.642457 [INFO] Starting EBPlatform-PlatformEngine
2023/09/18 19:26:52.642483 [INFO] reading event message file
2023/09/18 19:26:52.642649 [INFO] Engine received EB command cfn-hup-exec
2023/09/18 19:26:52.714711 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1
2023/09/18 19:26:53.113024 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBBeanstalkMetadata --region eu-north-1
2023/09/18 19:26:53.447183 [INFO] checking whether command app-deploy is applicable to this instance...
2023/09/18 19:26:53.447198 [INFO] this command is applicable to the instance, thus instance should execute command
2023/09/18 19:26:53.447200 [INFO] Engine command: (app-deploy)
2023/09/18 19:26:53.447204 [INFO] Downloading EB Application...
2023/09/18 19:26:53.447206 [INFO] Region: eu-north-1
2023/09/18 19:26:53.447208 [INFO] envID: e-7crmv8gmvp
2023/09/18 19:26:53.447210 [INFO] envBucket: elasticbeanstalk-eu-north-1-976090601851
2023/09/18 19:26:53.447213 [INFO] Using manifest file name from command request
2023/09/18 19:26:53.447218 [INFO] Unable to get version manifest file.
2023/09/18 19:26:53.447220 [INFO] Downloading latest manifest available.
2023/09/18 19:26:53.447222 [INFO] Download latest app version manifest
2023/09/18 19:26:53.447324 [INFO] resources/environments/e-7crmv8gmvp/_runtime/versions/manifest
2023/09/18 19:26:53.490299 [INFO] latestManifest key *: resources/environments/e-7crmv8gmvp/_runtime/versions/manifest_1695065142831
2023/09/18 19:26:53.490473 [INFO] Downloading: bucket: elasticbeanstalk-eu-north-1-976090601851, object: /resources/environments/e-7crmv8gmvp/_runtime/versions/manifest_1695065142831
2023/09/18 19:26:53.499659 [INFO] Download successful105bytes downloaded
2023/09/18 19:26:53.499726 [INFO] Trying to read and parse version manifest...
2023/09/18 19:26:53.499798 [INFO] Downloading: bucket: elasticbeanstalk-eu-north-1-976090601851, object: /resources/environments/e-7crmv8gmvp/_runtime/_versions/Tobii2/tobii2
2023/09/18 19:26:53.514109 [INFO] Download successful22718bytes downloaded
2023/09/18 19:26:53.514960 [INFO] Executing instruction: ElectLeader
2023/09/18 19:26:53.514965 [INFO] Running leader election for instance i-0cce30ac7deac8671...
2023/09/18 19:26:53.514969 [INFO] Calling the cfn-elect-cmd-leader to elect the command leader.
2023/09/18 19:26:53.514980 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-elect-cmd-leader --stack arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 --command-name ElasticBeanstalkCommand-AWSEBAutoScalingGroup --invocation-id 01be5a74-e453-4f3f-9e11-77a943a84148 --listener-id i-0cce30ac7deac8671 --region eu-north-1
2023/09/18 19:26:53.847910 [INFO] Instance is Leader.
2023/09/18 19:26:53.847952 [INFO] Executing instruction: stopSqsd
2023/09/18 19:26:53.847957 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
2023/09/18 19:26:53.847961 [INFO] Executing instruction: PreBuildEbExtension
2023/09/18 19:26:53.847965 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
2023/09/18 19:26:53.847979 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1 --configsets Infra-EmbeddedPreBuild
2023/09/18 19:26:54.254406 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.
2023/09/18 19:26:54.254449 [INFO] Executing instruction: StageApplication
2023/09/18 19:26:54.254618 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2023/09/18 19:26:54.254640 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2023/09/18 19:26:54.261925 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2023/09/18 19:26:54.264236 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2023/09/18 19:26:54.264289 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2023/09/18 19:26:54.264303 [INFO] The dir .platform/hooks/prebuild/ does not exist
2023/09/18 19:26:54.264306 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild
2023/09/18 19:26:54.264310 [INFO] Executing instruction: InstallDependency
2023/09/18 19:26:54.264314 [INFO] checking dependencies file
2023/09/18 19:26:54.264325 [INFO] Installing dependencies with requirements.txt by using Pip
2023/09/18 19:26:54.264334 [INFO] Running command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt
2023/09/18 19:26:58.406776 [INFO] Collecting asgiref==3.7.2
Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)
Collecting Django==4.2.5
Downloading Django-4.2.5-py3-none-any.whl (8.0 MB)
Collecting sqlparse==0.4.4
Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
Collecting typing-extensions==4.7.1
Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)
Installing collected packages: typing-extensions, sqlparse, asgiref, Django
Successfully installed Django-4.2.5 asgiref-3.7.2 sqlparse-0.4.4 typing-extensions-4.7.1
2023/09/18 19:26:58.406796 [INFO] WARNING: You are using pip version 21.3.1; however, version 23.2.1 is available.
You should consider upgrading via the '/var/app/venv/staging-LQM1lest/bin/python3.9 -m pip install --upgrade pip' command.
2023/09/18 19:26:58.406802 [INFO] Executing instruction: check Procfile
2023/09/18 19:26:58.406836 [INFO] creating default Procfile...
2023/09/18 19:26:58.407017 [INFO] Executing instruction: configure X-Ray
2023/09/18 19:26:58.407022 [INFO] X-Ray is not enabled.
2023/09/18 19:26:58.407026 [INFO] Executing instruction: configure proxy server
2023/09/18 19:26:58.412761 [INFO] Executing instruction: configure healthd specific proxy conf
2023/09/18 19:26:58.413909 [INFO] Running command /bin/sh -c systemctl show -p PartOf healthd.service
2023/09/18 19:26:58.432444 [INFO] Running command /bin/sh -c systemctl daemon-reload
2023/09/18 19:26:58.823320 [INFO] Running command /bin/sh -c systemctl reset-failed
2023/09/18 19:26:58.852867 [INFO] Running command /bin/sh -c systemctl is-enabled aws-eb.target
2023/09/18 19:26:58.864926 [INFO] Running command /bin/sh -c systemctl enable aws-eb.target
2023/09/18 19:26:59.155317 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
2023/09/18 19:26:59.164703 [INFO] Running command /bin/sh -c systemctl enable healthd.service
2023/09/18 19:26:59.410005 [INFO] Created symlink /etc/systemd/system/multi-user.target.wants/healthd.service → /etc/systemd/system/healthd.service.
2023/09/18 19:26:59.410034 [INFO] Running command /bin/sh -c systemctl show -p PartOf healthd.service
2023/09/18 19:26:59.422603 [INFO] Running command /bin/sh -c systemctl is-active healthd.service
2023/09/18 19:26:59.431040 [INFO] Running command /bin/sh -c systemctl start healthd.service
2023/09/18 19:26:59.510928 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_logformat.conf to /var/proxy/staging/nginx/conf.d/healthd_logformat.conf
2023/09/18 19:26:59.512203 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_nginx.conf to /var/proxy/staging/nginx/conf.d/elasticbeanstalk/healthd.conf
2023/09/18 19:26:59.513383 [INFO] Executing instruction: configure log streaming
2023/09/18 19:26:59.513389 [INFO] log streaming is not enabled
2023/09/18 19:26:59.513391 [INFO] disable log stream
2023/09/18 19:26:59.513403 [INFO] Running command /bin/sh -c systemctl show -p PartOf amazon-cloudwatch-agent.service
2023/09/18 19:26:59.530550 [INFO] Running command /bin/sh -c systemctl stop amazon-cloudwatch-agent.service
2023/09/18 19:26:59.545254 [INFO] Executing instruction: GetToggleForceRotate
2023/09/18 19:26:59.545277 [INFO] Checking if logs need forced rotation
2023/09/18 19:26:59.545310 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1
2023/09/18 19:27:00.061180 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBBeanstalkMetadata --region eu-north-1
2023/09/18 19:27:00.537901 [INFO] Generating rsyslog config from Procfile
2023/09/18 19:27:00.539458 [INFO] Running command /bin/sh -c systemctl restart rsyslog.service
2023/09/18 19:27:00.915253 [INFO] Executing instruction: PostBuildEbExtension
2023/09/18 19:27:00.915308 [INFO] Starting executing the config set Infra-EmbeddedPostBuild.
2023/09/18 19:27:00.915328 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1 --configsets Infra-EmbeddedPostBuild
2023/09/18 19:27:01.281054 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.
2023/09/18 19:27:01.281078 [INFO] Executing instruction: CleanEbExtensions
2023/09/18 19:27:01.281099 [INFO] Cleaned ebextensions subdirectories from app staging directory.
2023/09/18 19:27:01.281101 [INFO] Executing instruction: RunAppDeployPreDeployHooks
2023/09/18 19:27:01.281123 [INFO] Executing platform hooks in .platform/hooks/predeploy/
2023/09/18 19:27:01.281140 [INFO] The dir .platform/hooks/predeploy/ does not exist
2023/09/18 19:27:01.281143 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/predeploy
2023/09/18 19:27:01.281150 [INFO] Executing instruction: stop X-Ray
2023/09/18 19:27:01.281153 [INFO] stop X-Ray ...
2023/09/18 19:27:01.281164 [INFO] Running command /bin/sh -c systemctl show -p PartOf xray.service
2023/09/18 19:27:01.295488 [WARN] stopProcess Warning: process xray is not registered
2023/09/18 19:27:01.295519 [INFO] Running command /bin/sh -c systemctl stop xray.service
2023/09/18 19:27:01.310280 [INFO] Executing instruction: stop proxy
2023/09/18 19:27:01.310323 [INFO] Running command /bin/sh -c systemctl show -p PartOf httpd.service
2023/09/18 19:27:01.324857 [WARN] deregisterProcess Warning: process httpd is not registered, skipping...
2023/09/18 19:27:01.324895 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2023/09/18 19:27:01.340023 [WARN] deregisterProcess Warning: process nginx is not registered, skipping...
2023/09/18 19:27:01.340043 [INFO] Executing instruction: FlipApplication
2023/09/18 19:27:01.340047 [INFO] Fetching environment variables...
2023/09/18 19:27:01.340163 [INFO] Purge old process...
2023/09/18 19:27:01.340179 [INFO] Removing /var/app/current/ if it exists
2023/09/18 19:27:01.340190 [INFO] Renaming /var/app/staging/ to /var/app/current/
2023/09/18 19:27:01.340205 [INFO] Register application processes...
2023/09/18 19:27:01.340233 [INFO] Registering the proc: web
2023/09/18 19:27:01.340243 [INFO] Running command /bin/sh -c systemctl show -p PartOf web.service
2023/09/18 19:27:01.351323 [INFO] Running command /bin/sh -c systemctl daemon-reload
2023/09/18 19:27:01.602093 [INFO] Running command /bin/sh -c systemctl reset-failed
2023/09/18 19:27:01.610883 [INFO] Running command /bin/sh -c systemctl is-enabled eb-app.target
2023/09/18 19:27:01.618484 [INFO] Copying file /opt/elasticbeanstalk/config/private/aws-eb.target to /etc/systemd/system/eb-app.target
2023/09/18 19:27:01.619452 [INFO] Running command /bin/sh -c systemctl enable eb-app.target
2023/09/18 19:27:01.955715 [INFO] Created symlink /etc/systemd/system/multi-user.target.wants/eb-app.target → /etc/systemd/system/eb-app.target.
2023/09/18 19:27:01.955752 [INFO] Running command /bin/sh -c systemctl start eb-app.target
2023/09/18 19:27:01.977870 [INFO] Running command /bin/sh -c systemctl enable web.service
2023/09/18 19:27:02.222128 [INFO] Created symlink /etc/systemd/system/multi-user.target.wants/web.service → /etc/systemd/system/web.service.
2023/09/18 19:27:02.222164 [INFO] Running command /bin/sh -c systemctl show -p PartOf web.service
2023/09/18 19:27:02.263074 [INFO] Running command /bin/sh -c systemctl is-active web.service
2023/09/18 19:27:02.273319 [INFO] Running command /bin/sh -c systemctl start web.service
2023/09/18 19:27:02.330172 [INFO] Executing instruction: start X-Ray
2023/09/18 19:27:02.330201 [INFO] X-Ray is not enabled.
2023/09/18 19:27:02.330208 [INFO] Executing instruction: start proxy with new configuration
2023/09/18 19:27:02.330235 [INFO] Running command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf
2023/09/18 19:27:02.377042 [INFO] nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
nginx: the configuration file /var/proxy/staging/nginx/nginx.conf syntax is ok
nginx: configuration file /var/proxy/staging/nginx/nginx.conf test is successful
2023/09/18 19:27:02.377199 [INFO] Running command /bin/sh -c cp -rp /var/proxy/staging/nginx/* /etc/nginx
2023/09/18 19:27:02.384102 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2023/09/18 19:27:02.406959 [INFO] Running command /bin/sh -c systemctl daemon-reload
2023/09/18 19:27:02.721872 [INFO] Running command /bin/sh -c systemctl reset-failed
2023/09/18 19:27:02.777897 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2023/09/18 19:27:02.795024 [INFO] Running command /bin/sh -c systemctl is-active nginx.service
2023/09/18 19:27:02.803567 [INFO] Running command /bin/sh -c systemctl start nginx.service
2023/09/18 19:27:02.900062 [INFO] Executing instruction: configureSqsd
2023/09/18 19:27:02.900086 [INFO] This is a web server environment instance, skip configure sqsd daemon ...
2023/09/18 19:27:02.900091 [INFO] Executing instruction: startSqsd
2023/09/18 19:27:02.900094 [INFO] This is a web server environment instance, skip start sqsd daemon ...
2023/09/18 19:27:02.900098 [INFO] Executing instruction: Track pids in healthd
2023/09/18 19:27:02.900102 [INFO] This is an enhanced health env...
2023/09/18 19:27:02.900117 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf aws-eb.target | cut -d= -f2
2023/09/18 19:27:02.924546 [INFO] cfn-hup.service nginx.service healthd.service
2023/09/18 19:27:02.924577 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf eb-app.target | cut -d= -f2
2023/09/18 19:27:02.940947 [INFO] web.service
2023/09/18 19:27:02.941342 [INFO] Executing instruction: RunAppDeployPostDeployHooks
2023/09/18 19:27:02.941414 [INFO] Executing platform hooks in .platform/hooks/postdeploy/
2023/09/18 19:27:02.941434 [INFO] The dir .platform/hooks/postdeploy/ does not exist
2023/09/18 19:27:02.941438 [INFO] Finished running scripts in /var/app/current/.platform/hooks/postdeploy
2023/09/18 19:27:02.941446 [INFO] Executing cleanup logic
2023/09/18 19:27:02.941694 [INFO] CommandService Response: {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"Engine execution has succeeded.","returncode":0,"events":[{"msg":"Instance deployment successfully generated a 'Procfile'.","timestamp":1695065218406,"severity":"INFO"},{"msg":"Instance deployment completed successfully.","timestamp":1695065222941,"severity":"INFO"}]}]}
2023/09/18 19:27:02.941857 [INFO] Platform Engine finished execution on command: app-deploy
2023/09/18 19:29:51.484880 [INFO] Starting...
2023/09/18 19:29:51.484933 [INFO] Starting EBPlatform-PlatformEngine
2023/09/18 19:29:51.484954 [INFO] reading event message file
2023/09/18 19:29:51.485102 [INFO] Engine received EB command cfn-hup-exec
2023/09/18 19:29:51.561896 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBAutoScalingGroup --region eu-north-1
2023/09/18 19:29:51.974363 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-north-1:976090601851:stack/awseb-e-7crmv8gmvp-stack/28f866b0-5659-11ee-b0e1-0640d6e4bb20 -r AWSEBBeanstalkMetadata --region eu-north-1
2023/09/18 19:29:52.322596 [INFO] checking whether command bundle-log is applicable to this instance...
2023/09/18 19:29:52.322611 [INFO] this command is applicable to the instance, thus instance should execute command
2023/09/18 19:29:52.322614 [INFO] Engine command: (bundle-log)
2023/09/18 19:29:52.322685 [INFO] Executing instruction: GetBundleLogs
2023/09/18 19:29:52.322689 [INFO] Bundle Logs...
Upvotes: 1
Views: 1546
Reputation: 710
I have encountered this issue before and it is just as the error says: "The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist."
Elastic Beanstalk requires an instance profile with managed policies that allow your EC2 instances to perform required operations. The tutorial you followed already had an IAM role created for the required policies that Beanstalk needs, but you did not, hence the error.
Follow these steps to resolve the issue:
Roles
and create a new RoleAWS service
, and "Use case" as EC2
aws-elasticbeanstalk-ec2-role
or any other name of your choiceAfterwards, go back to your Elastic Beanstalk console and when creating a new environment, you should now have the newly created role as an option under "EC2 instance profile"
.
Select it and that should resolve the error.
Let me know if that works✨
P.S W3Schools may not be a good source for these kinds of tutorials. Try searching for hands-on tutorials on AWS learning center or even Medium posts.
EDIT: This resolved OP's first issue, see comments under the question for suggested fixes on subsequent issues.
Upvotes: 2