AWS SDK Version 4 for .NET
API Reference

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.

Configuration options that apply to the entire SDK. These settings can be configured through app.config or web.config. Below is a full sample configuration that illustrates all the possible options.

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws region="us-west-2">
  <logging logTo="Log4Net, SystemDiagnostics" logResponses="Always" logMetrics="true" />
  <proxy host="localhost" port="8888" username="1" password="1" />
              
  <dynamoDB>
    <dynamoDBContext tableNamePrefix="Prod-" metadataCachingMode="Default" disableFetchingTableMetadata="false" retrieveDateTimeInUtc="false">
            
      <tableAliases>
        <alias fromTable="FakeTable" toTable="People" />
        <alias fromTable="Persons" toTable="People" />
      </tableAliases>
            
      <mappings>
        <map type="Sample.Tests.Author, SampleDLL" targetTable="People" />
        <map type="Sample.Tests.Editor, SampleDLL" targetTable="People">
          <property name="FullName" attribute="Name" />
          <property name="EmployeeId" attribute="Id" />
          <property name="ComplexData" converter="Sample.Tests.ComplexDataConverter, SampleDLL" />
          <property name="Version" version="true" />
          <property name="Password" ignore="true" />
        </map>
      </mappings>
            
    </dynamoDBContext>
  </dynamoDB>
</aws>
            

Inheritance Hierarchy

System.Object
  Amazon.AWSConfigs

Namespace: Amazon
Assembly: AWSSDK.Core.dll
Version: 3.x.y.z

Syntax

C#
public static class AWSConfigs

The AWSConfigs type exposes the following members

Properties

NameTypeDescription
Public Property Static Property ApplicationName System.String

The unique application name for the current application. This values is currently used by high level APIs (Mobile Analytics Manager and Cognito Sync Manager) to create a unique file path to store local database files. Changes to this setting will only take effect in newly-constructed objects using this property.

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws applicationName="" />
            

Public Property Static Property AWSCredentialsGenerators System.Collections.Generic.List<Amazon.Runtime.Credentials.DefaultAWSCredentialsIdentityResolver.CredentialsGenerator>

Global configuration option to override the search order for credentials when creating SDK service clients without credentials.

This option is equivalent to the Amazon.Runtime.FallbackCredentialsFactory.CredentialsGenerators, but it should only be used if the default order does not meet your application needs.

When set, all service clients will use the specified providers so you must guarantee they return valid credentials for the operations to succeed.

Setting this property is not thread safe and should only be set at application startup.

Public Property Static Property AWSProfileName System.String

Profile name for stored AWS credentials that will be used to make service calls. Changes to this setting will only take effect in newly-constructed clients.

To reference the account from an application's App.config or Web.config use the AWSProfileName setting.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="development"/>
    </appSettings>
</configuration>
            

Public Property Static Property AWSProfilesLocation System.String

Location of the credentials file shared with other AWS SDKs. By default, the credentials file is stored in the .aws directory in the current user's home directory. Changes to this setting will only take effect in newly-constructed clients.

To reference the profile from an application's App.config or Web.config use the AWSProfileName setting.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfilesLocation" value="c:\config"/>
    </appSettings>
</configuration>
            

Public Property Static Property AWSRegion System.String

Configures the default AWS region for clients which have not explicitly specified a region. Changes to this setting will only take effect for newly constructed instances of AWS clients. This setting can be configured through the App.config. For example:

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws region="us-west-2" />
            

Public Property Static Property CorrectForClockSkew System.Boolean

Determines if the SDK should correct for client clock skew by determining the correct server time and reissuing the request with the correct time. Default value of this field is True.

Public Property Static Property CSMConfig Amazon.Util.CSMConfig
Public Property Static Property InitializeCollections System.Boolean

When true the collections used on the service API request and response objects are initialized to an empty collection. The collections are sent as part of requests when a collection is non-empty.

Setting InitializeCollections to false means all collections used on the service API request and response objects are initialized to null. The collections are sent as part of requests when the collection non-null including an empty collection.

The default value is false. This was changed in V4 of the SDK to improve performance by not creating unnecessary collection instances and provide more control when the collection is sent to the service. You can set this value to true to revert to the collection initialization behavior of V3.

Setting this property is not thread safe and should only be set at application startup.

Public Property Static Property LoggingConfig Amazon.Util.LoggingConfig

Configuration for the Logging section of AWS configuration. Changes to some settings may not take effect until a new client is constructed. Example section:

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws>
  <logging logTo="Log4Net, SystemDiagnostics" logResponses="Always" logMetrics="true" />
</aws>
            

Public Property Static Property ManualClockCorrection System.Nullable<System.TimeSpan>

Manual offset to apply to client clock. This is a global setting that overrides ClockOffset value calculated for all service endpoints.

Public Property Static Property ProxyConfig Amazon.Util.ProxyConfig

Configuration for the Proxy section of AWS configuration. Changes to some settings may not take effect until a new client is constructed. Example section:

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws>
  <proxy host="localhost" port="8888" username="1" password="1" bypassList="addressexpr1;addressexpr2;..." bypassOnLocal="true" />
</aws>
            

Public Property Static Property RegionEndpoint Amazon.RegionEndpoint

Configuration for the region endpoint section of AWS configuration. Changes may not take effect until a new client is constructed. Example section:

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws region="us-west-2" />
            

Public Property Static Property StreamingUtf8JsonReaderBufferSize System.Nullable<System.Int32>

Configures the default buffer size for the the StreamingUtf8JsonReader used for buffering data from the stream passed into its constructor. If this isn't set, the SDK will default to 4096 bytes. Setting this property is not thread safe and should only be set at application startup.

Public Property Static Property TelemetryProvider Amazon.Runtime.Telemetry.TelemetryProvider

Gets or sets the global Amazon.AWSConfigs.TelemetryProvider instance.

This global telemetry provider is used to collect and report telemetry data (such as traces and metrics) for all AWS SDK operations.

Public Property Static Property UseAlternateUserAgentHeader System.Boolean

When set to true, the service client will use the x-amz-user-agent header instead of the User-Agent header to report version and environment information to the AWS service. Note: This is especially useful when using a platform like WebAssembly which doesn't allow to specify the User-Agent header.

Public Property Static Property UseSdkCache System.Boolean

Configures if the SDK Cache should be used, the default value is true.

<configSections>
  <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws useSdkCache="true" />
            

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.7.2 or higher.

NameDescription
Public Method Static Method AddTraceListener(string, TraceListener)

Add a listener for SDK logging.

Public Method Static Method GenerateConfigTemplate()

Generates a sample XML representation of the SDK configuration section.

Public Method Static Method GetConfig(string)
Public Method Static Method RemoveTraceListener(string, string)

Remove a trace listener from SDK logging.

Fields

NameTypeDescription
Field Static Field AWSProfileNameKey System.String

Key for the AWSProfileName property. Amazon.AWSConfigs.AWSProfileName

Field Static Field AWSProfilesLocationKey System.String

Key for the AWSProfilesLocation property.

Field Static Field AWSRegionKey System.String

Key for the AWSRegion property. Amazon.AWSConfigs.AWSRegion

Field Static Field InitializeCollectionsKey System.String

Key for the InitializeCollections property. Amazon.AWSConfigs.InitializeCollections

Field Static Field StreamingUtf8JsonReaderBufferSizeKey System.String

Key for the StreamingUtf8JsonReaderBufferSize property. Amazon.AWSConfigs.StreamingUtf8JsonReaderBufferSize

Field Static Field UseSdkCacheKey System.String

Key for the UseSdkCache property. Amazon.AWSConfigs.UseSdkCache

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer