After uploading your frontend source code to the S3 Bucket, you need to enable static website hosting, set up the index and error documents, configure CORS policy, and grant public read permissions so your website runs stably, is accessible from browsers, and can connect to the backend API.
Enable static website hosting for the bucket
index.html
in the Index document field.index.html
for the Error document field (recommended for SPA deployments).http://fcjfashionshop.com.s3-website-ap-southeast-1.amazonaws.com
Configure CORS for the bucket
[
{
"AllowedOrigins": ["*"],
"AllowedMethods": ["GET", "HEAD", "PUT", "POST", "DELETE"],
"AllowedHeaders": ["*"]
}
]
[
{
"AllowedOrigins": ["https://your-domain.com"],
"AllowedMethods": ["GET", "HEAD"],
"AllowedHeaders": ["*"]
}
]
Set permissions for the Frontend Bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::fcjfashionshop.com/*"
}
]
}
Set permissions for the avatar upload bucket (if any)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::uploads-avatars-2025/*"
}
]
}
index.html
loads successfully, your website is running on S3.
Note:
You should only use "*"
for development/testing. When deploying to production, always specify your real website domain in AllowedOrigins
for better security.
Conclusion:
Properly enabling static hosting, configuring CORS, and setting public permissions will ensure your frontend website on S3 operates reliably, can call the backend API, and provides optimal load speed and user experience.