www/apps/cloud/app/s3/page.mdx
import { getOsShortcut, Kbd } from "docs-ui"
export const metadata = {
title: S3 Storage,
}
In this guide, you'll learn about the managed S3 storage service that Medusa provides as part of your project environments on Cloud.
Medusa offers a managed S3 storage service for your project environments on Cloud. Each environment has its own dedicated S3 bucket that is automatically provisioned when the environment is created.
So, when you create a new project, Medusa creates a production S3 bucket for the production environment. If you create a staging environment, Medusa creates a separate S3 bucket for that environment as well.
Medusa automatically configures your Medusa application hosted on Cloud to use the S3 File Module Provider.
So, you don't need to configure the S3 File Module Provider or set up S3 manually. Also, if you have the S3 File Module Provider configured in medusa-config.ts, remove it to avoid conflicts.
If you're using a Medusa version before v2.7.0, contact support for assistance in configuring the S3 File Module Provider.
</Note>Since Cloud is a managed service, you can't directly access your S3 bucket.
You can, however, access the S3 bucket details of your environment. This is useful when setting remote patterns in your storefront to allow loading assets from the S3 bucket.
To access the S3 bucket details of an environment:
<Note title="Tip">You can also navigate to a project's S3 details from the command palette. Press <Kbd>{getOsShortcut()}</Kbd> + <Kbd>K</Kbd>, select Storage, then choose a project.
</Note>From the S3 file URL, you can extract the bucket name and region. For example, if your S3 file URL is https://s3.eu-central-1.amazonaws.com/medusajs.cloud-data-prod-euc1-123:
medusajs.cloud-data-prod-euc1-123.eu-central-1.If you need to override the default S3 configurations of your Cloud project, such as changing public access to assets, you can do so by setting up and managing your own S3 bucket externally.
Then, configure the S3 File Module Provider in your medusa-config.ts file to connect to your external S3 instance. Refer to the S3 File Module Provider documentation for more details on how to configure it.
To set the connection options of your external S3 instance, refer to the Environments guide to learn how to add environment variables. You can then use these variables in your medusa-config.ts file to connect to your S3 instance.
When you upload files through your Medusa application hosted on Cloud, such as product images or other assets, the files are stored in the S3 bucket associated with that application's environment.
You can also upload files using Medusa's Upload Files API route, or in a custom API route that handles file upload.
By default, the S3 bucket of your Cloud projects is private, but the files you upload to the bucket are publicly accessible. This is necessary for serving product images and other assets in your Medusa application.