-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_to_ec2.sh
More file actions
executable file
·62 lines (49 loc) · 1.53 KB
/
deploy_to_ec2.sh
File metadata and controls
executable file
·62 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# EC2 Deployment Script for Jilo Health Backend
# Usage: ./deploy_to_ec2.sh
set -e
# Configuration
EC2_HOST="ec2-15-207-250-39.ap-south-1.compute.amazonaws.com"
EC2_USER="ec2-user"
PEM_FILE="aws-personal.pem"
REMOTE_DIR="~/jilo-health-backend"
echo "🚀 Starting EC2 deployment..."
# Check if PEM file exists
if [ ! -f "$PEM_FILE" ]; then
echo "❌ Error: PEM file '$PEM_FILE' not found!"
echo "Please ensure the PEM file is in the current directory."
exit 1
fi
# Set correct permissions for PEM file
chmod 400 "$PEM_FILE"
echo "📦 Transferring files to EC2..."
# Create remote directory
ssh -i "$PEM_FILE" "$EC2_USER@$EC2_HOST" "mkdir -p $REMOTE_DIR"
# Transfer Python files
scp -i "$PEM_FILE" \
backend_improved.py \
face_droop_analyzer.py \
ml_face_analyzer.py \
stroke_blendshape_classifier.py \
medical_templates.py \
"$EC2_USER@$EC2_HOST:$REMOTE_DIR/"
# Transfer configuration files
scp -i "$PEM_FILE" \
requirements.txt \
requirements_cpu.txt \
runtime.txt \
"$EC2_USER@$EC2_HOST:$REMOTE_DIR/"
# Transfer models directory
echo "📁 Transferring models directory (this may take a while)..."
scp -i "$PEM_FILE" -r models/ "$EC2_USER@$EC2_HOST:$REMOTE_DIR/"
echo "✅ Files transferred successfully!"
echo ""
echo "📋 Next steps:"
echo "1. SSH into your EC2 instance:"
echo " ssh -i $PEM_FILE $EC2_USER@$EC2_HOST"
echo ""
echo "2. Run the setup script on EC2:"
echo " cd $REMOTE_DIR"
echo " bash setup_ec2.sh"
echo ""
echo "Or follow the manual steps in EC2_DEPLOYMENT.md"