Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure accelerated endpoint in appsettings.json #656

Closed
marcuslindblom opened this issue May 20, 2017 · 6 comments
Closed

Configure accelerated endpoint in appsettings.json #656

marcuslindblom opened this issue May 20, 2017 · 6 comments
Assignees
Labels
feature-request A feature should be added or improved.

Comments

@marcuslindblom
Copy link

I have tried to configure AWS to use the accelerated endpoint using appsettings.json with this syntax:

"AWS": {
  "Profile": "default",
  "Region": "eu-west-1",
  "UseAccelerateEndpoint": true
},

But for instance the GetPreSignedURL does not return an URL that points to the accelerated endpoint. How can this be configured?

Your Environment

  • AWSSDK.Core version used: 3.3.6.1
  • AWSSDK.Extensions.NETCore.Setup version: 3.3.1
  • Service assembly and version used:
  • Operating System and version:
  • Visual Studio version:
  • Targeted .NET platform: netcoreapp1.1

.NET Core Info

  • .NET Core version used for development:
  • .NET Core version installed in the environment where application runs:
  • Output of dotnet --info:
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.1
  • Contents of project.json/project.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
    <PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.1" />
    <PackageReference Include="AWSSDK.S3" Version="3.3.6.1" />
    <PackageReference Include="AWSSDK.ElasticTranscoder" Version="3.3.1.14" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
    <PackageReference Include="Raven.Client" Version="4.0.0-alpha-40013" />
    <PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.0.2" />
    <PackageReference Include="WebSocketManager" Version="1.0.1" />
  </ItemGroup>
</Project>
@vellozzi
Copy link
Contributor

UseAccelerateEndpoint isn't supported in appsettings.json yet. It will be added to our feature request list at https://github.com/aws/aws-sdk-net/blob/master/FEATURE_REQUESTS.md
For now you should use the AmazonS3Config.UseAccelerateEndpoint property.

@vellozzi vellozzi self-assigned this May 23, 2017
@marcuslindblom
Copy link
Author

@vellozzi How can I set the config property when I add the services like this?

services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
services.AddAWSService<IAmazonS3>();

@normj normj added the feature-request A feature should be added or improved. label May 23, 2017
@marcuslindblom
Copy link
Author

@normj Maybe you can answer my question above?

@normj
Copy link
Member

normj commented May 27, 2017

As @vellozzi said we don't have support yet for setting AmazonS3Config.UseAccelerateEndpoint via this package yet. We do want to extend the capabilites of the package to handle cases like this. Till then you need to manually create the S3 client and add it to the list of services. Here is a snippet of code that does that.

public void ConfigureServices(IServiceCollection services)
{
    services.AddDefaultAWSOptions(Configuration.GetAWSOptions());

    var options = Configuration.GetAWSOptions();

    var credentialChains = new Amazon.Runtime.CredentialManagement.CredentialProfileStoreChain();
    Amazon.Runtime.AWSCredentials credentials;
    if(!credentialChains.TryGetAWSCredentials(options.Profile, out credentials))
    {
        credentials = Amazon.Runtime.FallbackCredentialsFactory.GetCredentials();
    }

    var s3Config = new AmazonS3Config
    {
        RegionEndpoint = options.Region,
        UseAccelerateEndpoint = true
    };

    services.AddSingleton<IAmazonS3>(new AmazonS3Client(credentials, s3Config));

    // Add framework services.
    services.AddMvc();
}

@vellozzi
Copy link
Contributor

Feature request added to https://github.com/aws/aws-sdk-net/blob/master/FEATURE_REQUESTS.md . Closing this issue.

@jineshpatel99
Copy link

@normj @vellozzi Do we have this feature now through config or we are still waiting on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

4 participants