How to deploy to AWS S3 Buckets
#
IntroductionUniform can deploy content from Sitecore to S3 buckets. The following functionality is available:
- Publish pages to S3 buckets
- Publish media files to S3 buckets
- Purge cache on CloudFront distribution
tip
You can use these features independently. For example, you can just publish media files to an S3 bucket without having to publish pages there, too.
#
Pre-requisites- You have completed the Getting Started section, so your site is ready to be deployed to static storage.
- Uniform for Sitecore starter kit (for Deploy).
- AWS account with the ability to create S3 buckets and CloudFront distributions.
- AWS account with the ability to create access keys.
#
AWS setupUniform does not have any special requirements for the AWS configuration. The configuration that is needed is typical of what you would expect when you want to use CloudFront to serve files from an S3 bucket.
In AWS, create a new S3 bucket, with public access enabled with read permissions.
info
Note the AWS region and bucket name. You will need these values to configure Sitecore to be able to deploy files to the bucket.
Create an access key that has read/write permissions on the S3 bucket.
info
Note the access key and secret key values. You will need these values to configure Sitecore to be able to deploy files to the bucket.
Create a new CloudFront distribution, with the origin domain set to the S3 bucket.
info
Note the distribution ID. You will need this value to configure Sitecore to be able to send cache purge commands to the distribution.
Create an access key that has cache purge permissions on the distribution.
info
Note the access key and secret key values. You will need these values to configure Sitecore to be able to send cache purge commands to the distribution.
#
Sitecore setuptip
Not all of the configuration described below is required. For example, if you are not deploying a static site, you do not need to complete the section on how to deploy pages to an S3 bucket.
#
Initial setupThe following configuration is required for all of the functionality below.
In Sitecore, open Content Editor.
Navigate to your site's SiteConfiguration item under sitecore > system > Uniform > SiteConfigurations.
info
If an item for your site does not exist, create an item using Site Configuration.
If a Configuration item is not the child of the SiteConfiguration item, create an item using Configure Site.
info
If you create this item, be sure to set the value for the field Inherits to the name of your Sitecore site.
#
Deploy pages to S3 bucket (optional)If you are using Uniform Deploy to generate a static site from a Sitecore site, you need a place to store the static files. You can configure Uniform to publish the files to an S3 bucket.
Navigate to your site's SiteConfiguration item under sitecore > system > Uniform > SiteConfigurations.
Select the item Configuration.
Create an item using Configure: AWS for Pages.
Set the field values using the details you noted when configuring AWS.
#
Deploy media files to S3 bucket (optional)There are multiple cases where you might want to publish media files to an S3 bucket. If you are using Uniform Deploy to generate a static site, media files can be stored in an S3 bucket. If you are using Uniform Platform, you can publish media files to an S3 bucket in order to eliminate the need for Sitecore CD instances.
Navigate to your site's SiteConfiguration item under sitecore > system > Uniform > SiteConfigurations.
Select the item Configuration.
Create an item using Configure: AWS for Media.
Set the field values using the details you noted when configuring AWS.
tip
Sitecore is responsible for generating URLs for media files.
You should check if the setting Media.MediaLinkServerUrl
is configured on your Sitecore instance. If it is set, make
sure it is not set to a value that will prevent the links
from being generated in a way that is compatible with the
URLs on CloudFront.
#
Purge cache for CloudFront distribution (optional)If you are storing any files in an S3 bucket and using CloudFront to serve the files, you might want to be able to purge the CloudFront when you deploy files to the S3 bucket.
Navigate to your site's SiteConfiguration item under sitecore > system > Uniform > SiteConfigurations.
Select the item Configuration.
Create an item using Configure: CloudFront Purge Service.
Set the field values using the details you noted when configuring AWS.
info
If you specified a region value in your CloudFront configuration, you should use the same value here.