Skip to content

Commit f1bd074

Browse files
feat: add S3 integration and update AWS configuration for production deployment (#13)
1 parent 47c4929 commit f1bd074

16 files changed

+1941
-82
lines changed

AWS_DEPLOYMENT_CHECKLIST.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Quick AWS Deployment Checklist
2+
3+
## ✅ What You Need to Do in AWS Console
4+
5+
### 1. Create S3 Bucket
6+
- Go to **S3****Create bucket**
7+
- Name: `yourcompany-product-images-prod` (unique name)
8+
- Region: Same as your EC2 (e.g., `us-east-1`)
9+
- Encryption: Enable (SSE-S3)
10+
- **Save bucket name**
11+
12+
### 2. Create IAM Policy
13+
- Go to **IAM****Policies****Create policy**
14+
- Use JSON tab, paste:
15+
```json
16+
{
17+
"Version": "2012-10-17",
18+
"Statement": [
19+
{
20+
"Effect": "Allow",
21+
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:HeadObject"],
22+
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
23+
},
24+
{
25+
"Effect": "Allow",
26+
"Action": ["s3:ListBucket"],
27+
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME"
28+
}
29+
]
30+
}
31+
```
32+
- Replace `YOUR-BUCKET-NAME` with your bucket name
33+
- Name: `ProductServiceS3Policy`
34+
35+
### 3. Create IAM Role (Recommended)
36+
- Go to **IAM****Roles****Create role**
37+
- Select **EC2****Next**
38+
- Attach `ProductServiceS3Policy`**Next**
39+
- Name: `EC2-S3-Access-Role`**Create role**
40+
41+
### 4. Attach Role to EC2
42+
- Go to **EC2****Instances**
43+
- Select your instance → **Actions****Security****Modify IAM role**
44+
- Select `EC2-S3-Access-Role`**Update**
45+
46+
### 5. Update Application Configuration
47+
48+
Create `application-prod.properties` or use environment variables:
49+
50+
```properties
51+
aws.region=us-east-1
52+
aws.s3.bucket=your-bucket-name-here
53+
aws.s3.endpoint-override=
54+
aws.s3.path-style-enabled=false
55+
aws.access-key-id=
56+
aws.secret-access-key=
57+
```
58+
59+
**Note**: Leave access keys empty if using IAM role (recommended)
60+
61+
### 6. Deploy Application
62+
```bash
63+
# Build
64+
mvn clean package
65+
66+
# Copy to EC2
67+
scp -i key.pem target/product-service.jar ec2-user@your-ec2-ip:~/app/
68+
69+
# SSH into EC2
70+
ssh -i key.pem ec2-user@your-ec2-ip
71+
72+
# Run with production config
73+
cd ~/app
74+
java -jar product-service.jar --spring.config.location=application-prod.properties
75+
```
76+
77+
## 🔐 Alternative: Using Access Keys (Less Secure)
78+
79+
If not using IAM role, create IAM user:
80+
- **IAM****Users****Create user**
81+
- Attach `ProductServiceS3Policy`
82+
- Create access key → **Save keys securely**
83+
- Set environment variables on EC2:
84+
```bash
85+
export AWS_ACCESS_KEY_ID=your-key-id
86+
export AWS_SECRET_ACCESS_KEY=your-secret-key
87+
```
88+
89+
---
90+
91+
**See `AWS_DEPLOYMENT_GUIDE.md` for detailed step-by-step instructions.**
92+

0 commit comments

Comments
 (0)