Image 1 of 1

AWS S3

Product information

By Vendure Open Source

Store images and other assets in AWS S3

npm install @vendure/asset-server-plugin
Support languages
en
Integration type
Core
Category
Storage
Compatible with
^3.0.0
Latest version
3.0.0
Last published
Jul 17, 2024
Downloads in past month
14,775

Prerequisite

The AssetServerPlugin is part of a standard Vendure installation, but if it is not already installed, you must install it:

npm install @vendure/asset-server-plugin

Install AWS SDKs

Before using this strategy, make sure you have the @aws-sdk/client-s3 and @aws-sdk/lib-storage package installed:

npm install @aws-sdk/client-s3 @aws-sdk/lib-storage

Configure the AssetServerPlugin for S3

import { AssetServerPlugin, configureS3AssetStorage } from '@vendure/asset-server-plugin';
import { DefaultAssetNamingStrategy } from '@vendure/core';
import { fromEnv } from '@aws-sdk/credential-providers';

// ...

plugins: [
  AssetServerPlugin.init({
    route: 'assets',
    assetUploadDir: path.join(__dirname, 'assets'),
    namingStrategy: new DefaultAssetNamingStrategy(),
    storageStrategyFactory: configureS3AssetStorage({
      bucket: 'my-s3-bucket',
      credentials: fromEnv(), // or any other credential provider
      nativeS3Configuration: {
        region: process.env.AWS_REGION,
      },
    }),
}),

Complete documentation

See the S3AssetStorageStrategy docs for full documentation.

Vendure
Get started

Create your first commerce experience with Vendure in less than 2 minutes

Vendure is a registered trademark. Our trademark policy ensures that our brand and products are protected. Feel free to reach out if you have any questions about our trademarks.

Newsletter

Get the latest product news and announcements delivered directly to your inbox.

© Copyright 2022 - 2024, Vendure GmbH. All rights reserved.