Class AWSConfigs
- Namespace
- Amazon
- Assembly
- AWSSDK.Core.dll
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" />
<s3 useSignatureVersion4="true" />
<proxy host="localhost" port="8888" username="1" password="1" />
<dynamoDB>
<dynamoDBContext tableNamePrefix="Prod-">
<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>
public static class AWSConfigs
- Inheritance
-
AWSConfigs
- Inherited Members
Fields
AWSProfileNameKey
Key for the AWSProfileName property. AWSProfileName
public const string AWSProfileNameKey = "AWSProfileName"
Field Value
AWSProfilesLocationKey
Key for the AWSProfilesLocation property. LogMetrics
public const string AWSProfilesLocationKey = "AWSProfilesLocation"
Field Value
AWSRegionKey
Key for the AWSRegion property. AWSRegion
public const string AWSRegionKey = "AWSRegion"
Field Value
EndpointDefinitionKey
Key for the EndpointDefinition property. EndpointDefinition
public const string EndpointDefinitionKey = "AWSEndpointDefinition"
Field Value
LogMetricsKey
Key for the LogMetrics property. LogMetrics
public const string LogMetricsKey = "AWSLogMetrics"
Field Value
LoggingKey
Key for the Logging property. Logging
public const string LoggingKey = "AWSLogging"
Field Value
ResponseLoggingKey
Key for the ResponseLogging property.
public const string ResponseLoggingKey = "AWSResponseLogging"
Field Value
UseSdkCacheKey
Key for the UseSdkCache property. UseSdkCache
public const string UseSdkCacheKey = "AWSCache"
Field Value
Properties
AWSProfileName
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 static string AWSProfileName { get; set; }
Property Value
AWSProfilesLocation
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 static string AWSProfilesLocation { get; set; }
Property Value
AWSRegion
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"/>
</configSections>
<aws region="us-west-2" />
public static string AWSRegion { get; set; }
Property Value
CSMConfig
public static CSMConfig CSMConfig { get; set; }
Property Value
ClockOffset
The calculated clock skew correction, if there is one. This field will be set if a service call resulted in an exception and the SDK has determined that there is a difference between local and server times.
If CorrectForClockSkew is set to true, this value will be set to the correction, but it will not be used by the SDK and clock skew errors will not be retried.
[Obsolete("This value is deprecated in favor of IClientConfig.ClockOffset")]
public static TimeSpan ClockOffset { get; }
Property Value
CorrectForClockSkew
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. ClockOffset will be updated with the calculated offset even if this field is set to false, though requests will not be corrected or retried. Ignored if ManualClockCorrection is set.
public static bool CorrectForClockSkew { get; set; }
Property Value
EndpointDefinition
Configures if the SDK should use a custom configuration file that defines the regions and endpoints.
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK"/>
</configSections>
<aws endpointDefinition="c:\config\endpoints.json" />
public static string EndpointDefinition { get; set; }
Property Value
HttpClientFactory
public static HttpClientFactory HttpClientFactory { get; set; }
Property Value
LogMetrics
Configures if the SDK should log performance metrics. This setting configures the default LogMetrics property for all clients/configs. Changes to this setting will only take effect in newly-constructed clients.
The setting can be configured through App.config, for example:
<appSettings>
<add key="AWSLogMetrics" value="true"/>
</appSettings>
[Obsolete("This property is obsolete. Use LoggingConfig.LogMetrics instead.")]
public static bool LogMetrics { get; set; }
Property Value
Logging
Configures how the SDK should log events, if at all. Changes to this setting will only take effect in newly-constructed clients.
The setting can be configured through App.config, for example:
<appSettings>
<add key="AWSLogging" value="log4net"/>
</appSettings>
[Obsolete("This property is obsolete. Use LoggingConfig.LogTo instead.")]
public static LoggingOptions Logging { get; set; }
Property Value
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"/>
</configSections>
<aws>
<logging logTo="Log4Net, SystemDiagnostics" logResponses="Always" logMetrics="true" />
</aws>
public static LoggingConfig LoggingConfig { get; }
Property Value
ManualClockCorrection
Manual offset to apply to client clock. This is a global setting that overrides ClockOffset value calculated for all service endpoints.
public static TimeSpan? ManualClockCorrection { get; set; }
Property Value
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"/>
</configSections>
<aws>
<proxy host="localhost" port="8888" username="1" password="1" bypassList="addressexpr1;addressexpr2;..." bypassOnLocal="true" />
</aws>
public static ProxyConfig ProxyConfig { get; }
Property Value
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"/>
</configSections>
<aws region="us-west-2" />
public static RegionEndpoint RegionEndpoint { get; set; }
Property Value
ResponseLogging
Configures when the SDK should log service responses. Changes to this setting will take effect immediately.
The setting can be configured through App.config, for example:
<appSettings>
<add key="AWSResponseLogging" value="OnError"/>
</appSettings>
[Obsolete("This property is obsolete. Use LoggingConfig.LogResponses instead.")]
public static ResponseLoggingOption ResponseLogging { get; set; }
Property Value
UseAlternateUserAgentHeader
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 static bool UseAlternateUserAgentHeader { get; set; }
Property Value
UseSdkCache
Configures if the SDK Cache should be used, the default value is true.
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK"/>
</configSections>
<aws useSdkCache="true" />
public static bool UseSdkCache { get; set; }
Property Value
Methods
AddTraceListener(string, TraceListener)
Add a listener for SDK logging.
public static void AddTraceListener(string source, TraceListener listener)
Parameters
source
stringThe source to log for, e.g. "Amazon", or "Amazon.DynamoDB".
listener
TraceListenerThe listener to add.
Remarks
If the listener does not have a name, you will not be able to remove it later.
GetConfig(string)
public static string GetConfig(string name)
Parameters
name
string
Returns
RemoveTraceListener(string, string)
Remove a trace listener from SDK logging.
public static void RemoveTraceListener(string source, string name)