Creating a CloudFront distribution from scratch can be challenging.
Because you will need to create a VPC, Lambda, S3 bucket, IAM policies, API Gateway, etc.
***** You can follow me on LinkedIn *****
After that, you will need to connect S3 and API Gateway in a single CloudFront distribution.
This may be a difficult task. I’ve published a Terraform repository for all this.
https://github.com/adililhan/CloudFront-S3-ApiGateway-Terraform-Template
I hope it helps you use CloudFront with S3 & ApiGateway