Orchardcore amazon s3 media

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore amazon s3 media is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for configuring Amazon S3 media storage in Orchard Core. Covers the OrchardCore.Media.AmazonS3 and OrchardCore.Media.AmazonS3.ImageCache features, the OrchardCore Media AmazonS3 and Media AmazonS3 ImageCache configuration sections, environment variable names, bucket setup, AWS credentials and

How to use this skill

Skill file

Orchard Core Amazon S3 Media Storage

Module Overview

The OrchardCore.Media.AmazonS3 module stores media in S3 buckets instead of

App_Data:

Media is still served by the Orchard Core site: the Media Cache fetches objects

on demand, which keeps on-the-fly resizing working. Only one storage provider

is active at a time. Invalid configuration logs an error and falls back to local

file storage.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Media.AmazonS3",
        "OrchardCore.Media.AmazonS3.ImageCache"
      ],
      "disable": []
    }
  ]
}

Amazon S3 Media Storage (`OrchardCore:Media:AmazonS3`)

| Property | Description | Default |

|---|---|---|

| BucketName | Bucket name (required). Templatable. | |

| Region | Region endpoint, e.g. eu-central-1. Region or ServiceURL is required. | |

| ServiceURL | Custom endpoint (emulators, S3-compatible stores). Use instead of Region. | |

| ForcePathStyle | Path-style addressing (http://host/bucket), required by emulators. | false |

| Profile, ProfilesLocation | AWS CLI profile and custom profiles file. | |

| Credentials:AccessKey, Credentials:SecretKey | Explicit keys when hosted outside AWS. | |

| BasePath | Sub-path inside the bucket, e.g. /media. Templatable. | "" |

| CreateBucket | Create the bucket on startup (without ACLs). | false |

| RemoveBucket | Delete the bucket when the tenant is removed. | false |

Hosted in AWS (EC2, ECS, EKS), BucketName is enough; credentials come from the

IAM role:

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "BucketName": "my-orchard-media",
        "Region": "eu-central-1",
        "BasePath": "/media"
      }
    }
  }
}

Hosted outside AWS, prefer a profile or environment variables over keys in

appsettings.json:

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "BucketName": "my-orchard-media",
        "Region": "eu-central-1",
        "Profile": "default",
        "BasePath": "/media",
        "CreateBucket": true
      }
    }
  }
}

Environment variables: OrchardCore__Media__AmazonS3__BucketName,

OrchardCore__Media__AmazonS3__Credentials__AccessKey,

OrchardCore__Media__AmazonS3__Credentials__SecretKey.

AWS Credentials Loading Order

OrchardCore:Media:AmazonS3 is a subset of AWSOptions and resolves credentials

in this order:

  1. The Credentials section.
  2. Shared credentials file at ProfilesLocation (profile and location set).
  3. SDK Store (Windows only) when only the profile is set.
  4. Shared credentials file in the default location when only the profile is set.
  5. Web Identity Federation (OIDC token file from environment variables).
  6. CredentialsProfileStoreChain (SDK Store, then default shared file).
  7. Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  8. ECS task or EC2 instance credentials (IAM roles).

Bucket Access

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AddPerm",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/YOUR-BASE-PATH/*"
    }
  ]
}

Tenant Templating

BucketName and BasePath accept Liquid with ShellSettings in scope.

{{ ShellSettings.Name }} is lowercased; the full name must follow S3 bucket

naming rules. Only default Liquid filters and tags are available.

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "BucketName": "{{ ShellSettings.Name }}-media",
        "Region": "eu-central-1",
        "BasePath": "/media"
      }
    }
  }
}

Single bucket with a folder per tenant:

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "BucketName": "shared-media",
        "Region": "eu-central-1",
        "BasePath": "{{ ShellSettings.Name }}/Media"
      }
    }
  }
}

Local S3 Emulator

Use ServiceURL (no Region), ForcePathStyle: true, and dummy credentials:

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "ServiceURL": "http://localhost:9444/",
        "Profile": "default",
        "Credentials": {
          "SecretKey": "dummy",
          "AccessKey": "dummy"
        },
        "BasePath": "/media",
        "CreateBucket": true,
        "RemoveBucket": true,
        "BucketName": "media",
        "ForcePathStyle": true
      }
    }
  }
}
# S3Mock (Adobe)
docker run -p 9444:9090 -t adobe/s3mock:latest

# LocalS3 (Robothy)
docker run -d -e MODE=IN_MEMORY -p 9444:80 luofuxiang/local-s3:latest

Media Cache

Amazon S3 Image Cache (`OrchardCore:Media:AmazonS3:ImageCache`)

Stores resized images in S3 (AWSS3ResizedImageCache, options

AwsMediaImageCacheOptions). Depends on OrchardCore.Media.AmazonS3.

BucketName and BasePath can be templated like the storage section.

{
  "OrchardCore": {
    "Media": {
      "AmazonS3": {
        "ImageCache": {
          "BucketName": "media-image-cache",
          "BasePath": "/cache",
          "CreateBucket": true,
          "RemoveBucket": false
        }
      }
    }
  }
}

Resumable Uploads

When OrchardCore.Media.Tus is also enabled, TUS partial uploads are buffered

with S3 multipart uploads (S3TusTempStore) under a _tus-uploads prefix, so

any instance can continue an upload. Without a valid S3 configuration, TUS keeps

using the local temp directory. See orchardcore-media-gallery for TUS,

SignalR and multi-instance guidance.

Upgrading from 3.x

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.