Just to put the extremely simple answer. Just use the hash location strategy for the router if you are hosting on S3.
export const AppRoutingModule: ModuleWithProviders = RouterModule.forRoot(routes, { useHash: true, scrollPositionRestoration: 'enabled' });
export const AppRoutingModule: ModuleWithProviders = RouterModule.forRoot(
routes,
{
useHash: true,
scrollPositionRestoration: 'enabled'
}
);