- Sign in as the Admin IAM user, if you're not already logged in.
- In the Services search bar, type EC2 and select EC2.
- In the left-hand navigation pane, choose Instances.
- Click Launch instances.
- Configure the following settings.
| Section | Setting |
|---|---|
| Name | employee-directory-app |
| Application and OS Image | Amazon Linux |
| Instance type | t2.micro |
| Key pair (login) | Create new key pair: • Name: app-key-pair• Click Create key pair • A .pem file will be downloaded |
| Network settings | • VPC: Default • Subnet: Select the first one • Auto-assign Public IP: Enabled |
| Firewall (security groups) | • Choose Create security group • Name/Description: app-sg• Remove default SSH rule • Add Rule: HTTP, Source: Anywhere |
-
Expand Advanced details.
-
Under IAM instance profile, select:
S3DynamoDBFullAccessRole. -
Paste the following in User data:
#!/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
-
Replace the line below with your actual AWS region:
export AWS_DEFAULT_REGION=<INSERT REGION HERE>
Example for US West (Oregon):
export AWS_DEFAULT_REGION=us-west-2
⚠️ Note: Keep${SUB_PHOTOS_BUCKET}as-is. You will update this in a later step.
- Click Launch instance.
- Then click View all instances.
- Wait until Instance state is Running.
- Confirm that Status check shows 2/2 checks passed.
🔄 If the page doesn't update, refresh after a few minutes.
- Select your instance.
- In the Details tab, copy the Public IPv4 address.
⚠️ Only copy the address — do not click the link.
-
Open a new browser tab and go to:
http://<your-public-ipv4>Example:
http://18.223.45.67
You should now see the Employee Directory placeholder page!
While the database connection is not yet configured, the application front end is successfully running on your EC2 instance.
🎉 Congratulations! You've launched your EC2 instance and deployed the app front end.