There are a few ways to disable directory listing in Amazon CloudFront. The easiest way is to create an empty index.html file in the root directory of your website. When CloudFront requests a directory/folder that doesn't contain an index file, it will show a 403 Forbidden error.
You can also use a web.config file with an empty < Directory > section. This will also return a 403 error for any directory that doesn't contain an index file.
If you want to return a different error code (such as 404 Not Found), you can create a custom error page. To do this, create an error page with the desired error code and upload it to your website. Then, in the CloudFront console, go to the Error Pages tab and configure your error page.
For more information, see the following resources: