Its possible to remove or clear a file from CloudFront Edge caches before it expires time. Have to use Invalidation concept to clear the cache, just follow the steps below,
Step 1: Create a necessary IAM Policies and Roles to access the CloudFront from the CLI.
Step 2: Install AWS-CLI on your local machine, either you're using Windows/Linux/MacOS.
Step 3: Configure the Access Key and Secret Key of the IAM user.
Step 4: Get the CloudFront distribution ID using the command,
You can use Invalidations to clear the cache, add the paths to the files clear the cache from CloudFront Edges. Execute the AWS-CLI command below,
The output looks like below,