User guide

Table Of Contents
[profile_name]
aws_access_key_id = accessKey
aws_secret_access_key = secretKey
A profile can optionally include a session token. For more information, see Best Practices for Managing
AWS Access Keys.
Tip
If you include a profile named default, the SDK for .NET will use that profile by default if it
cannot find the specified profile.
By default, the SDK for .NET searches for profiles only in the user's home directory. If, for example, your
application is running under Local System, the SDK for .NET will not be able to find those profiles. In that
case, the application cannot use profiles from the SDK Store. However, you can store profiles in a cre-
dentials file that is stored in an arbitrary location, such as C:\aws_service_credentials\creden-
tials.You must then explicitly specify the file path in your project's App.config or Web.config file.
For more information, see Specifying a Profile (p. 11).
Using Credentials in an Application
The SDK for .NET searches for credentials in the following order and uses the first available set for the
current application.
1. Access key and secret key values that are stored in the application's App.config or Web.config
file.
We strongly recommend using profiles rather than putting literal credentials in your project files.
2. A specified profile in the SDK Store.
3. A specified profile in the credentials file.
4. A profile named default in the SDK Store.
5. A profile named default in the credentials file.
6. For applications running on an EC2 instance, credentials stored in an instance profile.
Tip
With the AWS CLI or other AWS SDKs, you can also store a set of credentials in the AWS_AC-
CESS_KEY_ID and AWS_SECRET_KEY environment variables.The SDK for .NET does not include
these variables in its credentials search chain. However, you can obtain the keys by calling En-
vironment.GetEnvironmentVariable and then pass them to the client object when you
create it. Credentials specified in this way take precedence over the credentials in the search
chain.
Specifying a Profile
Profiles are the preferred way to use credentials in an application running locally.You can store profiles
in the SDK Store or in the credentials file.You don't have to specify where the profile is stored. Just ref-
erence the profile by name, and the SDK for .NET retrieves the corresponding credentials, as described
in the previous section.
The simplest way to specify a profile is to define an AWSProfileName value in the appSettings section
of your application's App.config or Web.config file. The associated credentials are incorporated into
the application during the build process.
The following example specifies a profile named development.
Version v2.0.0
11
AWS SDK for .NET Developer Guide
Configuring AWS Credentials