Using IAM profiles with pluginRepositories

I’ve deployed a custom plugin to S3, and I’m using pluginRepositories in settings.gradle to access it. This all works great! Now I’d like to use IAM profiles on AWS EC2 nodes to access this without needing to provide explicit AWS access creds. Unfortunately, I can’t seem to figure out how to define a buildscript section within settings.gradle. I’ve tried following the pattern from S3 AwsCredentials should be able to load from an AWS profile file, but that doesn’t seem to work, since I’m using pluginRepositories in settings.gradle. Any suggestions?