1.0.7 • Published 11 months ago

@treely/strapi-provider-upload-aws-s3-cloudfront v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

strapi-provider-upload-aws-s3-cloudfront

Description

This Strapi upload provider is based on the Strapi AWS S3 upload provider and adds support for CloudFront distribution.

Installation

# using yarn
yarn add @treely/strapi-provider-upload-aws-s3-cloudfront

# using npm
npm install @treely/strapi-provider-upload-aws-s3-cloudfront --save

Configurations

Your configuration is passed down to the provider. (e.g: new AWS.S3(config)). You can see the complete list of options here

See the using a provider documentation for information on installing and using a provider. And see the environment variables for setting and using environment variables in your configs.

Example

./config/plugins.js

module.exports = ({ env }) => ({
  upload: {
    provider: 'aws-s3-cloudfront',
    providerOptions: {
      accessKeyId: env('AWS_ACCESS_KEY_ID'),
      secretAccessKey: env('AWS_ACCESS_SECRET'),
      region: env('AWS_REGION', 'eu-west-1'),
      params: {
        Bucket: env('AWS_BUCKET_NAME'),
        CacheControl: 'public,max-age=691200,s-maxage=31536000,immutable',
      },
      cloudfrontURL: env('AWS_CLOUDFRONT_URL'),
    },
  },
});

Required AWS Policy Actions

These are the minimum amount of permissions needed for this provider to work.

"Action": [
  "s3:PutObject",
  "s3:GetObject",
  "s3:ListBucket",
  "s3:DeleteObject",
  "s3:PutObjectAcl"
],

Resources