Deploy Angular application in 5 minutes on AWS S3
Today I would like to show you how to deploy your single-page application on AWS first time and update your project after some changes. This is much easier than you can imagine.
First of all, we need to prepare our application for production. Go to your project and run this command
ng build — prod — aot — env=prod;
The build project will be stored in the
aot) compilation is a powerful tool. It speeds up application boot time by 2–3 times.
I hope you have already an AWS account.
Go to S3 service
Create a new bucket with default settings and some name we will use later
Now go to your bucket properties and change static website hosting parameters. Change the index document and the error document
So now you have prepared the place for our single page application. The last thing we need is to deploy
dist code to S3 bucket.
Deploy our code to S3 bucket
name-of-bucket on your name. Run this command from project dir
aws s3 sync dist/. s3://name-of-bucket — acl public-read
Look for endpoint and click on it. Now you should see you single page application
Thank you for your attention
Thank you for your attention. If you have some question or advice feel free to contact me. I’ll be glad to help you.