I try to abstract something like the filesystem. So I would use something like Flysystem for PHP, or pyfilesystem for Python where an environment variable would decide whether it's saved to local disk or S3.
For some more difficult use cases I have to be pragmatic and decide on the circumstances. E.g. when needing presigned URLs (which is an S3 feature) I will use the native S3 SDK, it's not the cleanest way, but it gets the job done. Only when it starts getting annoying / slowing the development speed will I abstract it away. Security is important and I keep a high standard there, but when it comes to clean abstraction I will occasionally make compromises, knowing that often we will only need one implementation or that feature might be thrown away (I work freelance mostly with startups or SMEs).
For some more difficult use cases I have to be pragmatic and decide on the circumstances. E.g. when needing presigned URLs (which is an S3 feature) I will use the native S3 SDK, it's not the cleanest way, but it gets the job done. Only when it starts getting annoying / slowing the development speed will I abstract it away. Security is important and I keep a high standard there, but when it comes to clean abstraction I will occasionally make compromises, knowing that often we will only need one implementation or that feature might be thrown away (I work freelance mostly with startups or SMEs).