S3 static website hosting
Now that our application has been created, let's deploy it to a remote server. Instead of maintaining a web server, such as Apache or Nginx in an EC2 instance, let's keep it serverless and use an S3 bucket with the S3 website-hosting feature enabled.
Setting up an S3 bucket
To get started, create an S3 bucket either from the AWS console or with the following AWS CLI command:
aws s3 mb s3://serverlessmovies.com
Next, build the web application for production mode:
ng build --prod
The --prod
flag will generate an optimized version of the code and do additional build steps, such as JavaScript and CSS minification, dead code elimination, and bundling:

This will give you the dist/
directory withindex.html
and all the bundled js
files ready for production. Configure the bucket to host a website:
aws s3 website s3://serverlessmovies.com -- index-document index.html
Copy everything within the dist/ folder into the S3 bucket we created earlier:
aws s3 cp --recursive dist/ s3://serverlessmovies...