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.
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.
I hope it helps you use CloudFront with S3 & ApiGateway