Explain how to deploy a single‑page application (Angular or React) on CloudFront with static files stored in S3, including certificate management, and how to set up the backend using Lambda functions for each UI route.
💡 Model Answer
To host a single‑page application on CloudFront, first store the static assets (HTML, CSS, JS, images) in an S3 bucket configured for static website hosting. Create a CloudFront distribution that points to the S3 origin, enabling caching and global edge delivery. For HTTPS, request an ACM certificate for your domain and attach it to the distribution. Configure the distribution’s default behavior to forward all requests to the S3 origin, and set the error page to index.html so that client‑side routing works. The front‑end can be built with Angular or React and deployed to the bucket via CI/CD. For the backend, expose each UI route as a Lambda function behind API Gateway. Each Lambda can be mapped to a specific path (e.g., /api/user, /api/orders). Use Lambda@Edge if you need to run code at edge locations for latency or custom headers. Secure the API with Cognito or JWT tokens, and enforce CORS. This architecture gives you a fully serverless front‑end with edge caching and a lightweight, event‑driven backend.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500