Amazon S3 integration is a feature that allows you to switch the storage destination of media such as images and videos uploaded from the microCMS management screen from the default storage of microCMS to an Amazon S3 bucket that you have prepared.
This enables you to apply security settings based on your company's policies, making it safe to use even for projects with high security requirements.
There is a similar feature called "Custom Domain Settings for Media". Please note that the purpose of this feature is different from the one we will explain here.
Custom Domain Settings for Media
This Feature (Switching Media Storage)
The Amazon S3 integration is a feature available to customers on the Enterprise plan. This feature is disabled by default, so please contact us if you wish to enable it. Additional fees may apply depending on your usage requirements.
For information on the features available for each plan, please visit the pricing page.
To use the Amazon S3 integration feature, the following conditions must be met. All of these are important, so please make sure to check them.
Typically, media (including files) uploaded to the management screen is stored in the storage managed by microCMS. With the Amazon S3 integration feature, you can save directly to an S3 bucket that you have prepared in advance.
As a result, the URL assigned to the media after upload will follow the domain defined by you in advance.
This feature also applies to media other than images (such as PDFs).
https://images.microcms-assets.io/assets/xxxx/yyyy/image.png
https://files.microcms-assets.io/assets/xxxx/yyyy/sample.pdf
https://{bucket-name}.s3.{region-name}.amazonaws.com/media/image.png
https://{bucket-name}.s3.{region-name}.amazonaws.com/media/sample.pdf
※The bucket name and region name set by you will be included in the delivery URL.
※The above is an example when not using custom domain settings. For information on custom domain settings, please refer to "Setting in the microCMS Management Screen".
In microCMS storage, the domain delivered varies depending on the media format, but after enabling this feature, the domain will be unified.
When this feature is enabled, the destination for media uploads will be the specified customer-managed S3 bucket.
The upload path will be target-bucket/{URL prefix}/{file name}. For file management purposes, the media will also have the following metadata attached.
x-amz-meta-upload-source: "microcms"x-amz-meta-microcms-service: {Internal Service ID (e.g., SERVICE#xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)}x-amz-meta-microcms-version: {Timestamp format version (e.g., 20250812154922)}x-amz-meta-microcms-status: "public"Objects (media) uploaded to the S3 bucket do not have a Cache-Control header, so they are not cached.
If you want to utilize caching for the media being delivered, please consider integrating with a CDN such as CloudFront.
Additionally, please check the "Precautions when integrating S3 with CloudFront and other CDNs" as well.
Once this feature is enabled, media uploaded will be accessible via the following URL:{Custom Domain}/{URL Prefix}/{File Name}
The media URLs provided by microCMS by default contain random strings, making them difficult to guess and ensuring high security.
However, after enabling this feature, the URLs of media uploaded will be in a state that is easy to guess, as they do not include random strings. Therefore, when handling sensitive files, please ensure to include unpredictable strings in the file names.
For media uploaded after this feature is enabled, the following operations are possible:
Additionally, the following operations will also be reflected in the files within the S3 bucket.
Generally, the configuration is carried out in the following flow.
Please prepare the AWS-related resources listed below.
If you have any questions regarding the configuration of various resources, please contact our support team.
Please prepare one S3 bucket to store media.
Additionally, set a bucket policy that grants permissions for operations to the created bucket.
If not using CloudFront with S3
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "<optional>",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<bucket-name>/<directory-name>/*"
}
]
}
If using CloudFront with S3
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "<optional>",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<bucket-name>/<directory-name>/*",
"Condition": {
"ArnLike": {
"AWS:SourceArn": "arn:aws:cloudfront::<account-id (12-digit number)>:distribution/<CloudFront distribution ID>"
}
}
}
]
}Please prepare one IAM policy that grants permissions for various operations on the S3 bucket.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "<optional>",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::<bucket-name>"
},
{
"Sid": "<optional>",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::<bucket-name>/<directory-name>/*"
}
]
}Please prepare one IAM role to be assigned when creating, modifying, or deleting S3 objects (media) from microCMS.
Attach the IAM policy created above to the IAM role you created.
If you are using CloudFront to deliver objects in the S3 bucket, please prepare one CloudFront distribution.
Please enter the configuration values shown below.
Only members with "Administrator" privileges can configure this feature.
Configuration Item (*) is required | Description | Example of Configuration Value |
|---|---|---|
Bucket Name (*) | Please enter the S3 bucket name where files will be uploaded. |
|
Region (*) | Please select the region where the bucket exists. |
|
IAM Role ARN (*) | Please enter the IAM role you have prepared in advance. Enter it as a string that uniquely identifies it within AWS services. |
|
External ID (*) | Please enter the condition key required for Assume Role. | (2~1224 characters, alphanumeric without spaces. Some symbols are also allowed) |
URL Prefix | Please enter the directory where files will be uploaded. Multiple levels can be specified. |
|
Custom Domain | Please enter the domain you want to use for distribution. If not set, |
|
Fix Media File Name | If enabled, re-uploading will only be possible with the same file name, and the file name cannot be changed. | OFF / ON |
Notes | You can freely enter notes regarding the connection settings. | (Free input) |
The configuration of the linked S3 and the management and operation of the data within the bucket are the customer's responsibility.
Changes to data or settings made without using the microCMS management screen or API are not covered by support, so please be aware of this in advance.
Note on Data Integrity
If you manipulate (add, change, or delete) data directly on S3 without using the microCMS management screen or API, it may cause inconsistencies with the information on the microCMS side, potentially leading to unexpected errors such as media not displaying correctly.
When integrating S3 with CloudFront and other CDNs and utilizing caching, there may be cases where cached data remains even after deleting media in the microCMS management screen.
As a countermeasure, please consider the following methods:
In the case of the first option, depending on the use case, images may be cached with parameters appended to the URL. Therefore, when deleting the cache, please specify a wildcard at the end of the path.
If media already exists, media will be saved to the customer-managed external S3 bucket after this feature is enabled.
Additionally, if there is media uploaded to the customer-managed external S3 bucket, changes to the S3 integration settings and deletion of settings cannot be performed.
Supports media registration via URL specification in POST / PUT / PATCH requests.
When creating multiple environments, the settings for this feature are also copied as initial settings.
Additionally, unlike the basic behavior during uploads, the upload destination path will be target-bucket/{URL prefix}/{unique value based on the service ID of the multiple environment}/{file name}.
The other specifications are as follows:
Contents