CloudFront is built on the top of Amazon S3. These two services serve different purposes and cannot be used interchangeably. We have to use depending on our goals and it can help us to avoid making potentially costly mistakes.
Amazon S3 is like other hosting solutions i.e. storing our files at a central location for easy access. It is better if the low cost of bandwidth and storage is important than the speed of access. In short, Amazon S3 is used for big files and economic matters.
CloudFront should be used if you want faster access to data but the speed comes at a cost. This is more suitable for smaller and speeds matters more than the cost. In short, CloudFront is used for small files and for more speed access.
If you wish to learn various tools of AWS cloud platform then register for this AWS Course by Intellipaat that provides Instructor-led classes, certification, and job assistance.
Also, watch this video on the AWS Cloud Front: