AWS Technical Essentials

0

I'm trying to follow along on the AWS Technical Essentials course, but when I get to Launching the Employee Directory Application on Amazon EC2, I am having trouble with getting the code to work. Can anyone help? Here is what I'm plugging in for the code. I copy and pasted, and just changed to my AZ.

#!/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-pip pip install -r requirements.txt yum -y install stress export PHOTOS_BUCKET=${SUB_PHOTOS_BUCKET} export AWS_DEFAULT_REGION=us-east-2 export DYNAMO_MODE=on FLASK_APP=application.py /usr/local/bin/flask run --host=0.0.0.0 --port=80

Jared
질문됨 3달 전138회 조회
2개 답변
0

We may need to know which error you are receiving, but due to the formatting issues in the question, I'm going to suggest that it might be a formatting issue. This to how it should look, the newlines are important here.

Also make sure you are working in the same region that you specified below, in this case us-east-2.

#!/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-pip 
pip install -r requirements.txt 
yum -y install stress 
export PHOTOS_BUCKET=${SUB_PHOTOS_BUCKET} 
export AWS_DEFAULT_REGION=us-east-2 
export DYNAMO_MODE=on 
export FLASK_APP=application.py 
/usr/local/bin/flask run --host=0.0.0.0 --port=80
profile pictureAWS
답변함 3달 전
profile picture
전문가
검토됨 2달 전
0

1)Verify file permissions: Ensure that the script file has executable permissions. You can use the chmod command to add the execute permission if needed:

"chmod +x your_script.sh"

2)Check for internet connectivity: Make sure your EC2 instance has internet connectivity to download the FlaskApp.zip file using wget. If there are any network restrictions or issues, it may fail to download the file.

3)Debugging output: Since you're using the -ex flags in your bash script (#!/bin/bash -ex), it should provide detailed output while executing each command. This can help you identify exactly where the script fails if it encounters any errors.

4)Verify environment variables: Ensure that all the environment variables (SUB_PHOTOS_BUCKET, AWS_DEFAULT_REGION, DYNAMO_MODE) are correctly set or substituted with their appropriate values.

5)Check FlaskApp.zip content: After unzipping FlaskApp.zip, make sure that all the required files, including requirements.txt and application.py, are present in the FlaskApp directory.

6)Review AWS permissions: Ensure that your EC2 instance has the necessary permissions to access the AWS services (e.g., DynamoDB, S3) mentioned in the script. If permissions are not correctly configured, it can lead to failures when interacting with these services.

profile picture
답변함 3달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인