Creating Employee Directory Application with AWS— AWS Solution Architect Associate Series — Part 8
An EC2 instance should be launched in a normal manner. However, additionally, we should select the IAM cloud server profile for the Employee Web App that we created earlier.
We will enter a batch script into the following area where we can deploy pre-prepared settings afterwards.
Bash Script for Linux Distributions
For Linux 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 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
For Linux 2023
#!/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=<INSERT REGION HERE>
export DYNAMO_MODE=on
FLASK_APP=[application.py](<http://application.py/>) /usr/local/bin/flask run — host=0.0.0.0 — port=80
After launching and clicking on the resulting URL, you will encounter a running instance.
In this short piece, I’ve only demonstrated how to create an Employee Directory App. You can create and customize an app according to your own imagination and purpose.
In our next piece, we’ll delve into container services and explore a bit more about architecture.
Wishing you a happy week ahead!