-
Notifications
You must be signed in to change notification settings - Fork 1
/
userdata.sh
19 lines (17 loc) · 990 Bytes
/
userdata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/bash
yum update -y
yum install python3 -y
pip3 install flask
pip3 install flask_mysql
echo "${MyDBURI}" > /home/ec2-user/dbserver.endpoint
# Add GitHub Token if your repository is private
# TOKEN="****************************************"
# FOLDER="https://$TOKEN@raw.githubusercontent.com/devenes/private-projects/main/Phonebook-Application/"
FOLDER="https://github.com/raw/devenes/cloudformation-loadbalancer-phonebook/main/"
curl -s --create-dirs -o "/home/ec2-user/templates/index.html" -L "$FOLDER"templates/index.html
curl -s --create-dirs -o "/home/ec2-user/templates/add-update.html" -L "$FOLDER"templates/add-update.html
curl -s --create-dirs -o "/home/ec2-user/templates/delete.html" -L "$FOLDER"templates/delete.html
curl -s --create-dirs -o "/home/ec2-user/phonebook-app.py" -L "$FOLDER"phonebook-app.py
python3 /home/ec2-user/phonebook-app.py
# Get Database Endpoint from CloudFormation as a variable:
# - MyDBURI: !GetAtt MyDatabaseServer.Endpoint.Address