You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm using this library on dev machine and the library tries to access EC2 metadata on every restart of the app that's very slow and annoying.
After some digging I have found that the problem is in ClientFactory.CreateConfig(...). Specifically, this code tries to avoid the issue above:
// Skip RegionEndpoint because it is set below and calling the get method on the// property triggers the default region fallback mechanism.if(string.Equals(property.Name,"RegionEndpoint",StringComparison.Ordinal))continue;
But a few lines below there is check related to RetryMode which accesses config.DefaultConfigurationMode when defaultConfig.RetryMode is Legacy (the default). The access of DefaultConfigurationMode triggers the access of RegionEndpoint internally, which this code tries to avoid in the first place.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
The initialization of service client is fast on dev machine
Current Behavior
The initialization of service client is slow on dev machine because it is trying to incorrectly access EC2 metadata
Asp.Net core app initialized from default template:
builder.Services.AddDefaultAWSOptions(builder.Configuration.GetAWSOptions());builder.Services.AddAWSService<IAmazonCloudFormation>();app.Services.GetRequiredService<IAmazonCloudFormation>();// <- this shouldn't take several seconds
This has been fixed in V4, see this comment for more details: #2022 (comment)
As Norm mentioned there, V3 relies on a lot of reflection so this isn't something we can easily back-port. For a workaround locally, you can add "DefaultsMode": "Standard" to your appsettings file.
Describe the bug
When I'm using this library on dev machine and the library tries to access EC2 metadata on every restart of the app that's very slow and annoying.
After some digging I have found that the problem is in
ClientFactory.CreateConfig(...)
. Specifically, this code tries to avoid the issue above:But a few lines below there is check related to
RetryMode
which accessesconfig.DefaultConfigurationMode
whendefaultConfig.RetryMode
isLegacy
(the default). The access ofDefaultConfigurationMode
triggers the access ofRegionEndpoint
internally, which this code tries to avoid in the first place.Regression Issue
Expected Behavior
The initialization of service client is fast on dev machine
Current Behavior
The initialization of service client is slow on dev machine because it is trying to incorrectly access EC2 metadata
Reproduction Steps
appsettings.json
Asp.Net core app initialized from default template:
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.Extensions.NETCore.Setup 3.7.301
AWSSDK.CloudFormation 3.7.401.12
Targeted .NET Platform
.NET 9
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: