The CloudFront cache response in the edge location based on the cache control header. The CloudFront monitor the cache expires time and serves cached files until the cache expires. We can immediately invalidate the cache from the CloudFront directly by the AWS CLI command or the AWS CloudFront console.

Before you will use the aws-cli command, please make sure that the aws-cli tool is installed in your machine, If not, just install AWS-CLI latest version. 

you can do one of the following remove a cached files,

If you unable to find the CloudFront distribution id, list out or get cloudfront distribution id using the AWS CLI command,


$ aws cloudfront list-distributions 

$ aws cloudfront list-distributions | grep Id

Invalidation of cloudfront distribution via aws cli,

Syntax:
aws cloudfront create-invalidation --distribution-id [DistributionID]  --paths "/[PATH]*"

​aws cloudfront create-invalidation --distribution-id THE1LINUX1FAQ --paths "/*"

If you want to invalidate particular directory, just add the object directory name,
aws cloudfront create-invalidation --distribution-id THE1LINUX1FAQ --paths "/thelinuxfaq*"

Invalidate particular file,
aws cloudfront create-invalidation ---distribution-id THE1LINUX1FAQ --paths "/thelinuxfaq/index.html"

It's possible to see the current status of an invalidation, get-invalidation option helps you see the details,
aws cloudfront get-invalidation --id FAQIDLINUX12THE --distribution-id THE1LINUX1FAQ

Note: Please change the distribution-id to yours, "THE1LINUX1FAQ" this is used for example only.