Storing Files using Amazon S3

Overview

In this tutorial, we'll show you how to set up the app to store files in your own S3 bucket. 

Heads Up!

Existing fields cannot be switched to use S3. Setting the app to use your own S3 bucket applies to new fields only.

Setting Up Amazon S3

Create A New Bucket

We recommend creating a new bucket solely for this purpose at: https://s3.console.aws.amazon.com/s3/bucket/create

Using An Existing Bucket

You could use an existing bucket, however, the app will generate a new folder to store the files in that bucket and the app needs read and write access to the bucket. 

It's not possible to use your own folder structure. If you have existing files in existing folders, you'll need to import those resources via the app's import tools so they are properly attached to the appropriate Shopify product IDs. Technically, you'd be importing the files back into your own S3 bucket, just in a way that the app and Shopify can use.

Bucket Information

Make a note of your bucket name (the end of your Amazon resource name) and the bucket's Region.

Access Control

In general, you'll want the public to be able to see your files but not make changes to the bucket. You may have other needs based on your business rules. To get Custom Fields working, at a minimum you would want the following bucket settings.

Block public access (bucket settings): Uncheck "Block all public access"

Bucket policy: The following sample is a starting point. Customize it to suit your business.

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::YOURBUCKETPATH/*"
        }
    ]
}

Identity and Access Management (IAM)

You may wish to customize your user with limited permissions, however, limited permissions are outside the scope of this tutorial. To set up a new user with full access to all buckets under your S3 account, follow the steps below. 

Go to https://console.aws.amazon.com/iam/home#/home and click on Users under Access management in the left sidebar. Click on Add User. Name the user something meaningful, such as "custom_fields_shopify_app_ access". For Access type select Programatic access. Click Next. Click on Attach existing policies directly. Search for s3. Select it and click Next. Add tags if desired and click Next. Click Create user.

On the Success screen, copy the Access key ID and the Secret access key and store them in a safe place. This is the only time Amazon will show you this information.  

Setting Up Custom Fields

Go back to Custom Fields and Open the Amazon S3 Settings in the Settings Menu. Enter the information about your bucket name and access information and save. 

2019-03-19_1636.png

Field Configurations

Once the connection is configured, you'll be able to choose to use either your own S3 bucket or our file storage, on a per-field basis. By default, new fields will use our built-in file system unless S3 is selected in the settings for the field.