Skip to content
a library for exposing object in the AWS S3 bucket to the ASP.NET Core Application with IFileProvider
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AWSS3FileProvider
.gitignore
AWSS3FileProvider.sln
README.md

README.md

AWS S3 File Provider

A library to expose object in the AWS S3 bucket to ASP.NET Core Application with IFileProvider.

How to use it?

  • Add AWS S3 setting in the appSetting.json
{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AWSS3Setting": {
    "AccessKeyId": "xxx",
    "AccessKeySecret": "xxx++k4UvbOfb",
    "RegionName": "us-east-1",
    "BucketName": "lamondtest"
  },
  "AllowedHosts": "*"
}


  • Enable the S3FileProvider in the Configure method
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      AWSS3Setting o = new AWSS3Setting();
      Configuration.Bind("AWSS3Setting", o);

      app.UseStaticFiles(new StaticFileOptions
      {
          FileProvider = new S3FileProvider(o),
          RequestPath = "/files"
      });

      app.UseMvc();
  }

That's all.

You can’t perform that action at this time.