Final answer:
To ensure S3 buckets can only be accessed via CloudFront, you can use the CloudFront Origin Access Identity (OAI), bucket policies, and CloudFront behaviors.
Step-by-step explanation:
S3 buckets
can be accessed via
CloudFront
by using the
CloudFront Origin Access Identity (OAI)
feature in combination with
bucket policies
and
CloudFront behaviors
. The OAI is used to restrict access to the S3 bucket, while the bucket policies define who can access the bucket and in what way. The CloudFront behaviors determine how CloudFront serves content from the bucket.