Amazon S3 is object storage built to store and retrieve any amount of data from anywhere. Redakt can store its media files and other blob data in Amazon S3. Redakt offers S3 integration through an optional NuGet package.
Installation
The Amazon S3 File Store is part of the Amazon AWS provider package. Install the package with the NuGet package manager or the Package Manager Console.
PM> Install-Package Redakt.Providers.Amazon
Service registration
Register Amazon S3 services in the ConfigureServices()
method of your project's Startup.cs
file by adding an AddS3Storage()
call to the Redakt builder instance. The order in which services are added to the Redakt builder is not important.
public void ConfigureServices(IServiceCollection services)
{
// ... framework and other services here
var builder = services.AddRedakt();
builder.AddS3Storage(); // Optionally pass Action<AmazonS3StorageOptions> parameter.
// ... other Redakt services
}
Configuration settings
The Amazon S3 file store is configured through the appsettings.json
file. Any configuration that is not included in the appsettings.json
file will be set to its default values. Additionally, an Action<AmazonS3StorageOptions>
configuration delegate may be passed to the AddS3Storage()
call. Configuration set through this delegate takes priority and overrides values in the appsettings.json
file.
{
"Redakt": {
"FileStore": {
"AwsS3Storage": {
"AwsAccessKeyId": "<your aws access key id>",
"AwsSecretAccessKey": "<your aws secret access key>",
"AwsRegion": "<your aws region>",
"BucketName": "redakt-media"
}
}
}
}
Access Key Id & Secret Access Key
Required. These settings are found in the AWS Console and are used to connect to your S3 service instance. Read here how to manage and retrieve access keys for IAM users.
The Amazon Dynamo DB database and Amazon SNS/SQS service bus modules also require AWS access keys to be set. You can use the same or different access keys, depending on your needs.
Region
Required. Sets the region name for the data center that your Dynamo DB database is hosted in. This must be one of the available Amazon region codes, f.e. eu-west-1
.
Bucket Name
Sets the name of the S3 bucket where files are stored. Defaults to "redakt-media" if not set.