First, define the IAM role for read-only access. In AWS IAM, create a role with the AmazonS3ReadOnlyAccess managed policy, or a custom policy that grants only the exact bucket and paths you need. Use least privilege. Attach the IAM role to the instance or task running inside your private subnet. This keeps static credentials out of your code.
Next, make the private subnet see S3 without opening it to the outside world. Use a VPC Endpoint for S3. The gateway-type endpoint routes S3 traffic over Amazon’s internal network. No NAT gateway required, no public IP. Add the correct route in your private subnet’s route table, target the S3 endpoint, and confirm DNS resolution inside the VPC.
If you must go through a proxy for security inspection or compliance logging, deploy a proxy inside the VPC. This can be a small EC2 instance or container handling outbound requests. Configure it to allow only S3 traffic and block all else. Lock down security groups so only your workloads can connect to the proxy, and the proxy can only reach the VPC endpoint or allowed AWS services.