Full AWS Practitioner Certification Question

A digital publishing startup is running a containerized image processing service using Amazon ECS on AWS Fargate. The service generates various sizes of uploaded media files and saves the processed outputs to an Amazon S3 bucket. The team wants to ensure that the ECS tasks can securely write to the designated S3 bucket. What is the most effective and secure way to grant the necessary access?