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
asked 2 months ago115 views
2 Answers
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
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
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
answered 2 months ago

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.

Guidelines for Answering Questions