Host Angular 2 or 4 or 5 version in AWS S3 using cloudfront

Why this is required to do ?

Because S3 website doesn’t know URL rewriting concept which other server knows. Whenever type any route path its should land first on index.html then further. Need to give command to S3 setting and AWS Cloudfront error response code.

    1. Create a Angular build
    2. Copy paste dist folder source and paste into S3 bucket
    3. Set up S3 website hosting index and error page to index.html
    4. Once completed uploading a code into S3 create Cloudfront as per your requirement and assign bucket to it.
    5. Go to Error response tab in Cloudfront set up value as per below reference images