Migrating from Vercel to AWS: A Step-by-Step Journey
A few months ago, I was hosting my website on Vercel's free tier. While Vercel was a quick and convenient choice for deployment, it came with its own set of limitations, particularly in terms of performance. The free tier, was notably slow. So, I decided to explore alternatives, specifically using Amazon CloudFront, S3, and GitHub Actions for a better overall setup.
The architecture now:
- S3 Bucket: My website files, including HTML, CSS, and JavaScript, are stored in an S3 bucket, which ensures that my content is served from multiple regions, providing faster load times for users globally.
- CloudFront: By using CloudFront, I created a CDN (Content Delivery Network) that caches my static content closer to users, further reducing load times.
- SSL with ACM: I also integrated AWS Certificate Manager (ACM) for an SSL certificate, securing my website with HTTPS.
The Domain Setup with OVH
While I moved my hosting to AWS, my domain remained with OVH, and I had to update the DNS settings manually to point to the CloudFront distribution. The process was straightforward, involving adding CNAME records for both the root and www
subdomains to validate the domain ownership for ACM.
DNS Configuration at OVH:
- For www.come-terlecki.com, the CNAME value was configured as provided by AWS for domain validation.
- After validation, I updated the DNS to point to my CloudFront distribution, and everything worked seamlessly.
Security and IAM Policies for GitHub
One important step during this process was setting up IAM policies to secure my GitHub actions and ensure the correct permissions for deployment. Rather than using my personal account as the manager for GitHub access, I created specific IAM policies that allowed only specific roles to deploy code. This is a security best practice, ensuring that sensitive data and actions are tightly controlled and protected.
This move significantly enhanced the security of my project, as I no longer needed to give broad access permissions but could limit roles based on necessity.
The Challenges of Migrating
Although the migration to AWS came with a lot of flexibility and scalability, it wasn’t without its challenges:
- SSL Issues: Initially, I encountered SSL errors like
ERR_SSL_VERSION_OR_CIPHER_MISMATCH
. This stemmed from incorrect SSL/TLS configurations or mismatched protocols (because I have chosen eu-central-1 for ACM...). After a bit of troubleshooting, ensuring compatibility between CloudFront and the ACM certificate, everything fell into place. - DNS Propagation Delays: It took a little while for DNS changes to propagate, but once completed, the performance improvements were clear.
- Cost: I should stay under the free tier of AWS so it's more than alright. In case the price grows, I have billing restriction at $5 per month so it should never get higher than that.
The Takeaway
Migrating from Vercel to AWS was mainly driven by the need for better performance and more control over my infrastructure. With AWS, I gained the flexibility to optimize my setup with CloudFront, S3, and ACM, ensuring faster load times and secure connections.
The integration of GitHub Actions for automated deployment improved my workflow by reducing manual intervention and the potential for errors.