AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Provides access to read and write to the shared credentials INI file. The file is read, parsed, and validated at construction time. Changes can be made using the RegisterProfile() and UnregisterProfile() methods. This class is not threadsafe.
Namespace: Amazon.Runtime.CredentialManagement
Assembly: AWSSDK.Core.dll
Version: 3.x.y.z
public class SharedCredentialsFile ICredentialProfileSource, ICredentialProfileStore
The SharedCredentialsFile type exposes the following members
Name | Description | |
---|---|---|
SharedCredentialsFile() |
Construct a new SharedCredentialsFile in the default location. |
|
SharedCredentialsFile(string) |
Construct a new SharedCredentialsFile. |
Name | Type | Description | |
---|---|---|---|
ConfigFilePath | System.String |
The path to the config file |
|
DefaultConfigFilePath | System.String |
The default file path for the config file. By default it searches in ~/.aws/config |
|
DefaultFilePath | System.String |
The default file path for the credentials file. By default it searches for ~/.aws/credentials. This behavior can be overriden. |
|
FilePath | System.String |
The path to the credentials file |
Name | Description | |
---|---|---|
CopyProfile(string, string) |
Make a copy of the profile with fromProfileName called toProfileName. |
|
CopyProfile(string, string, bool) |
Make a copy of the profile with fromProfileName called toProfileName. |
|
ListProfileNames() | ||
ListProfiles() | ||
RegisterProfile(CredentialProfile) |
Add the profile given. If the profile already exists, update it. |
|
RenameProfile(string, string) |
Rename the profile with oldProfileName to newProfileName. |
|
RenameProfile(string, string, bool) |
Rename the profile with oldProfileName to newProfileName. |
|
TryGetProfile(string, out CredentialProfile) | ||
UnregisterProfile(string) |
Deletes the section with the given ProfileName from the SharedCredentialsFile, if one exists. |
Name | Type | Description | |
---|---|---|---|
DefaultConfigDirectory | System.String |
The default directory for the config file. By default it searches in ~/.aws This behavior can be overriden. |
|
DefaultDirectory | System.String |
The default directory for the credentials file. By default it searches in ~/.aws. This behavior can be overridden. |
|
DefaultProfileName | System.String | ||
SharedConfigFileEnvVar | System.String | ||
SharedCredentialsFileEnvVar | System.String |
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5