Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Warrenn/856defce94e2d3d899f5884d5e5a0a8d to your computer and use it in GitHub Desktop.

Select an option

Save Warrenn/856defce94e2d3d899f5884d5e5a0a8d to your computer and use it in GitHub Desktop.
FallbackCredentialsFactory.cs
FallbackCredentialsFactory.CredentialsGenerators.Insert(0, () =>
{
var profileName = Environment.GetEnvironmentVariable("AWS_PROFILE");
if (string.IsNullOrWhiteSpace(profileName)) return null;
var chain = new CredentialProfileStoreChain();
return !chain.TryGetProfile(profileName, out var profile) ? null : new BasicAWSCredentials(profile.Options.AccessKey, profile.Options.SecretKey);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment