- Newest
- Most votes
- Most comments
Make sure to choose Amazon Linux 2 instead of Amazon Linux 2023 when you launch the instance. In the console, Amazon Linux 2023 is now the default. You will need to terminate the existing instance and create a new one.
Thank you so much for your help. This solved my problem.
What is the HTTP status code returned when connecting to EC2 and executing the following command?
curl localhost -o /dev/null -w '%{http_code}\n' -s
In case of 5XX error, there is most likely a problem with the web server configuration.
It is possible that the web server is not started.
Please execute the following command to start it.sudo systemctl start httpdor
sudo systemctl start apacheor
sudo systemctl start nginxDid you solve the problem here?
Thanks for your answer. This is what I got.
[ec2-user@ip- ~]$ curl localhost -o /dev/null -w '%{http_code}\n' -s 000
[ec2-user@ip- ~]$ sudo systemctl start httpd Failed to start httpd.service: Unit httpd.service not found.
[ec2-user@ip- ~]$ sudo yum install httpd Last metadata expiration check: 1 day, 3:24:20 ago on Thu Apr 6 16:11:44 2023.
ec2-user@ip- ~]$ sudo systemctl start httpd [ec2-user@ip- ~]$ service httpd status Redirecting to /bin/systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled) Active: active (running) since Fri 2023-04-07 19:37:10 UTC; 23s ago Docs: man:httpd.service(8) Main PID: 25460 (httpd) Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec" Tasks: 177 (limit: 1112) Memory: 12.8M CPU: 77ms CGroup: /system.slice/httpd.service ├─25460 /usr/sbin/httpd -DFOREGROUND ├─25472 /usr/sbin/httpd -DFOREGROUND ├─25473 /usr/sbin/httpd -DFOREGROUND ├─25474 /usr/sbin/httpd -DFOREGROUND └─25475 /usr/sbin/httpd -DFOREGROUND
Apr 07 19:37:10 ip-.us-east-2.compute.internal systemd[1]: Starting httpd.service - The Apache HTTP Server... Apr 07 19:37:10 ip-.us-east-2.compute.internal systemd[1]: Started httpd.service - The Apache HTTP Server. Apr 07 19:37:10 ip-.us-east-2.compute.internal httpd[25460]: Server configured, listening on: port 80
############################### When I entered my IP address in my browser, it displayed this: It works!
BUT, that's not the output I was expecting. I think that "It works!" is a default message.
Really need to see the User Data script from the lab to determine what application is running. We don't know if Apache is even the web server.
To: kentrad
I pasted below my user data. Thank you.
#!/bin/bash -ex wget https://aws-tc-largeobjects.s3-us-west-2.amazonaws.com/DEV-AWS-MO-GCNv2/FlaskApp.zip unzip FlaskApp.zip cd FlaskApp/ yum -y install python3 mysql pip3 install -r requirements.txt amazon-linux-extras install epel yum -y install stress export PHOTOS_BUCKET=${SUB_PHOTOS_BUCKET} export AWS_DEFAULT_REGION=<INSERT REGION HERE> export DYNAMO_MODE=on FLASK_APP=application.py /usr/local/bin/flask run --host=0.0.0.0 --port=80
Relevant content
- asked 2 years ago

Can you post the User Data script used in this lab?